- code cleaned up
This commit is contained in:
@@ -35,8 +35,13 @@ typedef struct hmac_t hmac_t;
|
||||
* described in RFC2104. It uses a hash function, wich must
|
||||
* be implemented as a hasher_t class.
|
||||
*
|
||||
* @see http://www.faqs.org/rfcs/rfc2104.html
|
||||
* @see hasher_t, prf_hmac_t
|
||||
* See http://www.faqs.org/rfcs/rfc2104.html for RFC.
|
||||
* @see
|
||||
* - hasher_t
|
||||
* - prf_hmac_t
|
||||
*
|
||||
* @b Constructors:
|
||||
* - hmac_create()
|
||||
*
|
||||
* @ingroup transforms
|
||||
*/
|
||||
@@ -45,11 +50,11 @@ struct hmac_t {
|
||||
* @brief Generate message authentication code.
|
||||
*
|
||||
* If buffer is NULL, no result is given back. A next call will
|
||||
* append the data to already supplied. If buffer is not NULL,
|
||||
* append the data to already supplied data. If buffer is not NULL,
|
||||
* the mac of all apended data is calculated, returned and the
|
||||
* state of the hmac_t reset;
|
||||
* state of the hmac_t is reseted.
|
||||
*
|
||||
* @param this calling hmac
|
||||
* @param this calling object
|
||||
* @param data chunk of data to authenticate
|
||||
* @param[out] buffer pointer where the generated bytes will be written
|
||||
*/
|
||||
@@ -64,34 +69,34 @@ struct hmac_t {
|
||||
* the mac of all apended data is calculated, returned and the
|
||||
* state of the hmac_t reset;
|
||||
*
|
||||
* @param this calling hmac
|
||||
* @param this calling object
|
||||
* @param data chunk of data to authenticate
|
||||
* @param[out] chunk chunk which will hold generated bytes
|
||||
*/
|
||||
void (*allocate_mac) (hmac_t *this, chunk_t data, chunk_t *chunk);
|
||||
|
||||
/**
|
||||
* @brief Get the block size of this hmac.
|
||||
* @brief Get the block size of this hmac_t object.
|
||||
*
|
||||
* @param this calling hmac
|
||||
* @param this calling object
|
||||
* @return block size in bytes
|
||||
*/
|
||||
size_t (*get_block_size) (hmac_t *this);
|
||||
|
||||
/**
|
||||
* @brief Set the key for this hmac.
|
||||
* @brief Set the key for this hmac_t object.
|
||||
*
|
||||
* Any key length is accepted.
|
||||
*
|
||||
* @param this calling hmac
|
||||
* @param this calling object
|
||||
* @param key key to set
|
||||
*/
|
||||
void (*set_key) (hmac_t *this, chunk_t key);
|
||||
|
||||
/**
|
||||
* @brief Destroys a hmac object.
|
||||
* @brief Destroys a hmac_t object.
|
||||
*
|
||||
* @param this hmac_t object to destroy
|
||||
* @param this calling object
|
||||
*/
|
||||
void (*destroy) (hmac_t *this);
|
||||
};
|
||||
@@ -99,17 +104,15 @@ struct hmac_t {
|
||||
/**
|
||||
* @brief Creates a new hmac_t object.
|
||||
*
|
||||
* Creates a new hmac_t object using hash_algorithm to
|
||||
* create a hasher_t internally.
|
||||
* Creates a hasher_t object internally.
|
||||
*
|
||||
* @param hash_algorithm hash algorithm to use
|
||||
* @return
|
||||
* - hmac_t if successfully
|
||||
* - NULL if hash not supported
|
||||
* - hmac_t object
|
||||
* - NULL if hash algorithm is not supported
|
||||
*
|
||||
* @ingroup transforms
|
||||
*/
|
||||
hmac_t *hmac_create(hash_algorithm_t hash_algorithm);
|
||||
|
||||
|
||||
#endif /*HMAC_H_*/
|
||||
|
||||
Reference in New Issue
Block a user