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

@@ -352,7 +352,7 @@ int sm2_do_decrypt(const SM2_KEY *key, const SM2_CIPHERTEXT *in, uint8_t *out, s
sm3_finish(&sm3_ctx, hash);
// check if u == C3
if (memcmp(in->hash, hash, sizeof(hash)) != 0) {
if (gmssl_secure_memcmp(in->hash, hash, sizeof(hash)) != 0) {
error_print();
goto end;
}