From 88f59c99c5a681ff091353d36be9391a67ace91a Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Thu, 9 Mar 2017 13:11:10 +0100 Subject: [PATCH] Avoid variable shadowing --- .../box_curve25519xchacha20poly1305.c | 5 ++--- .../box_curve25519xsalsa20poly1305.c | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/libsodium/crypto_box/curve25519xchacha20poly1305/box_curve25519xchacha20poly1305.c b/src/libsodium/crypto_box/curve25519xchacha20poly1305/box_curve25519xchacha20poly1305.c index aab38c04..1ccf8076 100644 --- a/src/libsodium/crypto_box/curve25519xchacha20poly1305/box_curve25519xchacha20poly1305.c +++ b/src/libsodium/crypto_box/curve25519xchacha20poly1305/box_curve25519xchacha20poly1305.c @@ -36,19 +36,18 @@ crypto_box_curve25519xchacha20poly1305_keypair(unsigned char *pk, return crypto_scalarmult_curve25519_base(pk, sk); } -static const unsigned char n[16] = { 0 }; - int crypto_box_curve25519xchacha20poly1305_beforenm(unsigned char * k, const unsigned char *pk, const unsigned char *sk) { + static const unsigned char zero[16] = { 0 }; unsigned char s[32]; if (crypto_scalarmult_curve25519(s, sk, pk) != 0) { return -1; } - return crypto_core_hchacha20(k, n, s, NULL); + return crypto_core_hchacha20(k, zero, s, NULL); } int diff --git a/src/libsodium/crypto_box/curve25519xsalsa20poly1305/box_curve25519xsalsa20poly1305.c b/src/libsodium/crypto_box/curve25519xsalsa20poly1305/box_curve25519xsalsa20poly1305.c index b506c6bf..eac9dce0 100644 --- a/src/libsodium/crypto_box/curve25519xsalsa20poly1305/box_curve25519xsalsa20poly1305.c +++ b/src/libsodium/crypto_box/curve25519xsalsa20poly1305/box_curve25519xsalsa20poly1305.c @@ -31,19 +31,18 @@ crypto_box_curve25519xsalsa20poly1305_keypair(unsigned char *pk, return crypto_scalarmult_curve25519_base(pk, sk); } -static const unsigned char n[16] = { 0 }; - int crypto_box_curve25519xsalsa20poly1305_beforenm(unsigned char * k, const unsigned char *pk, const unsigned char *sk) { + static const unsigned char zero[16] = { 0 }; unsigned char s[32]; if (crypto_scalarmult_curve25519(s, sk, pk) != 0) { return -1; } - return crypto_core_hsalsa20(k, n, s, NULL); + return crypto_core_hsalsa20(k, zero, s, NULL); } int