Add a return value to prf_t.get_bytes()
This commit is contained in:
@@ -48,7 +48,7 @@ struct private_fips_prf_t {
|
||||
/**
|
||||
* G function, either SHA1 or DES
|
||||
*/
|
||||
void (*g)(private_fips_prf_t *this, chunk_t c, u_int8_t res[]);
|
||||
bool (*g)(private_fips_prf_t *this, chunk_t c, u_int8_t res[]);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -106,7 +106,7 @@ static void chunk_mod(size_t length, chunk_t chunk, u_int8_t buffer[])
|
||||
* 0xcb, 0x0f, 0x6c, 0x55, 0xba, 0xbb, 0x13, 0x78,
|
||||
* 0x8e, 0x20, 0xd7, 0x37, 0xa3, 0x27, 0x51, 0x16
|
||||
*/
|
||||
METHOD(prf_t, get_bytes, void,
|
||||
METHOD(prf_t, get_bytes, bool,
|
||||
private_fips_prf_t *this, chunk_t seed, u_int8_t w[])
|
||||
{
|
||||
int i;
|
||||
@@ -138,6 +138,8 @@ METHOD(prf_t, get_bytes, void,
|
||||
}
|
||||
|
||||
/* 3.3 done already, mod q not used */
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
METHOD(prf_t, get_block_size, size_t,
|
||||
@@ -168,7 +170,7 @@ METHOD(prf_t, set_key, void,
|
||||
/**
|
||||
* Implementation of the G() function based on SHA1
|
||||
*/
|
||||
void g_sha1(private_fips_prf_t *this, chunk_t c, u_int8_t res[])
|
||||
static bool g_sha1(private_fips_prf_t *this, chunk_t c, u_int8_t res[])
|
||||
{
|
||||
u_int8_t buf[64];
|
||||
|
||||
@@ -188,7 +190,11 @@ void g_sha1(private_fips_prf_t *this, chunk_t c, u_int8_t res[])
|
||||
|
||||
/* use the keyed hasher, but use an empty key to use SHA1 IV */
|
||||
this->keyed_prf->set_key(this->keyed_prf, chunk_empty);
|
||||
this->keyed_prf->get_bytes(this->keyed_prf, c, res);
|
||||
if (!this->keyed_prf->get_bytes(this->keyed_prf, c, res))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
METHOD(prf_t, destroy, void,
|
||||
|
||||
Reference in New Issue
Block a user