Extended PRF+ by a non-counting variant as used by IKEv1

This commit is contained in:
Martin Willi
2012-03-20 17:30:48 +01:00
parent f5c0096086
commit d4f6686c69
3 changed files with 50 additions and 65 deletions
+5 -17
View File
@@ -27,19 +27,13 @@ typedef struct prf_plus_t prf_plus_t;
#include <crypto/prfs/prf.h>
/**
* Implementation of the prf+ function described in IKEv2 RFC.
*
* This class implements the prf+ algorithm. Internally it uses a pseudo random
* function, which implements the prf_t interface.
* See IKEv2 RFC 2.13.
* Implementation of the prf+ function used in IKEv1/IKEv2 keymat extension.
*/
struct prf_plus_t {
/**
* Get pseudo random bytes.
*
* Get the next few bytes of the prf+ output. Space
* must be allocated by the caller.
*
* @param length number of bytes to get
* @param buffer pointer where the generated bytes will be written
*/
@@ -48,9 +42,6 @@ struct prf_plus_t {
/**
* Allocate pseudo random bytes.
*
* Get the next few bytes of the prf+ output. This function
* will allocate the required space.
*
* @param length number of bytes to get
* @param chunk chunk which will hold generated bytes
*/
@@ -65,14 +56,11 @@ struct prf_plus_t {
/**
* Creates a new prf_plus_t object.
*
* Seed will be cloned. prf will
* not be cloned, must be destroyed outside after
* prf_plus_t usage.
*
* @param prf prf object to use
* @param prf prf object to use, must be destroyd after prf+.
* @param counter use an appending counter byte (for IKEv2 variant)
* @param seed input seed for prf
* @return prf_plus_t object
*/
prf_plus_t *prf_plus_create(prf_t *prf, chunk_t seed);
prf_plus_t *prf_plus_create(prf_t *prf, bool counter, chunk_t seed);
#endif /** PRF_PLUS_H_ @}*/