Annotation of embedaddon/strongswan/src/libstrongswan/crypto/prf_plus.h, revision 1.1.1.1
1.1 misho 1: /*
2: * Copyright (C) 2005-2006 Martin Willi
3: * Copyright (C) 2005 Jan Hutter
4: * HSR Hochschule fuer Technik Rapperswil
5: *
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>.
10: *
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
14: * for more details.
15: */
16:
17: /**
18: * @defgroup prf_plus prf_plus
19: * @{ @ingroup crypto
20: */
21:
22: #ifndef PRF_PLUS_H_
23: #define PRF_PLUS_H_
24:
25: typedef struct prf_plus_t prf_plus_t;
26:
27: #include <crypto/prfs/prf.h>
28:
29: /**
30: * Implementation of the prf+ function used in IKEv1/IKEv2 keymat extension.
31: */
32: struct prf_plus_t {
33:
34: /**
35: * Get pseudo random bytes.
36: *
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
40: */
41: bool (*get_bytes)(prf_plus_t *this, size_t length,
42: uint8_t *buffer) __attribute__((warn_unused_result));
43:
44: /**
45: * Allocate pseudo random bytes.
46: *
47: * @param length number of bytes to get
48: * @param chunk chunk which will hold generated bytes
49: * @return TRUE if bytes allocated successfully
50: */
51: bool (*allocate_bytes)(prf_plus_t *this, size_t length,
52: chunk_t *chunk) __attribute__((warn_unused_result));
53:
54: /**
55: * Destroys a prf_plus_t object.
56: */
57: void (*destroy)(prf_plus_t *this);
58: };
59:
60: /**
61: * Creates a new prf_plus_t object.
62: *
63: * @param prf prf object to use, must be destroyed 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
67: */
68: prf_plus_t *prf_plus_create(prf_t *prf, bool counter, chunk_t seed);
69:
70: #endif /** PRF_PLUS_H_ @}*/
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>