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/block/xtea | |
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/block/xtea')
-rw-r--r-- | src/lib/block/xtea/xtea.cpp | 24 | ||||
-rw-r--r-- | src/lib/block/xtea/xtea.h | 10 |
2 files changed, 17 insertions, 17 deletions
diff --git a/src/lib/block/xtea/xtea.cpp b/src/lib/block/xtea/xtea.cpp index 4e5ca7e7c..b53de448b 100644 --- a/src/lib/block/xtea/xtea.cpp +++ b/src/lib/block/xtea/xtea.cpp @@ -13,16 +13,16 @@ namespace Botan { /* * XTEA Encryption */ -void XTEA::encrypt_n(const byte in[], byte out[], size_t blocks) const +void XTEA::encrypt_n(const uint8_t in[], uint8_t out[], size_t blocks) const { - const u32bit* EK = &m_EK[0]; + const uint32_t* EK = &m_EK[0]; const size_t blocks4 = blocks / 4; const size_t blocks_left = blocks % 4; BOTAN_PARALLEL_FOR(size_t i = 0; i < blocks4; i++) { - u32bit L0, R0, L1, R1, L2, R2, L3, R3; + uint32_t L0, R0, L1, R1, L2, R2, L3, R3; load_be(in + 4*BLOCK_SIZE*i, L0, R0, L1, R1, L2, R2, L3, R3); for(size_t r = 0; r != 32; ++r) @@ -43,7 +43,7 @@ void XTEA::encrypt_n(const byte in[], byte out[], size_t blocks) const BOTAN_PARALLEL_FOR(size_t i = 0; i < blocks_left; ++i) { - u32bit L, R; + uint32_t L, R; load_be(in + BLOCK_SIZE*(4*blocks4+i), L, R); for(size_t r = 0; r != 32; ++r) @@ -59,16 +59,16 @@ void XTEA::encrypt_n(const byte in[], byte out[], size_t blocks) const /* * XTEA Decryption */ -void XTEA::decrypt_n(const byte in[], byte out[], size_t blocks) const +void XTEA::decrypt_n(const uint8_t in[], uint8_t out[], size_t blocks) const { - const u32bit* EK = &m_EK[0]; + const uint32_t* EK = &m_EK[0]; const size_t blocks4 = blocks / 4; const size_t blocks_left = blocks % 4; BOTAN_PARALLEL_FOR(size_t i = 0; i < blocks4; i++) { - u32bit L0, R0, L1, R1, L2, R2, L3, R3; + uint32_t L0, R0, L1, R1, L2, R2, L3, R3; load_be(in + 4*BLOCK_SIZE*i, L0, R0, L1, R1, L2, R2, L3, R3); for(size_t r = 0; r != 32; ++r) @@ -89,7 +89,7 @@ void XTEA::decrypt_n(const byte in[], byte out[], size_t blocks) const BOTAN_PARALLEL_FOR(size_t i = 0; i < blocks_left; ++i) { - u32bit L, R; + uint32_t L, R; load_be(in + BLOCK_SIZE*(4*blocks4+i), L, R); for(size_t r = 0; r != 32; ++r) @@ -105,15 +105,15 @@ void XTEA::decrypt_n(const byte in[], byte out[], size_t blocks) const /* * XTEA Key Schedule */ -void XTEA::key_schedule(const byte key[], size_t) +void XTEA::key_schedule(const uint8_t key[], size_t) { m_EK.resize(64); - secure_vector<u32bit> UK(4); + secure_vector<uint32_t> UK(4); for(size_t i = 0; i != 4; ++i) - UK[i] = load_be<u32bit>(key, i); + UK[i] = load_be<uint32_t>(key, i); - u32bit D = 0; + uint32_t D = 0; for(size_t i = 0; i != 64; i += 2) { m_EK[i ] = D + UK[D % 4]; diff --git a/src/lib/block/xtea/xtea.h b/src/lib/block/xtea/xtea.h index 3baccc866..cf9bedc4a 100644 --- a/src/lib/block/xtea/xtea.h +++ b/src/lib/block/xtea/xtea.h @@ -18,8 +18,8 @@ namespace Botan { class BOTAN_DLL XTEA : public Block_Cipher_Fixed_Params<8, 16> { public: - void encrypt_n(const byte in[], byte out[], size_t blocks) const override; - void decrypt_n(const byte in[], byte out[], size_t blocks) const override; + void encrypt_n(const uint8_t in[], uint8_t out[], size_t blocks) const override; + void decrypt_n(const uint8_t in[], uint8_t out[], size_t blocks) const override; void clear() override; std::string name() const override { return "XTEA"; } @@ -28,11 +28,11 @@ class BOTAN_DLL XTEA : public Block_Cipher_Fixed_Params<8, 16> /** * @return const reference to the key schedule */ - const secure_vector<u32bit>& get_EK() const { return m_EK; } + const secure_vector<uint32_t>& get_EK() const { return m_EK; } private: - void key_schedule(const byte[], size_t) override; - secure_vector<u32bit> m_EK; + void key_schedule(const uint8_t[], size_t) override; + secure_vector<uint32_t> m_EK; }; } |