CVE-2013-0169: Make CBC decoding constant time
(cherry-picked from 2c082d25fc3f0dd6e56c45407fe10638b904083c)
Bug: 8017911
Bug: 8095088
Change-Id: I57556e120fd1f585d38739d0d6aaf02bcbe45fbd
diff --git a/crypto/cryptlib.c b/crypto/cryptlib.c
index 50fd492..d47ab55 100644
--- a/crypto/cryptlib.c
+++ b/crypto/cryptlib.c
@@ -924,3 +924,16 @@
}
void *OPENSSL_stderr(void) { return stderr; }
+
+int CRYPTO_memcmp(const void *in_a, const void *in_b, size_t len)
+ {
+ size_t i;
+ const unsigned char *a = in_a;
+ const unsigned char *b = in_b;
+ unsigned char x = 0;
+
+ for (i = 0; i < len; i++)
+ x |= a[i] ^ b[i];
+
+ return x;
+ }