aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/modes/aead/gcm/gcm.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/modes/aead/gcm/gcm.h')
-rw-r--r--src/lib/modes/aead/gcm/gcm.h58
1 files changed, 1 insertions, 57 deletions
diff --git a/src/lib/modes/aead/gcm/gcm.h b/src/lib/modes/aead/gcm/gcm.h
index eac2add93..de7c1ea9a 100644
--- a/src/lib/modes/aead/gcm/gcm.h
+++ b/src/lib/modes/aead/gcm/gcm.h
@@ -47,7 +47,7 @@ class BOTAN_PUBLIC_API(2,0) GCM_Mode : public AEAD_Mode
~GCM_Mode();
- const size_t m_BS = 16;
+ static const size_t GCM_BS = 16;
const size_t m_tag_size;
const std::string m_cipher_name;
@@ -109,62 +109,6 @@ class BOTAN_PUBLIC_API(2,0) GCM_Decryption final : public GCM_Mode
void finish(secure_vector<uint8_t>& final_block, size_t offset = 0) override;
};
-/**
-* GCM's GHASH
-* This is not intended for general use, but is exposed to allow
-* shared code between GCM and GMAC
-*/
-class BOTAN_PUBLIC_API(2,0) GHASH final : public SymmetricAlgorithm
- {
- public:
- void set_associated_data(const uint8_t ad[], size_t ad_len);
-
- secure_vector<uint8_t> nonce_hash(const uint8_t nonce[], size_t len);
-
- void start(const uint8_t nonce[], size_t len);
-
- /*
- * Assumes input len is multiple of 16
- */
- void update(const uint8_t in[], size_t len);
-
- /*
- * Incremental update of associated data
- */
- void update_associated_data(const uint8_t ad[], size_t len);
-
- secure_vector<uint8_t> final();
-
- Key_Length_Specification key_spec() const override
- { return Key_Length_Specification(16); }
-
- void clear() override;
-
- void reset();
-
- std::string name() const override { return "GHASH"; }
-
- void ghash_update(secure_vector<uint8_t>& x,
- const uint8_t input[], size_t input_len);
-
- void add_final_block(secure_vector<uint8_t>& x,
- size_t ad_len, size_t pt_len);
- private:
- void key_schedule(const uint8_t key[], size_t key_len) override;
-
- void gcm_multiply(secure_vector<uint8_t>& x,
- const uint8_t input[],
- size_t blocks);
-
- secure_vector<uint8_t> m_H;
- secure_vector<uint8_t> m_H_ad;
- secure_vector<uint8_t> m_ghash;
- secure_vector<uint8_t> m_nonce;
- secure_vector<uint64_t> m_HM;
- size_t m_ad_len = 0;
- size_t m_text_len = 0;
- };
-
}
#endif