7#include <botan/internal/hash_engine_sha2_32.h>
9#include <botan/assert.h>
10#include <botan/internal/algorithm_spec.h>
11#include <botan/internal/hash_engine_mdx.h>
12#include <botan/internal/sha2_32.h>
14#if defined(BOTAN_HAS_HASH_ENGINE_SHA2_32_AVX2) || defined(BOTAN_HAS_HASH_ENGINE_SHA2_32_AVX512)
15 #define BOTAN_HASH_ENGINE_SHA2_32_HAS_IMPL
16 #include <botan/internal/cpuid.h>
22 std::span<const uint8_t> common_prefix,
23 std::string_view provider) {
24#if defined(BOTAN_HASH_ENGINE_SHA2_32_HAS_IMPL)
25 size_t output_length = 0;
30 }
else if(
auto m = req.
match(
"Truncated(SHA-256,{bits:int})")) {
31 const size_t bits = m->integer(
"bits");
32 if(bits == 0 || bits % 8 != 0 || bits > 256) {
35 output_length = bits / 8;
47 const auto make_engine = [&](std::string_view feat,
51 return std::make_unique<MDx_MB_Engine<uint32_t>>(hash_fn,
63 #if defined(BOTAN_HAS_HASH_ENGINE_SHA2_32_AVX512)
65 if(provider.empty() || provider == *feat) {
71 #if defined(BOTAN_HAS_HASH_ENGINE_SHA2_32_AVX2)
73 if(provider.empty() || provider == *feat) {
bool matches(const AlgorithmPattern &pattern) const
std::optional< AlgorithmMatch > match(const AlgorithmPattern &pattern) const &
static std::optional< std::string > check(CPUID::Feature feat)
void(*)(const uint8_t *states, uint8_t *digests) extract_fn
void(*)(uint8_t *states, const uint8_t *const *blocks, size_t nblocks) compress_fn
secure_vector< uint32_t > digest_type
static constexpr size_t ctr_bytes
static void compress_digest(digest_type &digest, std::span< const uint8_t > input, size_t blocks)
static void init(digest_type &digest)
static constexpr size_t block_bytes
std::unique_ptr< Hash_Engine > create_sha2_32_mb_engine(std::string_view hash_fn, std::span< const uint8_t > common_prefix, std::string_view provider)
BOTAN_FN_ISA_AVX512 void sha2_32_mb_extract_x16(const uint8_t *states, uint8_t *digests)
BOTAN_FN_ISA_AVX512 void sha2_32_mb_compress_x16(uint8_t *states, const uint8_t *const *blocks, size_t nblocks)
BOTAN_FN_ISA_AVX2 void sha2_32_mb_extract_x8(const uint8_t *states, uint8_t *digests)
BOTAN_FN_ISA_AVX2 void sha2_32_mb_compress_x8(uint8_t *states, const uint8_t *const *blocks, size_t nblocks)