diff options
Diffstat (limited to 'src/crypto/fips_prf_openssl.c')
-rw-r--r-- | src/crypto/fips_prf_openssl.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/crypto/fips_prf_openssl.c b/src/crypto/fips_prf_openssl.c index 92f0b57..d69ecea 100644 --- a/src/crypto/fips_prf_openssl.c +++ b/src/crypto/fips_prf_openssl.c @@ -31,13 +31,14 @@ int fips186_2_prf(const u8 *seed, size_t seed_len, u8 *x, size_t xlen) u8 *xpos = x; u32 carry; - if (seed_len > sizeof(xkey)) + if (seed_len < sizeof(xkey)) + os_memset(xkey + seed_len, 0, sizeof(xkey) - seed_len); + else seed_len = sizeof(xkey); /* FIPS 186-2 + change notice 1 */ os_memcpy(xkey, seed, seed_len); - os_memset(xkey + seed_len, 0, 64 - seed_len); t[0] = 0x67452301; t[1] = 0xEFCDAB89; t[2] = 0x98BADCFE; |