"Show" more respect to no-sha* config options.
[oweals/openssl.git] / crypto / sha / sha512.c
index b328fe71d4d7ea69e6a54110f020fe27a1233bb8..f965cff692cd418e9ca5e135cd239c9ad37abd26 100644 (file)
@@ -4,6 +4,8 @@
  * according to the OpenSSL license [found in ../../LICENSE].
  * ====================================================================
  */
+#include <openssl/opensslconf.h>
+#if !defined(OPENSSL_NO_SHA) && !defined(OPENSSL_NO_SHA512)
 /*
  * IMPLEMENTATION NOTES.
  *
 #include <stdlib.h>
 #include <string.h>
 
-#include <openssl/opensslconf.h>
 #include <openssl/crypto.h>
 #include <openssl/sha.h>
 #include <openssl/opensslv.h>
 
+#include "cryptlib.h"
+
 const char *SHA512_version="SHA-512" OPENSSL_VERSION_PTEXT;
 
 #if defined(_M_IX86) || defined(_M_AMD64) || defined(__i386) || defined(__x86_64)
@@ -344,11 +347,10 @@ static const SHA_LONG64 K512[80] = {
 #define Ch(x,y,z)      (((x) & (y)) ^ ((~(x)) & (z)))
 #define Maj(x,y,z)     (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z)))
 
-#if defined(OPENSSL_IA32_SSE2) && !defined(OPENSSL_NO_ASM)
+#if defined(OPENSSL_IA32_SSE2) && !defined(OPENSSL_NO_ASM) && !defined(I386_ONLY)
 #define        GO_FOR_SSE2(ctx,in,num)         do {            \
-       extern int      OPENSSL_ia32cap;                \
-       void            sha512_block_sse2(void *,const void *,size_t);  \
-       if (!(OPENSSL_ia32cap & (1<<26))) break;        \
+       void    sha512_block_sse2(void *,const void *,size_t);  \
+       if (!(OPENSSL_ia32cap_P & (1<<26))) break;      \
        sha512_block_sse2(ctx->h,in,num); return;       \
                                        } while (0)
 #endif
@@ -490,3 +492,5 @@ static void sha512_block (SHA512_CTX *ctx, const void *in, size_t num)
 #endif
 
 #endif /* SHA512_ASM */
+
+#endif /* OPENSSL_NO_SHA512 */