2 * Copyright (C) 2005-2006 Martin Willi
3 * Copyright (C) 2005 Jan Hutter
4 * Hochschule fuer Technik Rapperswil
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 * @defgroup prf_plus prf_plus
25 typedef struct prf_plus_t prf_plus_t
;
27 #include <crypto/prfs/prf.h>
30 * Implementation of the prf+ function used in IKEv1/IKEv2 keymat extension.
35 * Get pseudo random bytes.
37 * @param length number of bytes to get
38 * @param buffer pointer where the generated bytes will be written
39 * @return TRUE if bytes generated successfully
41 bool (*get_bytes
)(prf_plus_t
*this, size_t length
,
42 u_int8_t
*buffer
) __attribute__((warn_unused_result
));
45 * Allocate pseudo random bytes.
47 * @param length number of bytes to get
48 * @param chunk chunk which will hold generated bytes
49 * @return TRUE if bytes allocated successfully
51 bool (*allocate_bytes
)(prf_plus_t
*this, size_t length
,
52 chunk_t
*chunk
) __attribute__((warn_unused_result
));
55 * Destroys a prf_plus_t object.
57 void (*destroy
)(prf_plus_t
*this);
61 * Creates a new prf_plus_t object.
63 * @param prf prf object to use, must be destroyd after prf+.
64 * @param counter use an appending counter byte (for IKEv2 variant)
65 * @param seed input seed for prf
66 * @return prf_plus_t object, NULL on failure
68 prf_plus_t
*prf_plus_create(prf_t
*prf
, bool counter
, chunk_t seed
);
70 #endif /** PRF_PLUS_H_ @}*/