mirror of
https://github.com/openssl/openssl.git
synced 2025-01-12 13:36:28 +08:00
bn2binpad: Use memset as the buffer will be used later
Apparently using OPENSSL_cleanse() confuses the fuzzer so it makes the buffer to appear uninitialized. And memset can be safely used here and it is also potentially faster. Fixes #17237 Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de> (Merged from https://github.com/openssl/openssl/pull/17240)
This commit is contained in:
parent
61fa00a4d0
commit
858d5ac16d
@ -505,7 +505,8 @@ int bn2binpad(const BIGNUM *a, unsigned char *to, int tolen, endianess_t endiane
|
||||
/* Swipe through whole available data and don't give away padded zero. */
|
||||
atop = a->dmax * BN_BYTES;
|
||||
if (atop == 0) {
|
||||
OPENSSL_cleanse(to, tolen);
|
||||
if (tolen != 0)
|
||||
memset(to, '\0', tolen);
|
||||
return tolen;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user