fixed typo
[strongswan.git] / src / libstrongswan / crypto / prf_plus.h
1 /**
2 * @file prf_plus.h
3 *
4 * @brief Interface for prf_plus.h.
5 *
6 */
7
8 /*
9 * Copyright (C) 2005-2006 Martin Willi
10 * Copyright (C) 2005 Jan Hutter
11 * Hochschule fuer Technik Rapperswil
12 *
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>.
17 *
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
21 * for more details.
22 */
23
24 #ifndef PRF_PLUS_H_
25 #define PRF_PLUS_H_
26
27 typedef struct prf_plus_t prf_plus_t;
28
29 #include <crypto/prfs/prf.h>
30
31 /**
32 * @brief Implementation of the prf+ function described in IKEv2 RFC.
33 *
34 * This class implements the prf+ algorithm. Internally it uses a pseudo random
35 * function, which implements the prf_t interface.
36 *
37 * See IKEv2 RFC 2.13.
38 *
39 * @b Constructors:
40 * - prf_plus_create()
41 *
42 * @ingroup transforms
43 */
44 struct prf_plus_t {
45 /**
46 * @brief Get pseudo random bytes.
47 *
48 * Get the next few bytes of the prf+ output. Space
49 * must be allocated by the caller.
50 *
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
54 */
55 void (*get_bytes) (prf_plus_t *this, size_t length, u_int8_t *buffer);
56
57 /**
58 * @brief Allocate pseudo random bytes.
59 *
60 * Get the next few bytes of the prf+ output. This function
61 * will allocate the required space.
62 *
63 * @param this calling object
64 * @param length number of bytes to get
65 * @param[out] chunk chunk which will hold generated bytes
66 */
67 void (*allocate_bytes) (prf_plus_t *this, size_t length, chunk_t *chunk);
68
69 /**
70 * @brief Destroys a prf_plus_t object.
71 *
72 * @param this calling object
73 */
74 void (*destroy) (prf_plus_t *this);
75 };
76
77 /**
78 * @brief Creates a new prf_plus_t object.
79 *
80 * Seed will be cloned. prf will
81 * not be cloned, must be destroyed outside after
82 * prf_plus_t usage.
83 *
84 * @param prf prf object to use
85 * @param seed input seed for prf
86 * @return prf_plus_t object
87 *
88 * @ingroup transforms
89 */
90 prf_plus_t *prf_plus_create(prf_t *prf, chunk_t seed);
91
92 #endif /*PRF_PLUS_H_*/