diff options
Diffstat (limited to 'C/Sha256.c')
-rw-r--r-- | C/Sha256.c | 52 |
1 files changed, 25 insertions, 27 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* Sha256.c -- SHA-256 Hash | 1 | /* Sha256.c -- SHA-256 Hash |
2 | 2023-04-02 : Igor Pavlov : Public domain | 2 | 2024-03-01 : Igor Pavlov : Public domain |
3 | This code is based on public domain code from Wei Dai's Crypto++ library. */ | 3 | This code is based on public domain code from Wei Dai's Crypto++ library. */ |
4 | 4 | ||
5 | #include "Precomp.h" | 5 | #include "Precomp.h" |
@@ -15,35 +15,35 @@ This code is based on public domain code from Wei Dai's Crypto++ library. */ | |||
15 | #endif | 15 | #endif |
16 | 16 | ||
17 | #ifdef MY_CPU_X86_OR_AMD64 | 17 | #ifdef MY_CPU_X86_OR_AMD64 |
18 | #ifdef _MSC_VER | 18 | #if defined(Z7_LLVM_CLANG_VERSION) && (Z7_LLVM_CLANG_VERSION >= 30800) \ |
19 | #if _MSC_VER >= 1200 | 19 | || defined(Z7_APPLE_CLANG_VERSION) && (Z7_APPLE_CLANG_VERSION >= 50100) \ |
20 | || defined(Z7_GCC_VERSION) && (Z7_GCC_VERSION >= 40900) \ | ||
21 | || defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 1600) \ | ||
22 | || defined(_MSC_VER) && (_MSC_VER >= 1200) | ||
20 | #define Z7_COMPILER_SHA256_SUPPORTED | 23 | #define Z7_COMPILER_SHA256_SUPPORTED |
21 | #endif | ||
22 | #elif defined(__clang__) | ||
23 | #if (__clang_major__ >= 8) // fix that check | ||
24 | #define Z7_COMPILER_SHA256_SUPPORTED | ||
25 | #endif | ||
26 | #elif defined(__GNUC__) | ||
27 | #if (__GNUC__ >= 8) // fix that check | ||
28 | #define Z7_COMPILER_SHA256_SUPPORTED | ||
29 | #endif | ||
30 | #elif defined(__INTEL_COMPILER) | ||
31 | #if (__INTEL_COMPILER >= 1800) // fix that check | ||
32 | #define Z7_COMPILER_SHA256_SUPPORTED | ||
33 | #endif | ||
34 | #endif | 24 | #endif |
35 | #elif defined(MY_CPU_ARM_OR_ARM64) | 25 | #elif defined(MY_CPU_ARM_OR_ARM64) && defined(MY_CPU_LE) |
36 | #ifdef _MSC_VER | 26 | |
37 | #if _MSC_VER >= 1910 | 27 | #if defined(__ARM_FEATURE_SHA2) \ |
28 | || defined(__ARM_FEATURE_CRYPTO) | ||
29 | #define Z7_COMPILER_SHA256_SUPPORTED | ||
30 | #else | ||
31 | #if defined(MY_CPU_ARM64) \ | ||
32 | || defined(__ARM_ARCH) && (__ARM_ARCH >= 4) \ | ||
33 | || defined(Z7_MSC_VER_ORIGINAL) | ||
34 | #if defined(__ARM_FP) && \ | ||
35 | ( defined(Z7_CLANG_VERSION) && (Z7_CLANG_VERSION >= 30800) \ | ||
36 | || defined(__GNUC__) && (__GNUC__ >= 6) \ | ||
37 | ) \ | ||
38 | || defined(Z7_MSC_VER_ORIGINAL) && (_MSC_VER >= 1910) | ||
39 | #if defined(MY_CPU_ARM64) \ | ||
40 | || !defined(Z7_CLANG_VERSION) \ | ||
41 | || defined(__ARM_NEON) && \ | ||
42 | (Z7_CLANG_VERSION < 170000 || \ | ||
43 | Z7_CLANG_VERSION > 170001) | ||
38 | #define Z7_COMPILER_SHA256_SUPPORTED | 44 | #define Z7_COMPILER_SHA256_SUPPORTED |
39 | #endif | 45 | #endif |
40 | #elif defined(__clang__) | ||
41 | #if (__clang_major__ >= 8) // fix that check | ||
42 | #define Z7_COMPILER_SHA256_SUPPORTED | ||
43 | #endif | 46 | #endif |
44 | #elif defined(__GNUC__) | ||
45 | #if (__GNUC__ >= 6) // fix that check | ||
46 | #define Z7_COMPILER_SHA256_SUPPORTED | ||
47 | #endif | 47 | #endif |
48 | #endif | 48 | #endif |
49 | #endif | 49 | #endif |
@@ -224,8 +224,6 @@ void Sha256_Init(CSha256 *p) | |||
224 | 224 | ||
225 | #endif | 225 | #endif |
226 | 226 | ||
227 | void Z7_FASTCALL Sha256_UpdateBlocks_HW(UInt32 state[8], const Byte *data, size_t numBlocks); | ||
228 | |||
229 | // static | 227 | // static |
230 | extern MY_ALIGN(64) | 228 | extern MY_ALIGN(64) |
231 | const UInt32 SHA256_K_ARRAY[64]; | 229 | const UInt32 SHA256_K_ARRAY[64]; |