OPENSSL_NO_SHA512 to mask even SHA512_CTX declaration. This is done to
authorAndy Polyakov <appro@openssl.org>
Sun, 22 May 2005 08:55:15 +0000 (08:55 +0000)
committerAndy Polyakov <appro@openssl.org>
Sun, 22 May 2005 08:55:15 +0000 (08:55 +0000)
make no-sha512 more effective on platforms, which don't support 64-bit
integer type of *any* kind.

apps/speed.c
crypto/sha/sha.h
crypto/sha/sha512t.c

index 50a110d..4bec815 100644 (file)
@@ -496,9 +496,13 @@ int MAIN(int argc, char **argv)
 #endif
 #ifndef OPENSSL_NO_SHA
        unsigned char sha[SHA_DIGEST_LENGTH];
+#ifndef OPENSSL_NO_SHA256
        unsigned char sha256[SHA256_DIGEST_LENGTH];
+#endif
+#ifndef OPENSSL_NO_SHA512
        unsigned char sha512[SHA512_DIGEST_LENGTH];
 #endif
+#endif
 #ifndef OPENSSL_NO_RIPEMD
        unsigned char rmd160[RIPEMD160_DIGEST_LENGTH];
 #endif
@@ -878,11 +882,15 @@ int MAIN(int argc, char **argv)
                                                        doit[D_SHA256]=1,
                                                        doit[D_SHA512]=1;
                else
+#ifndef OPENSSL_NO_SHA256
                        if (strcmp(*argv,"sha256") == 0) doit[D_SHA256]=1;
                else
+#endif
+#ifndef OPENSSL_NO_SHA512
                        if (strcmp(*argv,"sha512") == 0) doit[D_SHA512]=1;
                else
 #endif
+#endif
 #ifndef OPENSSL_NO_RIPEMD
                        if (strcmp(*argv,"ripemd") == 0) doit[D_RMD160]=1;
                else
@@ -1064,8 +1072,12 @@ int MAIN(int argc, char **argv)
 #endif
 #ifndef OPENSSL_NO_SHA1
                        BIO_printf(bio_err,"sha1     ");
-                       BIO_printf(bio_err,"sha256  ");
-                       BIO_printf(bio_err,"sha512  ");
+#endif
+#ifndef OPENSSL_NO_SHA256
+                       BIO_printf(bio_err,"sha256   ");
+#endif
+#ifndef OPENSSL_NO_SHA512
+                       BIO_printf(bio_err,"sha512   ");
 #endif
 #ifndef OPENSSL_NO_RIPEMD160
                        BIO_printf(bio_err,"rmd160");
index a900ad3..867c661 100644 (file)
@@ -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
@@ -178,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);
index 7385469..4b7b3ce 100644 (file)
 #include <openssl/evp.h>
 #include <openssl/crypto.h>
 
+#if defined(OPENSSL_NO_SHA) || defined(OPENSSL_NO_SHA512)
+int main(int argc, char *argv[])
+{
+    printf("No SHA512 support\n");
+    return(0);
+}
+#else
+
 unsigned char app_c1[SHA512_DIGEST_LENGTH] = {
        0xdd,0xaf,0x35,0xa1,0x93,0x61,0x7a,0xba,
        0xcc,0x41,0x73,0x49,0xae,0x20,0x41,0x31,
@@ -173,3 +181,4 @@ int main ()
 
   return 0;
 }
+#endif