21 static constexpr size_t GCM_BS = 16;
27 void start(std::span<const uint8_t> nonce);
29 void update(std::span<const uint8_t> in);
37 void final(std::span<uint8_t> out);
43 void clear()
override;
47 std::string
name()
const override {
return "GHASH"; }
52 void ghash_update(std::span<uint8_t, GCM_BS> x, std::span<const uint8_t> input);
53 void ghash_zeropad(std::span<uint8_t, GCM_BS> x);
54 void ghash_final_block(std::span<uint8_t, GCM_BS> x, uint64_t ad_len, uint64_t pt_len);
56#if defined(BOTAN_HAS_GHASH_CLMUL_CPU)
57 static void ghash_precompute_cpu(
const uint8_t H[16], uint64_t H_pow[4 * 2]);
59 static void ghash_multiply_cpu(uint8_t x[16],
const uint64_t H_pow[4 * 2],
const uint8_t input[],
size_t blocks);
62#if defined(BOTAN_HAS_GHASH_CLMUL_VPERM)
63 static void ghash_multiply_vperm(uint8_t x[16],
const uint64_t HM[256],
const uint8_t input[],
size_t blocks);
66 void key_schedule(std::span<const uint8_t> key)
override;
68 void ghash_multiply(std::span<uint8_t, GCM_BS> x, std::span<const uint8_t> input,
size_t blocks);
73 std::array<uint8_t, GCM_BS> m_H_ad;
74 std::array<uint8_t, GCM_BS> m_ghash;
78 std::optional<std::array<uint8_t, GCM_BS>> m_nonce;
80 size_t m_text_len = 0;