diff options
Diffstat (limited to 'src/Crypto/Sha2.c')
-rw-r--r-- | src/Crypto/Sha2.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/Crypto/Sha2.c b/src/Crypto/Sha2.c index 5ae9cae2..27e61c3d 100644 --- a/src/Crypto/Sha2.c +++ b/src/Crypto/Sha2.c @@ -310,16 +310,20 @@ extern "C" void sha256_intel(void *input_data, uint_32t digest[8], uint_64t num_blks); #endif #endif #if CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X32 void VC_CDECL sha256_compress_nayuki(uint_32t state[8], const uint_8t block[64]); #endif +#if CRYPTOPP_ARM_SHA2_AVAILABLE + void sha256_compress_digest_armv8(const void* input_data, uint_32t digest[8], uint_64t num_blks); +#endif + #if defined(__cplusplus) } #endif #endif CRYPTOPP_ALIGN_DATA(16) static const uint_32t SHA256_K[64] CRYPTOPP_SECTION_ALIGN16 = { 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, @@ -752,16 +756,23 @@ void SSE4Sha256Transform(sha256_ctx* ctx, void* mp, uint_64t num_blks) #if (defined(CRYPTOPP_X86_ASM_AVAILABLE) || defined(CRYPTOPP_X32_ASM_AVAILABLE)) void SSE2Sha256Transform(sha256_ctx* ctx, void* mp, uint_64t num_blks) { X86_SHA256_HashBlocks(ctx->hash, (const uint_32t*)mp, (size_t)(num_blks * 64)); } #endif +#if CRYPTOPP_ARM_SHA2_AVAILABLE +void ArmSha256Transform(sha256_ctx* ctx, void* mp, uint_64t num_blks) +{ + sha256_compress_digest_armv8(mp, ctx->hash, num_blks); +} +#endif + #if CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X32 void Sha256AsmTransform(sha256_ctx* ctx, void* mp, uint_64t num_blks) { uint_64t i; for (i = 0; i < num_blks; i++) sha256_compress_nayuki(ctx->hash, (uint_8t*)mp + i * 64); } #endif @@ -800,16 +811,22 @@ void sha256_begin(sha256_ctx* ctx) #endif #if (defined(CRYPTOPP_X86_ASM_AVAILABLE) || defined(CRYPTOPP_X32_ASM_AVAILABLE)) if (HasSSE2 ()) sha256transfunc = SSE2Sha256Transform; else #endif +#if CRYPTOPP_ARM_SHA2_AVAILABLE + if (HasSHA256()) + sha256transfunc = ArmSha256Transform; + else +#endif + #if CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X32 sha256transfunc = Sha256AsmTransform; #else sha256transfunc = StdSha256Transform; #endif #else sha256transfunc = StdSha256Transform; #endif |