From: Andy Polyakov Date: Sun, 22 May 2005 08:55:15 +0000 (+0000) Subject: OPENSSL_NO_SHA512 to mask even SHA512_CTX declaration. This is done to X-Git-Tag: OpenSSL_0_9_8-beta3~13^2~14 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=4b235065943259fb6f110e2b07624fa7c5ae5bd0;p=oweals%2Fopenssl.git OPENSSL_NO_SHA512 to mask even SHA512_CTX declaration. This is done to make no-sha512 more effective on platforms, which don't support 64-bit integer type of *any* kind. --- diff --git a/apps/speed.c b/apps/speed.c index 50a110df04..4bec815257 100644 --- a/apps/speed.c +++ b/apps/speed.c @@ -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"); diff --git a/crypto/sha/sha.h b/crypto/sha/sha.h index a900ad3e95..867c661522 100644 --- a/crypto/sha/sha.h +++ b/crypto/sha/sha.h @@ -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); diff --git a/crypto/sha/sha512t.c b/crypto/sha/sha512t.c index 7385469bee..4b7b3ceaa3 100644 --- a/crypto/sha/sha512t.c +++ b/crypto/sha/sha512t.c @@ -11,6 +11,14 @@ #include #include +#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