aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/stream/ctr
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2016-12-11 15:28:38 -0500
committerJack Lloyd <[email protected]>2016-12-18 16:48:24 -0500
commitf3cb3edb512bdcab498d825886c3366c341b3f78 (patch)
tree645c73ec295a5a34f25d99903b6d9fa9751e86d3 /src/lib/stream/ctr
parentc1dd21253c1f3188ff45d3ad47698efd08235ae8 (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/stream/ctr')
-rw-r--r--src/lib/stream/ctr/ctr.cpp10
-rw-r--r--src/lib/stream/ctr/ctr.h10
2 files changed, 10 insertions, 10 deletions
diff --git a/src/lib/stream/ctr/ctr.cpp b/src/lib/stream/ctr/ctr.cpp
index c4552d459..728da3567 100644
--- a/src/lib/stream/ctr/ctr.cpp
+++ b/src/lib/stream/ctr/ctr.cpp
@@ -38,7 +38,7 @@ void CTR_BE::clear()
m_pad_pos = 0;
}
-void CTR_BE::key_schedule(const byte key[], size_t key_len)
+void CTR_BE::key_schedule(const uint8_t key[], size_t key_len)
{
m_cipher->set_key(key, key_len);
@@ -51,7 +51,7 @@ std::string CTR_BE::name() const
return ("CTR-BE(" + m_cipher->name() + ")");
}
-void CTR_BE::cipher(const byte in[], byte out[], size_t length)
+void CTR_BE::cipher(const uint8_t in[], uint8_t out[], size_t length)
{
while(length >= m_pad.size() - m_pad_pos)
{
@@ -65,7 +65,7 @@ void CTR_BE::cipher(const byte in[], byte out[], size_t length)
m_pad_pos += length;
}
-void CTR_BE::set_iv(const byte iv[], size_t iv_len)
+void CTR_BE::set_iv(const uint8_t iv[], size_t iv_len)
{
if(!valid_iv_length(iv_len))
throw Invalid_IV_Length(name(), iv_len);
@@ -106,7 +106,7 @@ void CTR_BE::increment_counter()
{
const size_t off = i*bs + (bs-1-j);
const uint16_t cnt = static_cast<uint16_t>(m_counter[off]) + carry;
- m_counter[off] = static_cast<byte>(cnt);
+ m_counter[off] = static_cast<uint8_t>(cnt);
carry = (cnt >> 8);
}
}
@@ -115,7 +115,7 @@ void CTR_BE::increment_counter()
m_pad_pos = 0;
}
-void CTR_BE::seek(u64bit)
+void CTR_BE::seek(uint64_t)
{
throw Not_Implemented("CTR_BE::seek");
}
diff --git a/src/lib/stream/ctr/ctr.h b/src/lib/stream/ctr/ctr.h
index c4a28bd2b..345c4f6e8 100644
--- a/src/lib/stream/ctr/ctr.h
+++ b/src/lib/stream/ctr/ctr.h
@@ -19,9 +19,9 @@ namespace Botan {
class BOTAN_DLL CTR_BE final : public StreamCipher
{
public:
- void cipher(const byte in[], byte out[], size_t length) override;
+ void cipher(const uint8_t in[], uint8_t out[], size_t length) override;
- void set_iv(const byte iv[], size_t iv_len) override;
+ void set_iv(const uint8_t iv[], size_t iv_len) override;
bool valid_iv_length(size_t iv_len) const override
{ return (iv_len <= m_cipher->block_size()); }
@@ -45,13 +45,13 @@ class BOTAN_DLL CTR_BE final : public StreamCipher
CTR_BE(BlockCipher* cipher, size_t ctr_size);
- void seek(u64bit offset) override;
+ void seek(uint64_t offset) override;
private:
- void key_schedule(const byte key[], size_t key_len) override;
+ void key_schedule(const uint8_t key[], size_t key_len) override;
void increment_counter();
std::unique_ptr<BlockCipher> m_cipher;
- secure_vector<byte> m_counter, m_pad;
+ secure_vector<uint8_t> m_counter, m_pad;
size_t m_ctr_size;
size_t m_pad_pos;
};