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