- moved algorithm definitions from payloads to corresponding transforms
- cleanup of docs in transforms
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @file prf.h
|
||||
*
|
||||
* @brief Generic interface for pseudo-random-functions
|
||||
* @brief Interface of prf_t.
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -23,35 +23,53 @@
|
||||
#ifndef PRF_H_
|
||||
#define PRF_H_
|
||||
|
||||
#include <encoding/payloads/transform_substructure.h>
|
||||
#include <types.h>
|
||||
|
||||
typedef enum pseudo_random_function_t pseudo_random_function_t;
|
||||
|
||||
/**
|
||||
* @brief Pseudo random function, as in IKEv2 draft 3.3.2.
|
||||
*/
|
||||
enum pseudo_random_function_t {
|
||||
PRF_UNDEFINED = 1024,
|
||||
PRF_HMAC_MD5 = 1,
|
||||
PRF_HMAC_SHA1 = 2,
|
||||
PRF_HMAC_TIGER = 3,
|
||||
PRF_AES128_CBC = 4
|
||||
};
|
||||
|
||||
/**
|
||||
* string mappings for encryption_algorithm_t
|
||||
*/
|
||||
extern mapping_t pseudo_random_function_m[];
|
||||
|
||||
|
||||
typedef struct prf_t prf_t;
|
||||
|
||||
/**
|
||||
* Object representing a diffie hellman exchange
|
||||
* @brief Generic interface for pseudo-random-functions.
|
||||
*
|
||||
* @ingroup prfs
|
||||
*/
|
||||
struct prf_t {
|
||||
/**
|
||||
* @brief generates pseudo random bytes and writes them
|
||||
* in the buffer
|
||||
* in the buffer.
|
||||
*
|
||||
* @param this calling prf
|
||||
* @param seed a chunk containing the seed for the next bytes
|
||||
* @param [out]buffer pointer where the generated bytes will be written
|
||||
* @param[out] buffer pointer where the generated bytes will be written
|
||||
* @return
|
||||
* - SUCCESS in any case
|
||||
*/
|
||||
status_t (*get_bytes) (prf_t *this, chunk_t seed, u_int8_t *buffer);
|
||||
|
||||
/**
|
||||
* @brief generates pseudo random bytes and allocate space for them
|
||||
* @brief generates pseudo random bytes and allocate space for them.
|
||||
*
|
||||
* @param this calling prf
|
||||
* @param seed a chunk containing the seed for the next bytes
|
||||
* @param [out]chunk chunk which will hold generated bytes
|
||||
* @param[out] chunk chunk which will hold generated bytes
|
||||
* @return
|
||||
* - SUCCESS in any case
|
||||
* - OUT_OF_RES if space could not be allocated
|
||||
@@ -59,7 +77,7 @@ struct prf_t {
|
||||
status_t (*allocate_bytes) (prf_t *this, chunk_t seed, chunk_t *chunk);
|
||||
|
||||
/**
|
||||
* @brief get the block size of this prf
|
||||
* @brief get the block size of this prf.
|
||||
*
|
||||
* @param this calling prf
|
||||
* @return block size in bytes
|
||||
@@ -67,25 +85,27 @@ struct prf_t {
|
||||
size_t (*get_block_size) (prf_t *this);
|
||||
|
||||
/**
|
||||
* @brief Set the key for this prf
|
||||
* @brief Set the key for this prf.
|
||||
*
|
||||
* @param this calling prf
|
||||
* @return block size in bytes
|
||||
* @param key key to set
|
||||
* @return
|
||||
* - SUCCESS in any case
|
||||
*/
|
||||
status_t (*set_key) (prf_t *this, chunk_t key);
|
||||
|
||||
/**
|
||||
* @brief Destroys a prf object.
|
||||
* @brief Destroys a prf object..
|
||||
*
|
||||
* @param this prf_t object to destroy
|
||||
* @param this prf_t object to destroy
|
||||
* @return
|
||||
* SUCCESS in any case
|
||||
* - SUCCESS in any case
|
||||
*/
|
||||
status_t (*destroy) (prf_t *this);
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a new prf_t object
|
||||
* @brief Generic constructor for a prf_t.
|
||||
*
|
||||
* @param pseudo_random_function Algorithm to use
|
||||
* @return
|
||||
|
||||
Reference in New Issue
Block a user