27#ifndef WOLF_CRYPT_SHA_H
28#define WOLF_CRYPT_SHA_H
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))
43#define WC_SHA_BLOCK_SIZE SHA_BLOCK_SIZE
44#define WC_SHA_DIGEST_SIZE SHA_DIGEST_SIZE
45#define WC_SHA_PAD_SIZE SHA_PAD_SIZE
48#include <cyassl/ctaocrypt/sha.h>
51#ifdef FREESCALE_LTC_SHA
60#if !defined(HAVE_FIPS) || \
61 (defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION >= 2))
63#ifdef WOLFSSL_MICROCHIP_PIC32MZ
64 #include <wolfssl/wolfcrypt/port/pic32/pic32mz-crypt.h>
67 #include <wolfssl/wolfcrypt/port/st/stm32.h>
69#ifdef WOLFSSL_ASYNC_CRYPT
70 #include <wolfssl/wolfcrypt/async.h>
72#ifdef WOLFSSL_ESP32WROOM32_CRYPT
73 #include <wolfssl/wolfcrypt/port/Espressif/esp32-crypt.h>
76#if !defined(NO_OLD_SHA_NAMES)
80#ifndef NO_OLD_WC_NAMES
82 #define SHA_BLOCK_SIZE WC_SHA_BLOCK_SIZE
83 #define SHA_DIGEST_SIZE WC_SHA_DIGEST_SIZE
84 #define SHA_PAD_SIZE WC_SHA_PAD_SIZE
89 WC_SHA = WC_HASH_TYPE_SHA,
90 WC_SHA_BLOCK_SIZE = 64,
91 WC_SHA_DIGEST_SIZE = 20,
96#if defined(WOLFSSL_TI_HASH)
97 #include "wolfssl/wolfcrypt/port/ti/ti-hash.h"
99#elif defined(WOLFSSL_IMX6_CAAM)
100 #include "wolfssl/wolfcrypt/port/caam/wolfcaam_sha.h"
101#elif defined(WOLFSSL_RENESAS_TSIP_CRYPT) && \
102 !defined(NO_WOLFSSL_RENESAS_TSIP_CRYPT_HASH)
103 #include "wolfssl/wolfcrypt/port/Renesas/renesas-tsip-crypt.h"
108#ifdef FREESCALE_LTC_SHA
110#elif defined(STM32_HASH)
116 word32 buffer[WC_SHA_BLOCK_SIZE /
sizeof(word32)];
117 #ifdef WOLFSSL_PIC32MZ_HASH
118 word32 digest[PIC32_DIGEST_SIZE /
sizeof(word32)];
120 word32 digest[WC_SHA_DIGEST_SIZE /
sizeof(word32)];
123 #ifdef WOLFSSL_PIC32MZ_HASH
126 #ifdef WOLFSSL_ASYNC_CRYPT
127 WC_ASYNC_DEV asyncDev;
129 #ifdef WOLF_CRYPTO_CB
134#if defined(WOLFSSL_ESP32WROOM32_CRYPT) && \
135 !defined(NO_WOLFSSL_ESP32WROOM32_CRYPT_HASH)
138#if defined(WOLFSSL_HASH_FLAGS) || defined(WOLF_CRYPTO_CB)
143#ifndef WC_SHA_TYPE_DEFINED
145 #define WC_SHA_TYPE_DEFINED
154WOLFSSL_API
int wc_InitSha_ex(
wc_Sha* sha,
void* heap,
int devId);
156WOLFSSL_API
int wc_ShaFinalRaw(
wc_Sha*,
byte*);
163#ifdef WOLFSSL_PIC32MZ_HASH
164WOLFSSL_API
void wc_ShaSizeSet(
wc_Sha* sha, word32 len);
167#if defined(WOLFSSL_HASH_FLAGS) || defined(WOLF_CRYPTO_CB)
168 WOLFSSL_API
int wc_ShaSetFlags(
wc_Sha* sha, word32 flags);
169 WOLFSSL_API
int wc_ShaGetFlags(
wc_Sha* sha, word32* flags);
WOLFSSL_API int wc_InitSha(wc_Sha *)
This function initializes SHA. This is automatically called by wc_ShaHash.
Definition sha.c:773
WOLFSSL_API int wc_ShaFinal(wc_Sha *, byte *)
Finalizes hashing of data. Result is placed into hash. Resets state of sha struct.
Definition sha.c:148
WOLFSSL_API int wc_ShaUpdate(wc_Sha *, const byte *, word32)
Can be called to continually hash the provided byte array of length len.
Definition sha.c:131
WOLFSSL_API int wc_ShaGetHash(wc_Sha *, byte *)
Gets hash data. Result is placed into hash. Does not reset state of sha struct.
Definition renesas_tsip_sha.c:233
WOLFSSL_API void wc_ShaFree(wc_Sha *)
Used to clean up memory used by an initialized Sha struct. Note: this is only supported if you have W...
Definition sha.c:778
Definition esp32-crypt.h:104
Definition pic32mz-crypt.h:115
Definition wolfcaam_sha.h:68