- removed key from constructor

- added set_key
This commit is contained in:
Martin Willi
2005-11-22 07:59:00 +00:00
parent 4aab514953
commit 002c583e26
4 changed files with 13 additions and 7 deletions
+2 -2
View File
@@ -29,13 +29,13 @@
/*
* Described in header
*/
prf_t *prf_create(pseudo_random_function_t pseudo_random_function, chunk_t key)
prf_t *prf_create(pseudo_random_function_t pseudo_random_function)
{
switch (pseudo_random_function)
{
case PRF_HMAC_SHA1:
{
return (prf_t*)prf_hmac_sha1_create(key);
return (prf_t*)prf_hmac_sha1_create();
}
case PRF_HMAC_MD5:
case PRF_HMAC_TIGER:
+9 -2
View File
@@ -64,6 +64,14 @@ struct prf_s {
*/
size_t (*get_block_size) (prf_t *this);
/**
* @brief Set the key for this prf
*
* @param this calling prf
* @return block size in bytes
*/
status_t (*set_key) (prf_t *this, chunk_t key);
/**
* @brief Destroys a prf object.
*
@@ -78,11 +86,10 @@ struct prf_s {
* Creates a new prf_t object
*
* @param pseudo_random_function Algorithm to use
* @param key A chunk containing the key
* @return
* - prf_t if successfully
* - NULL if out of ressources or prf not supported
*/
prf_t *prf_create(pseudo_random_function_t pseudo_random_function, chunk_t key);
prf_t *prf_create(pseudo_random_function_t pseudo_random_function);
#endif /*PRF_H_*/
@@ -44,7 +44,7 @@ struct private_prf_hmac_sha1_s {
/*
* Described in header
*/
prf_hmac_sha1_t *prf_hmac_sha1_create(chunk_t key)
prf_hmac_sha1_t *prf_hmac_sha1_create()
{
private_prf_hmac_sha1_t *this = allocator_alloc_thing(private_prf_hmac_sha1_t);
@@ -45,11 +45,10 @@ struct prf_hmac_sha1_s {
/**
* Creates a new prf_hmac_sha1_t object
*
* @param key Key to use for this prf
* @return
* - prf_hmac_sha1_t if successfully
* - NULL if out of ressources
*/
prf_hmac_sha1_t *prf_hmac_sha1_create(chunk_t key);
prf_hmac_sha1_t *prf_hmac_sha1_create();
#endif /*PRF_HMAC_SHA1_H_*/