mirror of
https://github.com/jedisct1/libsodium.git
synced 2026-08-25 19:27:12 +09:00
Remove useless sodium_memzero, add one that makes sense
This commit is contained in:
@@ -37,8 +37,6 @@ crypto_box_seal(unsigned char *c, const unsigned char *m,
|
||||
nonce, pk, esk);
|
||||
memcpy(c, epk, crypto_box_PUBLICKEYBYTES);
|
||||
sodium_memzero(esk, sizeof esk);
|
||||
sodium_memzero(epk, sizeof epk);
|
||||
sodium_memzero(nonce, sizeof nonce);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
+4
-1
@@ -48,7 +48,10 @@ crypto_box_curve25519xchacha20poly1305_beforenm(unsigned char *k,
|
||||
if (crypto_scalarmult_curve25519(s, sk, pk) != 0) {
|
||||
return -1;
|
||||
}
|
||||
return crypto_core_hchacha20(k, zero, s, NULL);
|
||||
crypto_core_hchacha20(k, zero, s, NULL);
|
||||
sodium_memzero(s, sizeof s);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
|
||||
-2
@@ -44,8 +44,6 @@ crypto_box_curve25519xchacha20poly1305_seal(unsigned char *c, const unsigned cha
|
||||
nonce, pk, esk);
|
||||
memcpy(c, epk, crypto_box_curve25519xchacha20poly1305_PUBLICKEYBYTES);
|
||||
sodium_memzero(esk, sizeof esk);
|
||||
sodium_memzero(epk, sizeof epk);
|
||||
sodium_memzero(nonce, sizeof nonce);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
+4
-1
@@ -42,7 +42,10 @@ crypto_box_curve25519xsalsa20poly1305_beforenm(unsigned char *k,
|
||||
if (crypto_scalarmult_curve25519(s, sk, pk) != 0) {
|
||||
return -1;
|
||||
}
|
||||
return crypto_core_hsalsa20(k, zero, s, NULL);
|
||||
crypto_core_hsalsa20(k, zero, s, NULL);
|
||||
sodium_memzero(s, sizeof s);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
|
||||
Reference in New Issue
Block a user