From 587484a1ef3fadd7f9dcf697fd0fdb81abd517ee Mon Sep 17 00:00:00 2001 From: Jacob Barthelmeh Date: Wed, 30 May 2018 16:10:34 -0600 Subject: [PATCH] add NO_OLD_SHA_NAMES macro and add back SHA512, SHA384 --- configure.ac | 2 +- wolfssl/openssl/sha.h | 10 +++++----- wolfssl/wolfcrypt/settings.h | 4 ++-- wolfssl/wolfcrypt/sha.h | 7 ++++--- wolfssl/wolfcrypt/sha256.h | 2 +- wolfssl/wolfcrypt/sha512.h | 8 ++++++++ 6 files changed, 21 insertions(+), 12 deletions(-) diff --git a/configure.ac b/configure.ac index a5e44a91e..8cae247aa 100644 --- a/configure.ac +++ b/configure.ac @@ -3930,7 +3930,7 @@ AC_ARG_ENABLE([oldnames], if test "x$ENABLED_OLDNAMES" = "xno" && test "x$ENABLED_OPENSSLCOEXIST" = "xno" then AM_CFLAGS="$AM_CFLAGS -DNO_OLD_RNGNAME -DNO_OLD_WC_NAMES -DNO_OLD_SSL_NAMES" - AM_CFLAGS="$AM_CFLAGS -DNO_OLD_SHA256_NAMES" + AM_CFLAGS="$AM_CFLAGS -DNO_OLD_SHA_NAMES" fi diff --git a/wolfssl/openssl/sha.h b/wolfssl/openssl/sha.h index 9c098972c..2a930d96d 100644 --- a/wolfssl/openssl/sha.h +++ b/wolfssl/openssl/sha.h @@ -119,7 +119,7 @@ typedef WOLFSSL_SHA256_CTX SHA256_CTX; #define SHA256_Init wolfSSL_SHA256_Init #define SHA256_Update wolfSSL_SHA256_Update #define SHA256_Final wolfSSL_SHA256_Final -#if defined(NO_OLD_SHA256_NAMES) && !defined(HAVE_FIPS) +#if defined(NO_OLD_SHA_NAMES) && !defined(HAVE_FIPS) /* SHA256 is only available in non-fips mode because of SHA256 enum in FIPS * build. */ #define SHA256 wolfSSL_SHA256 @@ -148,8 +148,8 @@ typedef WOLFSSL_SHA384_CTX SHA384_CTX; #define SHA384_Init wolfSSL_SHA384_Init #define SHA384_Update wolfSSL_SHA384_Update #define SHA384_Final wolfSSL_SHA384_Final -#if defined(NO_OLD_SHA256_NAMES) && !defined(HAVE_FIPS) - /* SHA384 is only available in non-fips mode because of SHA256 enum in FIPS +#if defined(NO_OLD_SHA_NAMES) && !defined(HAVE_FIPS) + /* SHA384 is only available in non-fips mode because of SHA384 enum in FIPS * build. */ #define SHA384 wolfSSL_SHA384 #endif @@ -177,8 +177,8 @@ typedef WOLFSSL_SHA512_CTX SHA512_CTX; #define SHA512_Init wolfSSL_SHA512_Init #define SHA512_Update wolfSSL_SHA512_Update #define SHA512_Final wolfSSL_SHA512_Final -#if defined(NO_OLD_SHA256_NAMES) && !defined(HAVE_FIPS) - /* SHA256 is only available in non-fips mode because of SHA256 enum in FIPS +#if defined(NO_OLD_SHA_NAMES) && !defined(HAVE_FIPS) + /* SHA512 is only available in non-fips mode because of SHA512 enum in FIPS * build. */ #define SHA512 wolfSSL_SHA512 #endif diff --git a/wolfssl/wolfcrypt/settings.h b/wolfssl/wolfcrypt/settings.h index 93cb0a2e2..a966db6f0 100644 --- a/wolfssl/wolfcrypt/settings.h +++ b/wolfssl/wolfcrypt/settings.h @@ -1639,8 +1639,8 @@ extern void uITRON4_free(void *p) ; #if defined(NO_OLD_WC_NAMES) || defined(OPENSSL_EXTRA) /* added to have compatibility with SHA256() */ - #if !defined(NO_OLD_SHA256_NAMES) && !defined(HAVE_FIPS) - #define NO_OLD_SHA256_NAMES + #if !defined(NO_OLD_SHA_NAMES) && !defined(HAVE_FIPS) + #define NO_OLD_SHA_NAMES #endif #endif diff --git a/wolfssl/wolfcrypt/sha.h b/wolfssl/wolfcrypt/sha.h index 6d08cf5eb..a6a9284ee 100644 --- a/wolfssl/wolfcrypt/sha.h +++ b/wolfssl/wolfcrypt/sha.h @@ -62,11 +62,12 @@ #include #endif +#if !defined(NO_OLD_SHA_NAMES) + #define SHA WC_SHA +#endif + #ifndef NO_OLD_WC_NAMES #define Sha wc_Sha - #if !defined(OPENSSL_EXTRA) - #define SHA WC_SHA - #endif #define SHA_BLOCK_SIZE WC_SHA_BLOCK_SIZE #define SHA_DIGEST_SIZE WC_SHA_DIGEST_SIZE #define SHA_PAD_SIZE WC_SHA_PAD_SIZE diff --git a/wolfssl/wolfcrypt/sha256.h b/wolfssl/wolfcrypt/sha256.h index 3409b5151..4ea49d0af 100644 --- a/wolfssl/wolfcrypt/sha256.h +++ b/wolfssl/wolfcrypt/sha256.h @@ -81,7 +81,7 @@ #define SHA256_NOINLINE #endif -#if !defined(NO_OLD_SHA256_NAMES) +#if !defined(NO_OLD_SHA_NAMES) #define SHA256 WC_SHA256 #endif diff --git a/wolfssl/wolfcrypt/sha512.h b/wolfssl/wolfcrypt/sha512.h index 315f56df0..c899ac77e 100644 --- a/wolfssl/wolfcrypt/sha512.h +++ b/wolfssl/wolfcrypt/sha512.h @@ -71,6 +71,10 @@ #define SHA512_NOINLINE #endif +#if !defined(NO_OLD_SHA_NAMES) + #define SHA512 WC_SHA512 +#endif + #if !defined(NO_OLD_WC_NAMES) #define Sha512 wc_Sha512 #define SHA512_BLOCK_SIZE WC_SHA512_BLOCK_SIZE @@ -123,6 +127,10 @@ WOLFSSL_API int wc_Sha512Copy(wc_Sha512* src, wc_Sha512* dst); #ifndef HAVE_FIPS /* avoid redefinition of structs */ #if !defined(NO_OLD_SHA_NAMES) + #define SHA384 WC_SHA384 +#endif + +#if !defined(NO_OLD_WC_NAMES) #define Sha384 wc_Sha384 #define SHA384_BLOCK_SIZE WC_SHA384_BLOCK_SIZE #define SHA384_DIGEST_SIZE WC_SHA384_DIGEST_SIZE