Migrated crypto/prf_plus to INIT/METHOD macros
This commit is contained in:
@@ -56,10 +56,8 @@ struct private_prf_plus_t {
|
|||||||
u_int8_t appending_octet;
|
u_int8_t appending_octet;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
METHOD(prf_plus_t, get_bytes, void,
|
||||||
* Implementation of prf_plus_t.get_bytes.
|
private_prf_plus_t *this, size_t length, u_int8_t *buffer)
|
||||||
*/
|
|
||||||
static void get_bytes(private_prf_plus_t *this, size_t length, u_int8_t *buffer)
|
|
||||||
{
|
{
|
||||||
chunk_t appending_chunk;
|
chunk_t appending_chunk;
|
||||||
size_t bytes_in_round;
|
size_t bytes_in_round;
|
||||||
@@ -89,10 +87,8 @@ static void get_bytes(private_prf_plus_t *this, size_t length, u_int8_t *buffer)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
METHOD(prf_plus_t, allocate_bytes, void,
|
||||||
* Implementation of prf_plus_t.allocate_bytes.
|
private_prf_plus_t *this, size_t length, chunk_t *chunk)
|
||||||
*/
|
|
||||||
static void allocate_bytes(private_prf_plus_t *this, size_t length, chunk_t *chunk)
|
|
||||||
{
|
{
|
||||||
if (length)
|
if (length)
|
||||||
{
|
{
|
||||||
@@ -106,10 +102,8 @@ static void allocate_bytes(private_prf_plus_t *this, size_t length, chunk_t *chu
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
METHOD(prf_plus_t, destroy, void,
|
||||||
* Implementation of prf_plus_t.destroy.
|
private_prf_plus_t *this)
|
||||||
*/
|
|
||||||
static void destroy(private_prf_plus_t *this)
|
|
||||||
{
|
{
|
||||||
free(this->buffer.ptr);
|
free(this->buffer.ptr);
|
||||||
free(this->seed.ptr);
|
free(this->seed.ptr);
|
||||||
@@ -124,15 +118,14 @@ prf_plus_t *prf_plus_create(prf_t *prf, chunk_t seed)
|
|||||||
private_prf_plus_t *this;
|
private_prf_plus_t *this;
|
||||||
chunk_t appending_chunk;
|
chunk_t appending_chunk;
|
||||||
|
|
||||||
this = malloc_thing(private_prf_plus_t);
|
INIT(this,
|
||||||
|
.public = {
|
||||||
/* set public methods */
|
.get_bytes = _get_bytes,
|
||||||
this->public.get_bytes = (void (*)(prf_plus_t *,size_t,u_int8_t*))get_bytes;
|
.allocate_bytes = _allocate_bytes,
|
||||||
this->public.allocate_bytes = (void (*)(prf_plus_t *,size_t,chunk_t*))allocate_bytes;
|
.destroy = _destroy,
|
||||||
this->public.destroy = (void (*)(prf_plus_t *))destroy;
|
},
|
||||||
|
.prf = prf,
|
||||||
/* take over prf */
|
);
|
||||||
this->prf = prf;
|
|
||||||
|
|
||||||
/* allocate buffer for prf output */
|
/* allocate buffer for prf output */
|
||||||
this->buffer.len = prf->get_block_size(prf);
|
this->buffer.len = prf->get_block_size(prf);
|
||||||
|
|||||||
Reference in New Issue
Block a user