improved error checking and some fixes
[oweals/openssl.git] / crypto / sha / sha512t.c
index 96a71efb8e79bc96a267229fe0a58d296e7093ce..4b7b3ceaa36bf2ffaca1670a8bbf2a5a169d760d 100644 (file)
@@ -9,6 +9,15 @@
 
 #include <openssl/sha.h>
 #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,
@@ -70,11 +79,12 @@ int main ()
   EVP_MD_CTX   evp;
 
 #ifdef OPENSSL_IA32_SSE2
-    { extern int OPENSSL_ia32cap;
-      char      *env;
+    /* Alternative to this is to call OpenSSL_add_all_algorithms...
+     * The below code is retained exclusively for debugging purposes. */
+    { char      *env;
 
        if ((env=getenv("OPENSSL_ia32cap")))
-           OPENSSL_ia32cap = strtol (env,NULL,0);
+           OPENSSL_ia32cap = strtoul (env,NULL,0);
     }
 #endif
 
@@ -171,3 +181,4 @@ int main ()
 
   return 0;
 }
+#endif