fix: use constant-time comparisons for auth tags

This commit is contained in:
wangtsiao
2026-06-12 19:13:30 -10:00
parent 23375d1fa3
commit 3163d7d927
6 changed files with 7 additions and 7 deletions

View File

@@ -215,7 +215,7 @@ int aes_gcm_decrypt(const AES_KEY *key, const uint8_t *iv, size_t ivlen,
ghash(H, aad, aadlen, in, inlen, H);
aes_encrypt(key, Y, T);
gmssl_memxor(T, T, H, taglen);
if (memcmp(T, tag, taglen) != 0) {
if (gmssl_secure_memcmp(T, tag, taglen) != 0) {
error_print();
return -1;
}