diff options
author | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2025-01-26 16:21:13 +0100 |
---|---|---|
committer | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2025-01-26 16:21:13 +0100 |
commit | 247c98d9548fead121e5314727782a4694bc0de3 (patch) | |
tree | aa6dd3e77188705a9405ec406bb9bd4267c52476 /src/Crypto/Sha2.c | |
parent | 5ff256a53d30031d9500e38c699084efc6c3bd56 (diff) | |
download | VeraCrypt-247c98d9548fead121e5314727782a4694bc0de3.tar.gz VeraCrypt-247c98d9548fead121e5314727782a4694bc0de3.zip |
Implement SHA256 acceleration on ARM64 platforms using CPU instructions
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 @@ -315,6 +315,10 @@ extern "C" 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 @@ -757,6 +761,13 @@ void SSE2Sha256Transform(sha256_ctx* ctx, void* mp, uint_64t num_blks) } #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) { @@ -805,6 +816,12 @@ void sha256_begin(sha256_ctx* ctx) else #endif +#if CRYPTOPP_ARM_SHA2_AVAILABLE + if (HasSHA256()) + sha256transfunc = ArmSha256Transform; + else +#endif + #if CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X32 sha256transfunc = Sha256AsmTransform; #else |