secretbox: zero the state after checking only the tag

This commit is contained in:
Frank Denis
2026-02-10 09:00:59 +01:00
parent 414c40318a
commit 8a8d8a62fa
2 changed files with 4 additions and 0 deletions
@@ -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;