Avoid variable shadowing

This commit is contained in:
Frank Denis 2017-03-09 13:11:10 +01:00
parent c759324679
commit 88f59c99c5
2 changed files with 4 additions and 6 deletions

View File

@ -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

View File

@ -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