mirror of
https://github.com/jedisct1/libsodium.git
synced 2024-12-23 20:15:19 -07:00
Add comments, avoid implicit array initialization
This commit is contained in:
parent
1647f0d53a
commit
e45fadffb1
@ -98,11 +98,13 @@ static const unsigned char L[] = {
|
||||
void
|
||||
crypto_core_ed25519_scalar_negate(unsigned char *neg, const unsigned char *s)
|
||||
{
|
||||
unsigned char t_[crypto_core_ed25519_NONREDUCEDSCALARBYTES] = { 0U };
|
||||
unsigned char s_[crypto_core_ed25519_NONREDUCEDSCALARBYTES] = { 0U };
|
||||
unsigned char t_[crypto_core_ed25519_NONREDUCEDSCALARBYTES];
|
||||
unsigned char s_[crypto_core_ed25519_NONREDUCEDSCALARBYTES];
|
||||
|
||||
COMPILER_ASSERT(crypto_core_ed25519_NONREDUCEDSCALARBYTES >=
|
||||
2 * crypto_core_ed25519_SCALARBYTES);
|
||||
memset(t_, 0, sizeof t_);
|
||||
memset(s_, 0, sizeof s_);
|
||||
memcpy(t_ + crypto_core_ed25519_SCALARBYTES, L,
|
||||
crypto_core_ed25519_SCALARBYTES);
|
||||
memcpy(s_, s, crypto_core_ed25519_SCALARBYTES);
|
||||
@ -115,11 +117,14 @@ void
|
||||
crypto_core_ed25519_scalar_complement(unsigned char *comp,
|
||||
const unsigned char *s)
|
||||
{
|
||||
unsigned char t_[crypto_core_ed25519_NONREDUCEDSCALARBYTES] = { 1U };
|
||||
unsigned char s_[crypto_core_ed25519_NONREDUCEDSCALARBYTES] = { 0U };
|
||||
unsigned char t_[crypto_core_ed25519_NONREDUCEDSCALARBYTES];
|
||||
unsigned char s_[crypto_core_ed25519_NONREDUCEDSCALARBYTES];
|
||||
|
||||
COMPILER_ASSERT(crypto_core_ed25519_NONREDUCEDSCALARBYTES >=
|
||||
2 * crypto_core_ed25519_SCALARBYTES);
|
||||
memset(t_, 0, sizeof t_);
|
||||
memset(s_, 0, sizeof s_);
|
||||
t_[0]++;
|
||||
memcpy(t_ + crypto_core_ed25519_SCALARBYTES, L,
|
||||
crypto_core_ed25519_SCALARBYTES);
|
||||
memcpy(s_, s, crypto_core_ed25519_SCALARBYTES);
|
||||
|
@ -184,7 +184,7 @@ blake2b_init_key(blake2b_state *S, const uint8_t outlen, const void *key,
|
||||
sodium_misuse();
|
||||
}
|
||||
if (!key || !keylen || keylen > BLAKE2B_KEYBYTES) {
|
||||
sodium_misuse();
|
||||
sodium_misuse(); /* does not return */
|
||||
}
|
||||
P->digest_length = outlen;
|
||||
P->key_length = keylen;
|
||||
@ -222,7 +222,7 @@ blake2b_init_key_salt_personal(blake2b_state *S, const uint8_t outlen,
|
||||
sodium_misuse();
|
||||
}
|
||||
if (!key || !keylen || keylen > BLAKE2B_KEYBYTES) {
|
||||
sodium_misuse();
|
||||
sodium_misuse(); /* does not return */
|
||||
}
|
||||
P->digest_length = outlen;
|
||||
P->key_length = keylen;
|
||||
|
Loading…
Reference in New Issue
Block a user