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;
52 std::string
name()
const override {
return "GHASH"; }
57 void ghash_update(std::span<uint8_t, GCM_BS> x, std::span<const uint8_t> input);
58 void ghash_zeropad(std::span<uint8_t, GCM_BS> x);
59 void ghash_final_block(std::span<uint8_t, GCM_BS> x, uint64_t ad_len, uint64_t pt_len);
61#if defined(BOTAN_HAS_GHASH_CLMUL_CPU)
64 static void ghash_multiply_cpu(uint8_t x[16],
66 const uint8_t input[],
70#if defined(BOTAN_HAS_GHASH_AVX512_CLMUL)
71 static void ghash_precompute_avx512_clmul(
const uint8_t H[16], uint64_t H_pow[16 * 2]);
73 static void ghash_multiply_avx512_clmul(uint8_t x[16],
74 const uint64_t H_pow[16 * 2],
75 const uint8_t input[],
79#if defined(BOTAN_HAS_GHASH_CLMUL_VPERM)
80 static void ghash_multiply_vperm(uint8_t x[16],
const uint64_t HM[256],
const uint8_t input[],
size_t blocks);
83 void key_schedule(std::span<const uint8_t> key)
override;
85 void ghash_multiply(std::span<uint8_t, GCM_BS> x, std::span<const uint8_t> input,
size_t blocks);
89 static void ghash_multiply_base(std::span<uint8_t, GCM_BS> x,
91 std::span<const uint8_t> input,
101 std::array<uint8_t, GCM_BS> m_H_ad{};
103 std::array<uint8_t, GCM_BS> m_ghash{};
107 std::optional<std::array<uint8_t, GCM_BS>> m_nonce;
108 uint64_t m_ad_len = 0;
109 uint64_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.