VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Crypto/Sha2.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/Crypto/Sha2.c')
-rw-r--r--src/Crypto/Sha2.c17
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
@@ -314,8 +314,12 @@ extern "C"
#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
@@ -756,8 +760,15 @@ 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;
@@ -804,8 +815,14 @@ void sha256_begin(sha256_ctx* ctx)
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;