21 static constexpr size_t GCM_BS = 16;
25 void nonce_hash(std::span<uint8_t, GCM_BS> y0, std::span<const uint8_t> nonce);
27 void start(std::span<const uint8_t> nonce);
29 void update(std::span<const uint8_t> in);
40 void final(std::span<uint8_t> out);
46 void clear()
override;
50 std::string
name()
const override {
return "GHASH"; }
55 void ghash_update(std::span<uint8_t, GCM_BS> x, std::span<const uint8_t> input);
56 void ghash_zeropad(std::span<uint8_t, GCM_BS> x);
57 void ghash_final_block(std::span<uint8_t, GCM_BS> x, uint64_t ad_len, uint64_t pt_len);
59#if defined(BOTAN_HAS_GHASH_CLMUL_CPU)
62 static void ghash_multiply_cpu(uint8_t x[16],
64 const uint8_t input[],
68#if defined(BOTAN_HAS_GHASH_AVX512_CLMUL)
69 static void ghash_precompute_avx512_clmul(
const uint8_t H[16], uint64_t H_pow[16 * 2]);
71 static void ghash_multiply_avx512_clmul(uint8_t x[16],
72 const uint64_t H_pow[16 * 2],
73 const uint8_t input[],
77#if defined(BOTAN_HAS_GHASH_CLMUL_VPERM)
78 static void ghash_multiply_vperm(uint8_t x[16],
const uint64_t HM[256],
const uint8_t input[],
size_t blocks);
81 void key_schedule(std::span<const uint8_t> key)
override;
83 void ghash_multiply(std::span<uint8_t, GCM_BS> x, std::span<const uint8_t> input,
size_t blocks);
89 std::array<uint8_t, GCM_BS> m_H_ad{};
91 std::array<uint8_t, GCM_BS> m_ghash{};
95 std::optional<std::array<uint8_t, GCM_BS>> m_nonce;
97 size_t m_text_len = 0;
void nonce_hash(std::span< uint8_t, GCM_BS > y0, std::span< const uint8_t > nonce)
Hashing of non-default length nonce values for both GCM and GMAC use-cases.