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.
(cherry picked from commit 2ee798880a
)
Conflicts:
crypto/crypto.h
ssl/t1_lib.c
This commit is contained in:

committed by
Dr. Stephen Henson

parent
ebc71865f0
commit
9c00a95060
@@ -240,7 +240,7 @@ int ssl3_get_finished(SSL *s, int a, int b)
|
||||
goto f_err;
|
||||
}
|
||||
|
||||
if (memcmp(p, s->s3->tmp.peer_finish_md, i) != 0)
|
||||
if (CRYPTO_memcmp(p, s->s3->tmp.peer_finish_md, i) != 0)
|
||||
{
|
||||
al=SSL_AD_DECRYPT_ERROR;
|
||||
SSLerr(SSL_F_SSL3_GET_FINISHED,SSL_R_DIGEST_CHECK_FAILED);
|
||||
|
Reference in New Issue
Block a user