From 531b545578fae2f779efde1116586fbff1e9b9bd Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Sat, 5 Jan 2019 22:58:07 +0100 Subject: [PATCH] Avoid partial array initialization --- src/libsodium/crypto_core/ed25519/core_ed25519.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/libsodium/crypto_core/ed25519/core_ed25519.c b/src/libsodium/crypto_core/ed25519/core_ed25519.c index 3169ff35..15c004b9 100644 --- a/src/libsodium/crypto_core/ed25519/core_ed25519.c +++ b/src/libsodium/crypto_core/ed25519/core_ed25519.c @@ -137,9 +137,11 @@ void crypto_core_ed25519_scalar_add(unsigned char *z, const unsigned char *x, const unsigned char *y) { - unsigned char x_[crypto_core_ed25519_NONREDUCEDSCALARBYTES] = { 0U }; - unsigned char y_[crypto_core_ed25519_NONREDUCEDSCALARBYTES] = { 0U }; + unsigned char x_[crypto_core_ed25519_NONREDUCEDSCALARBYTES]; + 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(y_, y, crypto_core_ed25519_SCALARBYTES); sodium_add(x_, y_, crypto_core_ed25519_SCALARBYTES);