4 * @brief Interface for prf_plus.h.
9 * Copyright (C) 2005-2006 Martin Willi
10 * Copyright (C) 2005 Jan Hutter
11 * Hochschule fuer Technik Rapperswil
13 * This program is free software; you can redistribute it and/or modify it
14 * under the terms of the GNU General Public License as published by the
15 * Free Software Foundation; either version 2 of the License, or (at your
16 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
18 * This program is distributed in the hope that it will be useful, but
19 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
20 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
27 typedef struct prf_plus_t prf_plus_t
;
29 #include <crypto/prfs/prf.h>
32 * @brief Implementation of the prf+ function described in IKEv2 RFC.
34 * This class implements the prf+ algorithm. Internally it uses a pseudo random
35 * function, which implements the prf_t interface.
46 * @brief Get pseudo random bytes.
48 * Get the next few bytes of the prf+ output. Space
49 * must be allocated by the caller.
51 * @param this calling object
52 * @param length number of bytes to get
53 * @param[out] buffer pointer where the generated bytes will be written
55 void (*get_bytes
) (prf_plus_t
*this, size_t length
, u_int8_t
*buffer
);
58 * @brief Allocate pseudo random bytes.
60 * Get the next few bytes of the prf+ output. This function
61 * will allocate the required space.
63 * @param this calling object
64 * @param length number of bytes to get
65 * @param[out] chunk chunk which will hold generated bytes
67 void (*allocate_bytes
) (prf_plus_t
*this, size_t length
, chunk_t
*chunk
);
70 * @brief Destroys a prf_plus_t object.
72 * @param this calling object
74 void (*destroy
) (prf_plus_t
*this);
78 * @brief Creates a new prf_plus_t object.
80 * Seed will be cloned. prf will
81 * not be cloned, must be destroyed outside after
84 * @param prf prf object to use
85 * @param seed input seed for prf
86 * @return prf_plus_t object
90 prf_plus_t
*prf_plus_create(prf_t
*prf
, chunk_t seed
);
92 #endif /*PRF_PLUS_H_*/