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 <transforms/prfs/prf.h>
30 typedef struct prf_plus_t prf_plus_t
;
33 * @brief Implementation of the prf+ function described in IKEv2 draft.
35 * This class implements the prf+ algorithm. Internalliy it uses a pseudo random
36 * function, which implements the prf_t interface.
38 * @see IKEv2 draft 2.13
44 * @brief Get pseudo random bytes.
46 * Get the next few bytes of the prf+ output. Space
47 * must be allocated by the caller.
49 * @param this calling prf_plus
50 * @param length number of bytes to get
51 * @param[out] buffer pointer where the generated bytes will be written
53 * - SUCCESS in any case
55 status_t (*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 prf_plus
64 * @param length number of bytes to get
65 * @param[out] chunk chunk which will hold generated bytes
67 * - SUCCESS in any case
68 * - OUT_OF_RES if space could not be allocated
70 status_t (*allocate_bytes
) (prf_plus_t
*this, size_t length
, chunk_t
*chunk
);
73 * @brief Destroys a prf_plus_t object.
75 * @param this prf_plus_t object to destroy
77 * - SUCCESS in any case
79 status_t (*destroy
) (prf_plus_t
*this);
83 * @brief Creates a new prf_plus_t object.
85 * Seed will be cloned. prf will
86 * not be cloned, must be destroyed outside after
89 * @param prf prf object to use
90 * @param seed input seed for prf
92 * - prf_plus_t if successfully
93 * - NULL if out of ressources
97 prf_plus_t
*prf_plus_create(prf_t
*prf
, chunk_t seed
);
99 #endif /*PRF_PLUS_H_*/