OPENSSL_NO_SHA512 to mask even SHA512_CTX declaration. This is done to
[openssl.git] / crypto / sha / sha.h
index 47536d9c4b5fd7b432024e42483c41aa14260738..867c6615220ada688732279825d16417a3fba2bd 100644 (file)
@@ -89,19 +89,19 @@ extern "C" {
 #define SHA_LONG unsigned int
 #endif
 
-#define SHA_LBLOCK     16U
+#define SHA_LBLOCK     16
 #define SHA_CBLOCK     (SHA_LBLOCK*4)  /* SHA treats input data as a
                                         * contiguous array of 32 bit
                                         * wide big-endian values. */
 #define SHA_LAST_BLOCK  (SHA_CBLOCK-8)
-#define SHA_DIGEST_LENGTH 20U
+#define SHA_DIGEST_LENGTH 20
 
 typedef struct SHAstate_st
        {
        SHA_LONG h0,h1,h2,h3,h4;
        SHA_LONG Nl,Nh;
        SHA_LONG data[SHA_LBLOCK];
-       int num;
+       unsigned int num;
        } SHA_CTX;
 
 #ifndef OPENSSL_NO_SHA0
@@ -148,6 +148,7 @@ void SHA256_Transform(SHA256_CTX *c, const unsigned char *data);
 #define SHA384_DIGEST_LENGTH   48
 #define SHA512_DIGEST_LENGTH   64
 
+#ifndef OPENSSL_NO_SHA512
 /*
  * Unlike 32-bit digest algorithms, SHA-512 *relies* on SHA_LONG64
  * being exactly 64-bit wide. See Implementation Notes in sha512.c
@@ -159,6 +160,9 @@ void SHA256_Transform(SHA256_CTX *c, const unsigned char *data);
 #if (defined(_WIN32) || defined(_WIN64)) && !defined(__MINGW32__)
 #define SHA_LONG64 unsigned __int64
 #define U64(C)     C##UI64
+#elif defined(__arch64__)
+#define SHA_LONG64 unsigned long
+#define U64(C)     C##UL
 #else
 #define SHA_LONG64 unsigned long long
 #define U64(C)     C##ULL
@@ -175,7 +179,6 @@ typedef struct SHA512state_st
        unsigned int num,md_len;
        } SHA512_CTX;
 
-#ifndef OPENSSL_NO_SHA512
 int SHA384_Init(SHA512_CTX *c);
 int SHA384_Update(SHA512_CTX *c, const void *data, size_t len);
 int SHA384_Final(unsigned char *md, SHA512_CTX *c);