mirror of
https://github.com/jedisct1/libsodium.git
synced 2026-08-25 08:37:13 +09:00
secretbox: zero the state after checking only the tag
This commit is contained in:
@@ -99,6 +99,8 @@ crypto_secretbox_open_detached(unsigned char *m, const unsigned char *c,
|
||||
return -1;
|
||||
}
|
||||
if (m == NULL) {
|
||||
sodium_memzero(subkey, sizeof subkey);
|
||||
sodium_memzero(block0, sizeof block0);
|
||||
return 0;
|
||||
}
|
||||
ACQUIRE_FENCE;
|
||||
|
||||
@@ -106,6 +106,8 @@ crypto_secretbox_xchacha20poly1305_open_detached(unsigned char *m,
|
||||
return -1;
|
||||
}
|
||||
if (m == NULL) {
|
||||
sodium_memzero(subkey, sizeof subkey);
|
||||
sodium_memzero(block0, sizeof block0);
|
||||
return 0;
|
||||
}
|
||||
ACQUIRE_FENCE;
|
||||
|
||||
Reference in New Issue
Block a user