From 24b28060975c01b749391778d13ec2ea1323a1aa Mon Sep 17 00:00:00 2001
From: "Dr. Stephen Henson" <steve@openssl.org>
Date: Thu, 31 Jan 2013 14:31:11 +0000
Subject: [PATCH] Move CRYPTO_memcmp to o_init.c when compiling with fips:
 cryptlib.o is in the fips module for fips capable builds.

---
 crypto/cryptlib.c |  3 +++
 crypto/o_init.c   | 14 ++++++++++++++
 2 files changed, 17 insertions(+)

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
-- 
2.25.1