- Timestamp:
- Feb 7, 2019, 8:36:33 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
asp3_tinet_ecnl_arm/trunk/wolfssl-3.12.2/wolfssl/wolfcrypt/sha256.h
r352 r372 20 20 */ 21 21 22 /*! 23 \file wolfssl/wolfcrypt/sha256.h 24 */ 25 22 26 23 27 /* code submitted by raphael.huck@efixo.com */ … … 30 34 #ifndef NO_SHA256 31 35 32 #ifdef HAVE_FIPS 36 #if defined(HAVE_FIPS) && \ 37 defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION >= 2) 38 #include <wolfssl/wolfcrypt/fips.h> 39 #endif /* HAVE_FIPS_VERSION >= 2 */ 40 41 #if defined(HAVE_FIPS) && \ 42 (!defined(HAVE_FIPS_VERSION) || (HAVE_FIPS_VERSION < 2)) 33 43 #define wc_Sha256 Sha256 34 44 #define WC_SHA256 SHA256 … … 58 68 #endif 59 69 60 #ifndef HAVE_FIPS /* avoid redefinition of structs */ 70 /* avoid redefinition of structs */ 71 #if !defined(HAVE_FIPS) || \ 72 (defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION >= 2)) 61 73 62 74 #ifdef WOLFSSL_MICROCHIP_PIC32MZ 63 75 #include <wolfssl/wolfcrypt/port/pic32/pic32mz-crypt.h> 64 76 #endif 77 #ifdef STM32_HASH 78 #include <wolfssl/wolfcrypt/port/st/stm32.h> 79 #endif 65 80 #ifdef WOLFSSL_ASYNC_CRYPT 66 81 #include <wolfssl/wolfcrypt/async.h> 67 82 #endif 83 #if defined(WOLFSSL_DEVCRYPTO) && defined(WOLFSSL_DEVCRYPTO_HASH) 84 #include <wolfssl/wolfcrypt/port/devcrypto/wc_devcrypto.h> 85 #endif 86 87 #if defined(_MSC_VER) 88 #define SHA256_NOINLINE __declspec(noinline) 89 #elif defined(__GNUC__) 90 #define SHA256_NOINLINE __attribute__((noinline)) 91 #else 92 #define SHA256_NOINLINE 93 #endif 94 95 #if !defined(NO_OLD_SHA_NAMES) 96 #define SHA256 WC_SHA256 97 #endif 68 98 69 99 #ifndef NO_OLD_WC_NAMES 70 100 #define Sha256 wc_Sha256 71 #define SHA256 WC_SHA25672 101 #define SHA256_BLOCK_SIZE WC_SHA256_BLOCK_SIZE 73 102 #define SHA256_DIGEST_SIZE WC_SHA256_DIGEST_SIZE … … 77 106 /* in bytes */ 78 107 enum { 79 WC_SHA256 = 2, /* hash type unique */108 WC_SHA256 = WC_HASH_TYPE_SHA256, 80 109 WC_SHA256_BLOCK_SIZE = 64, 81 110 WC_SHA256_DIGEST_SIZE = 32, … … 83 112 }; 84 113 85 #ifndef WOLFSSL_TI_HASH 86 114 115 #ifdef WOLFSSL_TI_HASH 116 #include "wolfssl/wolfcrypt/port/ti/ti-hash.h" 117 #elif defined(WOLFSSL_IMX6_CAAM) 118 #include "wolfssl/wolfcrypt/port/caam/wolfcaam_sha.h" 119 #elif defined(WOLFSSL_AFALG_HASH) 120 #include "wolfssl/wolfcrypt/port/af_alg/afalg_hash.h" 121 #else 87 122 /* wc_Sha256 digest */ 88 123 typedef struct wc_Sha256 { 89 124 #ifdef FREESCALE_LTC_SHA 90 125 ltc_hash_ctx_t ctx; 126 #elif defined(STM32_HASH) 127 STM32_HASH_Context stmCtx; 91 128 #else 92 129 /* alignment on digest and buffer speeds up ARMv8 crypto operations */ … … 97 134 word32 hiLen; /* length in bytes */ 98 135 void* heap; 136 #ifdef USE_INTEL_SPEEDUP 137 const byte* data; 138 #endif 99 139 #ifdef WOLFSSL_PIC32MZ_HASH 100 140 hashUpdCache cache; /* cache for updates */ 101 #endif102 #if defined(STM32_HASH) && defined(WOLFSSL_STM32_CUBEMX)103 HASH_HandleTypeDef hashHandle;104 141 #endif 105 142 #ifdef WOLFSSL_ASYNC_CRYPT 106 143 WC_ASYNC_DEV asyncDev; 107 144 #endif /* WOLFSSL_ASYNC_CRYPT */ 108 #endif /* FREESCALE_LTC_SHA */ 145 #ifdef WOLFSSL_SMALL_STACK_CACHE 146 word32* W; 147 #endif 148 #ifdef WOLFSSL_DEVCRYPTO_HASH 149 WC_CRYPTODEV ctx; 150 byte* msg; 151 word32 used; 152 word32 len; 153 #endif 154 #endif 109 155 } wc_Sha256; 110 156 111 #else112 #include "wolfssl/wolfcrypt/port/ti/ti-hash.h"113 157 #endif 114 158 … … 118 162 WOLFSSL_API int wc_InitSha256_ex(wc_Sha256*, void*, int); 119 163 WOLFSSL_API int wc_Sha256Update(wc_Sha256*, const byte*, word32); 164 WOLFSSL_API int wc_Sha256FinalRaw(wc_Sha256*, byte*); 120 165 WOLFSSL_API int wc_Sha256Final(wc_Sha256*, byte*); 121 166 WOLFSSL_API void wc_Sha256Free(wc_Sha256*); … … 129 174 130 175 #ifdef WOLFSSL_SHA224 131 #ifndef HAVE_FIPS /* avoid redefinition of structs */ 176 /* avoid redefinition of structs */ 177 #if !defined(HAVE_FIPS) || \ 178 (defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION >= 2)) 132 179 133 180 #ifndef NO_OLD_WC_NAMES … … 141 188 /* in bytes */ 142 189 enum { 143 WC_SHA224 = 8, /* hash type unique */190 WC_SHA224 = WC_HASH_TYPE_SHA224, 144 191 WC_SHA224_BLOCK_SIZE = WC_SHA256_BLOCK_SIZE, 145 192 WC_SHA224_DIGEST_SIZE = 28, 146 193 WC_SHA224_PAD_SIZE = WC_SHA256_PAD_SIZE 147 194 }; 195 148 196 149 197 typedef wc_Sha256 wc_Sha224;
Note:
See TracChangeset
for help on using the changeset viewer.