85 lines
2.2 KiB
C
85 lines
2.2 KiB
C
/**
|
|
* @file prf_plus.h
|
|
*
|
|
* @brief Implements the prf+ function described in IKEv2 draft.
|
|
*
|
|
*/
|
|
|
|
/*
|
|
* Copyright (C) 2005 Jan Hutter, Martin Willi
|
|
* Hochschule fuer Technik Rapperswil
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
* under the terms of the GNU General Public License as published by the
|
|
* Free Software Foundation; either version 2 of the License, or (at your
|
|
* option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
|
|
*
|
|
* This program is distributed in the hope that it will be useful, but
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
* for more details.
|
|
*/
|
|
|
|
#ifndef PRF_PLUS_H_
|
|
#define PRF_PLUS_H_
|
|
|
|
|
|
#include <transforms/prfs/prf.h>
|
|
|
|
|
|
/**
|
|
* Object representing a prf_plus
|
|
*/
|
|
typedef struct prf_plus_s prf_plus_t;
|
|
|
|
struct prf_plus_s {
|
|
/**
|
|
* @brief Get pseudo random bytes.
|
|
*
|
|
* @param this calling prf_plus
|
|
* @param length number of bytes to get
|
|
* @param [out]buffer pointer where the generated bytes will be written
|
|
* @return
|
|
* - SUCCESS in any case
|
|
*/
|
|
status_t (*get_bytes) (prf_plus_t *this, size_t length, u_int8_t *buffer);
|
|
|
|
/**
|
|
* @brief Allocate pseudo random bytes.
|
|
*
|
|
* @param this calling prf_plus
|
|
* @param length number of bytes to get
|
|
* @param [out]chunk chunk which will hold generated bytes
|
|
* @return
|
|
* - SUCCESS in any case
|
|
* - OUT_OF_RES if space could not be allocated
|
|
*/
|
|
status_t (*allocate_bytes) (prf_plus_t *this, size_t length, chunk_t *chunk);
|
|
|
|
/**
|
|
* @brief Destroys a prf_plus object.
|
|
*
|
|
* @param this prf_plus_t object to destroy
|
|
* @return
|
|
* - SUCCESS in any case
|
|
*/
|
|
status_t (*destroy) (prf_plus_t *this);
|
|
};
|
|
|
|
/**
|
|
* Creates a new prf_plus_t object
|
|
*
|
|
* Seed will be cloned. prf will
|
|
* not be cloned, must be destroyed outside after
|
|
* prf_plus usage.
|
|
*
|
|
* @param prf prf object to use
|
|
* @param seed input seed for prf
|
|
* @return
|
|
* - prf_plus_t if successfully
|
|
* - NULL if out of ressources or hash not supported
|
|
*/
|
|
prf_plus_t *prf_plus_create(prf_t *prf, chunk_t seed);
|
|
|
|
#endif /*PRF_PLUS_H_*/
|