mirror of
https://github.com/guanzhi/GmSSL.git
synced 2026-06-22 13:13:42 +08:00
fix: use constant-time comparisons for auth tags
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user