diff options
author | Jack Lloyd <[email protected]> | 2017-08-14 07:40:49 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2017-08-14 07:40:49 -0400 |
commit | b8a691fb0d44eb67886179810768ac9453963cea (patch) | |
tree | ae597cbd061951be669e8feae5001ca94c42b13e /src/lib/block/shacal2/shacal2.cpp | |
parent | 7e2c92527209d47098c0b7b9712fafcd2455590e (diff) |
Add support for SHACAL2 using x86 SHA extensions
Diffstat (limited to 'src/lib/block/shacal2/shacal2.cpp')
-rw-r--r-- | src/lib/block/shacal2/shacal2.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/lib/block/shacal2/shacal2.cpp b/src/lib/block/shacal2/shacal2.cpp index faf0a2d81..30ad711db 100644 --- a/src/lib/block/shacal2/shacal2.cpp +++ b/src/lib/block/shacal2/shacal2.cpp @@ -44,6 +44,13 @@ inline void SHACAL2_Rev(uint32_t A, uint32_t B, uint32_t C, uint32_t& D, */ void SHACAL2::encrypt_n(const uint8_t in[], uint8_t out[], size_t blocks) const { +#if defined(BOTAN_HAS_SHACAL2_X86) + if(CPUID::has_intel_sha()) + { + return x86_encrypt_blocks(in, out, blocks); + } +#endif + #if defined(BOTAN_HAS_SHACAL2_SIMD) if(CPUID::has_simd_32()) { @@ -181,6 +188,13 @@ void SHACAL2::key_schedule(const uint8_t key[], size_t len) size_t SHACAL2::parallelism() const { +#if defined(BOTAN_HAS_SHACAL2_X86) + if(CPUID::has_intel_sha()) + { + return 4; + } +#endif + #if defined(BOTAN_HAS_SHACAL2_SIMD) if(CPUID::has_simd_32()) { @@ -193,6 +207,13 @@ size_t SHACAL2::parallelism() const std::string SHACAL2::provider() const { +#if defined(BOTAN_HAS_SHACAL2_X86) + if(CPUID::has_intel_sha()) + { + return "intel_sha"; + } +#endif + #if defined(BOTAN_HAS_SHACAL2_SIMD) if(CPUID::has_simd_32()) { |