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/cmac | |
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/cmac')
-rw-r--r-- | src/lib/mac/cmac/cmac.cpp | 14 | ||||
-rw-r--r-- | src/lib/mac/cmac/cmac.h | 10 |
2 files changed, 12 insertions, 12 deletions
diff --git a/src/lib/mac/cmac/cmac.cpp b/src/lib/mac/cmac/cmac.cpp index 9afd86cdb..bb862196f 100644 --- a/src/lib/mac/cmac/cmac.cpp +++ b/src/lib/mac/cmac/cmac.cpp @@ -12,16 +12,16 @@ namespace Botan { /* * Perform CMAC's multiplication in GF(2^n) */ -secure_vector<byte> CMAC::poly_double(const secure_vector<byte>& in) +secure_vector<uint8_t> CMAC::poly_double(const secure_vector<uint8_t>& in) { const bool top_carry = static_cast<bool>((in[0] & 0x80) != 0); - secure_vector<byte> out = in; + secure_vector<uint8_t> out = in; - byte carry = 0; + uint8_t carry = 0; for(size_t i = out.size(); i != 0; --i) { - byte temp = out[i-1]; + uint8_t temp = out[i-1]; out[i-1] = (temp << 1) | carry; carry = (temp >> 7); } @@ -55,7 +55,7 @@ secure_vector<byte> CMAC::poly_double(const secure_vector<byte>& in) /* * Update an CMAC Calculation */ -void CMAC::add_data(const byte input[], size_t length) +void CMAC::add_data(const uint8_t input[], size_t length) { buffer_insert(m_buffer, m_position, input, length); if(m_position + length > output_length()) @@ -80,7 +80,7 @@ void CMAC::add_data(const byte input[], size_t length) /* * Finalize an CMAC Calculation */ -void CMAC::final_result(byte mac[]) +void CMAC::final_result(uint8_t mac[]) { xor_buf(m_state, m_buffer, m_position); @@ -107,7 +107,7 @@ void CMAC::final_result(byte mac[]) /* * CMAC Key Schedule */ -void CMAC::key_schedule(const byte key[], size_t length) +void CMAC::key_schedule(const uint8_t key[], size_t length) { clear(); m_cipher->set_key(key, length); diff --git a/src/lib/mac/cmac/cmac.h b/src/lib/mac/cmac/cmac.h index 6897665c0..7127f82f2 100644 --- a/src/lib/mac/cmac/cmac.h +++ b/src/lib/mac/cmac/cmac.h @@ -34,7 +34,7 @@ class BOTAN_DLL CMAC final : public MessageAuthenticationCode * CMAC's polynomial doubling operation * @param in the input */ - static secure_vector<byte> poly_double(const secure_vector<byte>& in); + static secure_vector<uint8_t> poly_double(const secure_vector<uint8_t>& in); /** * @param cipher the block cipher to use @@ -44,12 +44,12 @@ class BOTAN_DLL CMAC final : public MessageAuthenticationCode CMAC(const CMAC&) = delete; CMAC& operator=(const CMAC&) = delete; private: - void add_data(const byte[], size_t) override; - void final_result(byte[]) override; - void key_schedule(const byte[], size_t) override; + void add_data(const uint8_t[], size_t) override; + void final_result(uint8_t[]) override; + void key_schedule(const uint8_t[], size_t) override; std::unique_ptr<BlockCipher> m_cipher; - secure_vector<byte> m_buffer, m_state, m_B, m_P; + secure_vector<uint8_t> m_buffer, m_state, m_B, m_P; size_t m_position; }; |