summaryrefslogtreecommitdiffstats
path: root/ssl/s3_pkt.c
diff options
context:
space:
mode:
authorBen Laurie <ben@links.org>2013-01-28 17:30:38 +0000
committerBen Laurie <ben@links.org>2013-01-28 17:30:38 +0000
commit2ee798880a246d648ecddadc5b91367bee4a5d98 (patch)
tree519fae50d830922bb0f0cf55bd8da81f373e6395 /ssl/s3_pkt.c
parentffcf4c61641068918e36b738b9464a16d0488e43 (diff)
Add and use a constant-time memcmp.
This change adds CRYPTO_memcmp, which compares two vectors of bytes in an amount of time that's independent of their contents. It also changes several MAC compares in the code to use this over the standard memcmp, which may leak information about the size of a matching prefix.
Diffstat (limited to 'ssl/s3_pkt.c')
-rw-r--r--ssl/s3_pkt.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ssl/s3_pkt.c b/ssl/s3_pkt.c
index dca345865a..3e111406ba 100644
--- a/ssl/s3_pkt.c
+++ b/ssl/s3_pkt.c
@@ -463,7 +463,7 @@ printf("\n");
#endif
}
i=s->method->ssl3_enc->mac(s,md,0);
- if (i < 0 || mac == NULL || memcmp(md, mac, (size_t)mac_size) != 0)
+ if (i < 0 || mac == NULL || CRYPTO_memcmp(md, mac, (size_t)mac_size) != 0)
{
decryption_failed_or_bad_record_mac = 1;
}