From: Dr. Stephen Henson Date: Thu, 31 Jan 2013 14:31:11 +0000 (+0000) Subject: Move CRYPTO_memcmp to o_init.c when compiling with fips: cryptlib.o X-Git-Tag: OpenSSL_0_9_8y~12 X-Git-Url: https://git.openssl.org/gitweb/?p=openssl.git;a=commitdiff_plain;h=24b28060975c01b749391778d13ec2ea1323a1aa Move CRYPTO_memcmp to o_init.c when compiling with fips: cryptlib.o is in the fips module for fips capable builds. --- diff --git a/crypto/cryptlib.c b/crypto/cryptlib.c index 0566ec1f97..dec3286f66 100644 --- a/crypto/cryptlib.c +++ b/crypto/cryptlib.c @@ -543,6 +543,8 @@ void OpenSSLDie(const char *file,int line,const char *assertion) void *OPENSSL_stderr(void) { return stderr; } +#ifndef OPENSSL_FIPS + int CRYPTO_memcmp(const void *in_a, const void *in_b, size_t len) { size_t i; @@ -555,3 +557,4 @@ int CRYPTO_memcmp(const void *in_a, const void *in_b, size_t len) return x; } +#endif diff --git a/crypto/o_init.c b/crypto/o_init.c index d767a90a5f..c89fda5890 100644 --- a/crypto/o_init.c +++ b/crypto/o_init.c @@ -93,4 +93,18 @@ void OPENSSL_init(void) #endif } +#ifdef OPENSSL_FIPS + +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; + } +#endif