diff options
author | Jack Lloyd <[email protected]> | 2016-12-11 15:28:38 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2016-12-18 16:48:24 -0500 |
commit | f3cb3edb512bdcab498d825886c3366c341b3f78 (patch) | |
tree | 645c73ec295a5a34f25d99903b6d9fa9751e86d3 /src/lib/mac/gmac | |
parent | c1dd21253c1f3188ff45d3ad47698efd08235ae8 (diff) |
Convert to using standard uintN_t integer types
Renames a couple of functions for somewhat better name consistency,
eg make_u32bit becomes make_uint32. The old typedefs remain for now
since probably lots of application code uses them.
Diffstat (limited to 'src/lib/mac/gmac')
-rw-r--r-- | src/lib/mac/gmac/gmac.cpp | 14 | ||||
-rw-r--r-- | src/lib/mac/gmac/gmac.h | 16 |
2 files changed, 15 insertions, 15 deletions
diff --git a/src/lib/mac/gmac/gmac.cpp b/src/lib/mac/gmac/gmac.cpp index 4461cf370..5e08a8827 100644 --- a/src/lib/mac/gmac/gmac.cpp +++ b/src/lib/mac/gmac/gmac.cpp @@ -37,7 +37,7 @@ size_t GMAC::output_length() const return GCM_BS; } -void GMAC::add_data(const byte input[], size_t size) +void GMAC::add_data(const uint8_t input[], size_t size) { m_ad_len += size; @@ -57,16 +57,16 @@ void GMAC::add_data(const byte input[], size_t size) } } -void GMAC::key_schedule(const byte key[], size_t size) +void GMAC::key_schedule(const uint8_t key[], size_t size) { clear(); m_cipher->set_key(key, size); m_cipher->encrypt(m_H_ad.data(), m_H.data()); } -void GMAC::start_msg(const byte nonce[], size_t nonce_len) +void GMAC::start_msg(const uint8_t nonce[], size_t nonce_len) { - secure_vector<byte> y0(GCM_BS); + secure_vector<uint8_t> y0(GCM_BS); if(nonce_len == 12) { @@ -79,13 +79,13 @@ void GMAC::start_msg(const byte nonce[], size_t nonce_len) add_final_block(y0, 0, nonce_len); } - secure_vector<byte> m_enc_y0(GCM_BS); + secure_vector<uint8_t> m_enc_y0(GCM_BS); m_cipher->encrypt(y0.data(), m_enc_y0.data()); GHASH::start(m_enc_y0.data(), m_enc_y0.size()); m_initialized = true; } -void GMAC::final_result(byte mac[]) +void GMAC::final_result(uint8_t mac[]) { // This ensures the GMAC computation has been initialized with a fresh // nonce. The aim of this check is to prevent developers from re-using @@ -101,7 +101,7 @@ void GMAC::final_result(byte mac[]) m_aad_buf.data(), m_aad_buf.size()); } - secure_vector<byte> result = GHASH::final(); + secure_vector<uint8_t> result = GHASH::final(); std::copy(result.begin(), result.end(), mac); clear(); } diff --git a/src/lib/mac/gmac/gmac.h b/src/lib/mac/gmac/gmac.h index b05c5451f..7735d3d32 100644 --- a/src/lib/mac/gmac/gmac.h +++ b/src/lib/mac/gmac/gmac.h @@ -35,7 +35,7 @@ class BOTAN_DLL GMAC : public MessageAuthenticationCode, * @param nonce Initialization vector. * @param nonce_len size of initialization vector. */ - void start(const byte nonce[], size_t nonce_len); + void start(const uint8_t nonce[], size_t nonce_len); /** * Must be called to set the initialization vector prior to GMAC @@ -43,7 +43,7 @@ class BOTAN_DLL GMAC : public MessageAuthenticationCode, * * @param nonce Initialization vector. */ - void start(const secure_vector<byte>& nonce); + void start(const secure_vector<uint8_t>& nonce); /** * Must be called to set the initialization vector prior to GMAC @@ -51,7 +51,7 @@ class BOTAN_DLL GMAC : public MessageAuthenticationCode, * * @param nonce Initialization vector. */ - void start(const std::vector<byte>& nonce); + void start(const std::vector<uint8_t>& nonce); Key_Length_Specification key_spec() const override { @@ -69,13 +69,13 @@ class BOTAN_DLL GMAC : public MessageAuthenticationCode, GMAC& operator=(const GMAC&) = delete; private: - void add_data(const byte[], size_t) override; - void final_result(byte[]) override; - void start_msg(const byte nonce[], size_t nonce_len) override; - void key_schedule(const byte key[], size_t size) override; + void add_data(const uint8_t[], size_t) override; + void final_result(uint8_t[]) override; + void start_msg(const uint8_t nonce[], size_t nonce_len) override; + void key_schedule(const uint8_t key[], size_t size) override; static const size_t GCM_BS = 16; - secure_vector<byte> m_aad_buf; + secure_vector<uint8_t> m_aad_buf; std::unique_ptr<BlockCipher> m_cipher; bool m_initialized; }; |