mirror of
https://github.com/jedisct1/libsodium.git
synced 2024-12-23 20:15:19 -07:00
Avoid partial array initialization
This commit is contained in:
parent
b7cb241eb9
commit
531b545578
@ -137,9 +137,11 @@ void
|
|||||||
crypto_core_ed25519_scalar_add(unsigned char *z, const unsigned char *x,
|
crypto_core_ed25519_scalar_add(unsigned char *z, const unsigned char *x,
|
||||||
const unsigned char *y)
|
const unsigned char *y)
|
||||||
{
|
{
|
||||||
unsigned char x_[crypto_core_ed25519_NONREDUCEDSCALARBYTES] = { 0U };
|
unsigned char x_[crypto_core_ed25519_NONREDUCEDSCALARBYTES];
|
||||||
unsigned char y_[crypto_core_ed25519_NONREDUCEDSCALARBYTES] = { 0U };
|
unsigned char y_[crypto_core_ed25519_NONREDUCEDSCALARBYTES];
|
||||||
|
|
||||||
|
memset(x_, 0, sizeof x_);
|
||||||
|
memset(y_, 0, sizeof y_);
|
||||||
memcpy(x_, x, crypto_core_ed25519_SCALARBYTES);
|
memcpy(x_, x, crypto_core_ed25519_SCALARBYTES);
|
||||||
memcpy(y_, y, crypto_core_ed25519_SCALARBYTES);
|
memcpy(y_, y, crypto_core_ed25519_SCALARBYTES);
|
||||||
sodium_add(x_, y_, crypto_core_ed25519_SCALARBYTES);
|
sodium_add(x_, y_, crypto_core_ed25519_SCALARBYTES);
|
||||||
|
Loading…
Reference in New Issue
Block a user