Add and use a constant-time memcmp.
[openssl.git] / ssl / s3_pkt.c
index 5e3583c04d428cefeb28ba5d09261f5f0822a54d..0e041c0ce025c0712cc016277618caf7287d10bb 100644 (file)
@@ -414,7 +414,7 @@ printf("\n");
 #endif
                        }
                i=s->method->ssl3_enc->mac(s,md,0);
-               if (mac == NULL || memcmp(md, mac, mac_size) != 0)
+               if (i < 0 || mac == NULL || CRYPTO_memcmp(md, mac, (size_t)mac_size) != 0)
                        {
                        decryption_failed_or_bad_record_mac = 1;
                        }