aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/stream/rc4
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/rc4
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/rc4')
-rw-r--r--src/lib/stream/rc4/rc4.cpp12
-rw-r--r--src/lib/stream/rc4/rc4.h16
2 files changed, 14 insertions, 14 deletions
diff --git a/src/lib/stream/rc4/rc4.cpp b/src/lib/stream/rc4/rc4.cpp
index 47dc1ce29..208b2f560 100644
--- a/src/lib/stream/rc4/rc4.cpp
+++ b/src/lib/stream/rc4/rc4.cpp
@@ -13,7 +13,7 @@ namespace Botan {
/*
* Combine cipher stream with message
*/
-void RC4::cipher(const byte in[], byte out[], size_t length)
+void RC4::cipher(const uint8_t in[], uint8_t out[], size_t length)
{
while(length >= m_buffer.size() - m_position)
{
@@ -27,7 +27,7 @@ void RC4::cipher(const byte in[], byte out[], size_t length)
m_position += length;
}
-void RC4::set_iv(const byte*, size_t length)
+void RC4::set_iv(const uint8_t*, size_t length)
{
if(length > 0)
throw Exception("RC4 does not support an IV");
@@ -38,7 +38,7 @@ void RC4::set_iv(const byte*, size_t length)
*/
void RC4::generate()
{
- byte SX, SY;
+ uint8_t SX, SY;
for(size_t i = 0; i != m_buffer.size(); i += 4)
{
SX = m_state[m_X+1]; m_Y = (m_Y + SX) % 256; SY = m_state[m_Y];
@@ -64,7 +64,7 @@ void RC4::generate()
/*
* RC4 Key Schedule
*/
-void RC4::key_schedule(const byte key[], size_t length)
+void RC4::key_schedule(const uint8_t key[], size_t length)
{
m_state.resize(256);
m_buffer.resize(256);
@@ -72,7 +72,7 @@ void RC4::key_schedule(const byte key[], size_t length)
m_position = m_X = m_Y = 0;
for(size_t i = 0; i != 256; ++i)
- m_state[i] = static_cast<byte>(i);
+ m_state[i] = static_cast<uint8_t>(i);
for(size_t i = 0, state_index = 0; i != 256; ++i)
{
@@ -111,7 +111,7 @@ void RC4::clear()
*/
RC4::RC4(size_t s) : m_SKIP(s) {}
-void RC4::seek(u64bit)
+void RC4::seek(uint64_t)
{
throw Exception("RC4 does not support seeking");
}
diff --git a/src/lib/stream/rc4/rc4.h b/src/lib/stream/rc4/rc4.h
index 46715f7d2..938ab59cc 100644
--- a/src/lib/stream/rc4/rc4.h
+++ b/src/lib/stream/rc4/rc4.h
@@ -19,9 +19,9 @@ namespace Botan {
class BOTAN_DLL RC4 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;
void clear() override;
std::string name() const override;
@@ -40,16 +40,16 @@ class BOTAN_DLL RC4 final : public StreamCipher
~RC4() { clear(); }
- void seek(u64bit offset) override;
+ void seek(uint64_t offset) override;
private:
- void key_schedule(const byte[], size_t) override;
+ void key_schedule(const uint8_t[], size_t) override;
void generate();
const size_t m_SKIP;
- byte m_X = 0;
- byte m_Y = 0;
- secure_vector<byte> m_state;
- secure_vector<byte> m_buffer;
+ uint8_t m_X = 0;
+ uint8_t m_Y = 0;
+ secure_vector<uint8_t> m_state;
+ secure_vector<uint8_t> m_buffer;
size_t m_position = 0;
};