27 #ifndef WOLF_CRYPT_SHA512_H 28 #define WOLF_CRYPT_SHA512_H 32 #if defined(WOLFSSL_SHA512) || defined(WOLFSSL_SHA384) 34 #if defined(HAVE_FIPS) && \ 35 defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION >= 2) 36 #include <wolfssl/wolfcrypt/fips.h> 39 #if defined(HAVE_FIPS) && \ 40 (!defined(HAVE_FIPS_VERSION) || (HAVE_FIPS_VERSION < 2)) 42 #define wc_Sha512 Sha512 43 #define WC_SHA512 SHA512 44 #define WC_SHA512_BLOCK_SIZE SHA512_BLOCK_SIZE 45 #define WC_SHA512_DIGEST_SIZE SHA512_DIGEST_SIZE 46 #define WC_SHA512_PAD_SIZE SHA512_PAD_SIZE 49 #define wc_Sha384 Sha384 50 #define WC_SHA384 SHA384 51 #define WC_SHA384_BLOCK_SIZE SHA384_BLOCK_SIZE 52 #define WC_SHA384_DIGEST_SIZE SHA384_DIGEST_SIZE 53 #define WC_SHA384_PAD_SIZE SHA384_PAD_SIZE 57 #if defined(WOLFSSL_SHA384) 61 #include <cyassl/ctaocrypt/sha512.h> 69 #if !defined(HAVE_FIPS) || \ 70 (defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION >= 2)) 72 #ifdef WOLFSSL_ASYNC_CRYPT 73 #include <wolfssl/wolfcrypt/async.h> 75 #ifdef WOLFSSL_ESP32WROOM32_CRYPT 76 #include <wolfssl/wolfcrypt/port/Espressif/esp32-crypt.h> 79 #define SHA512_NOINLINE __declspec(noinline) 80 #elif defined(__IAR_SYSTEMS_ICC__) || defined(__GNUC__) 81 #define SHA512_NOINLINE __attribute__((noinline)) 83 #define SHA512_NOINLINE 88 #if !defined(NO_OLD_SHA_NAMES) 89 #define SHA512 WC_SHA512 92 #if !defined(NO_OLD_WC_NAMES) 93 #define Sha512 wc_Sha512 94 #define SHA512_BLOCK_SIZE WC_SHA512_BLOCK_SIZE 95 #define SHA512_DIGEST_SIZE WC_SHA512_DIGEST_SIZE 96 #define SHA512_PAD_SIZE WC_SHA512_PAD_SIZE 103 #ifdef WOLFSSL_SHA512 104 WC_SHA512 = WC_HASH_TYPE_SHA512,
106 WC_SHA512_BLOCK_SIZE = 128,
107 WC_SHA512_DIGEST_SIZE = 64,
108 WC_SHA512_PAD_SIZE = 112
112 #ifdef WOLFSSL_IMX6_CAAM 113 #include "wolfssl/wolfcrypt/port/caam/wolfcaam_sha.h" 117 word64 digest[WC_SHA512_DIGEST_SIZE /
sizeof(word64)];
118 word64 buffer[WC_SHA512_BLOCK_SIZE /
sizeof(word64)];
123 #ifdef USE_INTEL_SPEEDUP 126 #ifdef WOLFSSL_ASYNC_CRYPT 127 WC_ASYNC_DEV asyncDev;
129 #ifdef WOLFSSL_SMALL_STACK_CACHE 132 #if defined(WOLFSSL_ESP32WROOM32_CRYPT) && \ 133 !defined(NO_WOLFSSL_ESP32WROOM32_CRYPT_HASH) 136 #if defined(WOLFSSL_HASH_FLAGS) || defined(WOLF_CRYPTO_CB) 141 #ifndef WC_SHA512_TYPE_DEFINED 143 #define WC_SHA512_TYPE_DEFINED 149 #ifdef WOLFSSL_ARMASM 150 WOLFSSL_LOCAL
void Transform_Sha512_Len(
wc_Sha512* sha512,
const byte* data,
154 #ifdef WOLFSSL_SHA512 157 WOLFSSL_API
int wc_InitSha512_ex(
wc_Sha512*,
void*,
int);
159 WOLFSSL_API
int wc_Sha512FinalRaw(
wc_Sha512*, byte*);
161 WOLFSSL_API
void wc_Sha512Free(
wc_Sha512*);
163 WOLFSSL_API
int wc_Sha512GetHash(
wc_Sha512*, byte*);
166 #if defined(WOLFSSL_HASH_FLAGS) || defined(WOLF_CRYPTO_CB) 167 WOLFSSL_API
int wc_Sha512SetFlags(
wc_Sha512* sha512, word32 flags);
168 WOLFSSL_API
int wc_Sha512GetFlags(
wc_Sha512* sha512, word32* flags);
173 #if defined(WOLFSSL_SHA384) 176 #if !defined(HAVE_FIPS) || \ 177 (defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION >= 2)) 179 #if !defined(NO_OLD_SHA_NAMES) 180 #define SHA384 WC_SHA384 183 #if !defined(NO_OLD_WC_NAMES) 184 #define Sha384 wc_Sha384 185 #define SHA384_BLOCK_SIZE WC_SHA384_BLOCK_SIZE 186 #define SHA384_DIGEST_SIZE WC_SHA384_DIGEST_SIZE 187 #define SHA384_PAD_SIZE WC_SHA384_PAD_SIZE 192 WC_SHA384 = WC_HASH_TYPE_SHA384,
193 WC_SHA384_BLOCK_SIZE = WC_SHA512_BLOCK_SIZE,
194 WC_SHA384_DIGEST_SIZE = 48,
195 WC_SHA384_PAD_SIZE = WC_SHA512_PAD_SIZE
199 #ifndef WC_SHA384_TYPE_DEFINED 201 #define WC_SHA384_TYPE_DEFINED 206 WOLFSSL_API
int wc_InitSha384_ex(
wc_Sha384*,
void*,
int);
208 WOLFSSL_API
int wc_Sha384FinalRaw(
wc_Sha384*, byte*);
210 WOLFSSL_API
void wc_Sha384Free(
wc_Sha384*);
212 WOLFSSL_API
int wc_Sha384GetHash(
wc_Sha384*, byte*);
215 #if defined(WOLFSSL_HASH_FLAGS) || defined(WOLF_CRYPTO_CB) 216 WOLFSSL_API
int wc_Sha384SetFlags(
wc_Sha384* sha384, word32 flags);
217 WOLFSSL_API
int wc_Sha384GetFlags(
wc_Sha384* sha384, word32* flags);
WOLFSSL_API int wc_Sha512Final(wc_Sha512 *, byte *)
Finalizes hashing of data. Result is placed into hash.
Definition: sha512.c:847
WOLFSSL_API int wc_Sha384Update(wc_Sha384 *, const byte *, word32)
Can be called to continually hash the provided byte array of length len.
Definition: sha512.c:948
WOLFSSL_API int wc_InitSha512(wc_Sha512 *)
This function initializes SHA512. This is automatically called by wc_Sha512Hash.
Definition: sha512.c:873
Definition: esp32-crypt.h:104
WOLFSSL_API int wc_Sha512Update(wc_Sha512 *, const byte *, word32)
Can be called to continually hash the provided byte array of length len.
Definition: sha512.c:705
WOLFSSL_API int wc_InitSha384(wc_Sha384 *)
This function initializes SHA384. This is automatically called by wc_Sha384Hash.
Definition: sha512.c:1045
WOLFSSL_API int wc_Sha384Final(wc_Sha384 *, byte *)
Finalizes hashing of data. Result is placed into hash.
Definition: sha512.c:987