On stable, on failed decryption, fill buffer with 0x00

Not with 0xd0, to keep the previous behavior. NSec expicitly checked
for that value.
This commit is contained in:
Frank Denis
2022-12-11 21:07:42 +01:00
parent c69b3ec9be
commit dab102d404
@@ -747,7 +747,7 @@ crypto_aead_aes256gcm_encrypt_detached_afternm(unsigned char *c, unsigned char *
}
gh_required_blocks = required_blocks(ad_len, m_len);
if (gh_required_blocks == 0) {
memset(mac, 0xd0, ABYTES);
memset(mac, 0x00, ABYTES);
memset(c, 0, m_len);
return -1;
}
@@ -922,7 +922,7 @@ crypto_aead_aes256gcm_decrypt_detached_afternm(unsigned char *m, unsigned char *
if (crypto_verify_16(mac, computed_mac) != 0) {
sodium_memzero(computed_mac, sizeof computed_mac);
memset(m, 0xd0, m_len);
memset(m, 0x00, m_len);
return -1;
}
return 0;