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/modes/aead/siv/siv.cpp | |
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/modes/aead/siv/siv.cpp')
-rw-r--r-- | src/lib/modes/aead/siv/siv.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/lib/modes/aead/siv/siv.cpp b/src/lib/modes/aead/siv/siv.cpp index 373a2627c..c4db3d785 100644 --- a/src/lib/modes/aead/siv/siv.cpp +++ b/src/lib/modes/aead/siv/siv.cpp @@ -51,7 +51,7 @@ size_t SIV_Mode::update_granularity() const /* This value does not particularly matter as regardless SIV_Mode::update buffers all input, so in theory this could be 1. However as for instance - Transform_Filter creates update_granularity() byte buffers, use a + Transform_Filter creates update_granularity() uint8_t buffers, use a somewhat large size to avoid bouncing on a tiny buffer. */ return 128; @@ -62,7 +62,7 @@ Key_Length_Specification SIV_Mode::key_spec() const return m_cmac->key_spec().multiple(2); } -void SIV_Mode::key_schedule(const byte key[], size_t length) +void SIV_Mode::key_schedule(const uint8_t key[], size_t length) { const size_t keylen = length / 2; m_cmac->set_key(key, keylen); @@ -70,7 +70,7 @@ void SIV_Mode::key_schedule(const byte key[], size_t length) m_ad_macs.clear(); } -void SIV_Mode::set_associated_data_n(size_t n, const byte ad[], size_t length) +void SIV_Mode::set_associated_data_n(size_t n, const uint8_t ad[], size_t length) { if(n >= m_ad_macs.size()) m_ad_macs.resize(n+1); @@ -78,7 +78,7 @@ void SIV_Mode::set_associated_data_n(size_t n, const byte ad[], size_t length) m_ad_macs[n] = m_cmac->process(ad, length); } -void SIV_Mode::start_msg(const byte nonce[], size_t nonce_len) +void SIV_Mode::start_msg(const uint8_t nonce[], size_t nonce_len) { if(!valid_nonce_length(nonce_len)) throw Invalid_IV_Length(name(), nonce_len); @@ -98,11 +98,11 @@ size_t SIV_Mode::process(uint8_t buf[], size_t sz) return 0; } -secure_vector<byte> SIV_Mode::S2V(const byte* text, size_t text_len) +secure_vector<uint8_t> SIV_Mode::S2V(const uint8_t* text, size_t text_len) { - const byte zero[16] = { 0 }; + const uint8_t zero[16] = { 0 }; - secure_vector<byte> V = m_cmac->process(zero, 16); + secure_vector<uint8_t> V = m_cmac->process(zero, 16); for(size_t i = 0; i != m_ad_macs.size(); ++i) { @@ -131,7 +131,7 @@ secure_vector<byte> SIV_Mode::S2V(const byte* text, size_t text_len) return m_cmac->final(); } -void SIV_Mode::set_ctr_iv(secure_vector<byte> V) +void SIV_Mode::set_ctr_iv(secure_vector<uint8_t> V) { V[8] &= 0x7F; V[12] &= 0x7F; @@ -139,13 +139,13 @@ void SIV_Mode::set_ctr_iv(secure_vector<byte> V) ctr().set_iv(V.data(), V.size()); } -void SIV_Encryption::finish(secure_vector<byte>& buffer, size_t offset) +void SIV_Encryption::finish(secure_vector<uint8_t>& buffer, size_t offset) { BOTAN_ASSERT(buffer.size() >= offset, "Offset is sane"); buffer.insert(buffer.begin() + offset, msg_buf().begin(), msg_buf().end()); - secure_vector<byte> V = S2V(buffer.data() + offset, buffer.size() - offset); + secure_vector<uint8_t> V = S2V(buffer.data() + offset, buffer.size() - offset); buffer.insert(buffer.begin() + offset, V.begin(), V.end()); @@ -153,7 +153,7 @@ void SIV_Encryption::finish(secure_vector<byte>& buffer, size_t offset) ctr().cipher1(&buffer[offset + V.size()], buffer.size() - offset - V.size()); } -void SIV_Decryption::finish(secure_vector<byte>& buffer, size_t offset) +void SIV_Decryption::finish(secure_vector<uint8_t>& buffer, size_t offset) { BOTAN_ASSERT(buffer.size() >= offset, "Offset is sane"); @@ -163,7 +163,7 @@ void SIV_Decryption::finish(secure_vector<byte>& buffer, size_t offset) BOTAN_ASSERT(sz >= tag_size(), "We have the tag"); - secure_vector<byte> V(buffer.data() + offset, buffer.data() + offset + 16); + secure_vector<uint8_t> V(buffer.data() + offset, buffer.data() + offset + 16); set_ctr_iv(V); @@ -171,7 +171,7 @@ void SIV_Decryption::finish(secure_vector<byte>& buffer, size_t offset) buffer.data() + offset, buffer.size() - offset - V.size()); - secure_vector<byte> T = S2V(buffer.data() + offset, buffer.size() - offset - V.size()); + secure_vector<uint8_t> T = S2V(buffer.data() + offset, buffer.size() - offset - V.size()); if(T != V) throw Integrity_Failure("SIV tag check failed"); |