aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/block/des
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/block/des')
-rw-r--r--src/lib/block/des/des.cpp34
-rw-r--r--src/lib/block/des/des.h4
-rw-r--r--src/lib/block/des/desx.cpp24
-rw-r--r--src/lib/block/des/desx.h4
4 files changed, 33 insertions, 33 deletions
diff --git a/src/lib/block/des/des.cpp b/src/lib/block/des/des.cpp
index 6d2bcfe1e..88671df8d 100644
--- a/src/lib/block/des/des.cpp
+++ b/src/lib/block/des/des.cpp
@@ -154,7 +154,7 @@ void DES::encrypt_n(const byte in[], byte out[], size_t blocks) const
u32bit L = static_cast<u32bit>(T >> 32);
u32bit R = static_cast<u32bit>(T);
- des_encrypt(L, R, round_key.data());
+ des_encrypt(L, R, m_round_key.data());
T = (DES_FPTAB1[get_byte(0, L)] << 5) | (DES_FPTAB1[get_byte(1, L)] << 3) |
(DES_FPTAB1[get_byte(2, L)] << 1) | (DES_FPTAB2[get_byte(3, L)] << 1) |
@@ -184,7 +184,7 @@ void DES::decrypt_n(const byte in[], byte out[], size_t blocks) const
u32bit L = static_cast<u32bit>(T >> 32);
u32bit R = static_cast<u32bit>(T);
- des_decrypt(L, R, round_key.data());
+ des_decrypt(L, R, m_round_key.data());
T = (DES_FPTAB1[get_byte(0, L)] << 5) | (DES_FPTAB1[get_byte(1, L)] << 3) |
(DES_FPTAB1[get_byte(2, L)] << 1) | (DES_FPTAB2[get_byte(3, L)] << 1) |
@@ -205,13 +205,13 @@ void DES::decrypt_n(const byte in[], byte out[], size_t blocks) const
*/
void DES::key_schedule(const byte key[], size_t)
{
- round_key.resize(32);
- des_key_schedule(round_key.data(), key);
+ m_round_key.resize(32);
+ des_key_schedule(m_round_key.data(), key);
}
void DES::clear()
{
- zap(round_key);
+ zap(m_round_key);
}
/*
@@ -229,9 +229,9 @@ void TripleDES::encrypt_n(const byte in[], byte out[], size_t blocks) const
u32bit L = static_cast<u32bit>(T >> 32);
u32bit R = static_cast<u32bit>(T);
- des_encrypt(L, R, &round_key[0]);
- des_decrypt(R, L, &round_key[32]);
- des_encrypt(L, R, &round_key[64]);
+ des_encrypt(L, R, &m_round_key[0]);
+ des_decrypt(R, L, &m_round_key[32]);
+ des_encrypt(L, R, &m_round_key[64]);
T = (DES_FPTAB1[get_byte(0, L)] << 5) | (DES_FPTAB1[get_byte(1, L)] << 3) |
(DES_FPTAB1[get_byte(2, L)] << 1) | (DES_FPTAB2[get_byte(3, L)] << 1) |
@@ -262,9 +262,9 @@ void TripleDES::decrypt_n(const byte in[], byte out[], size_t blocks) const
u32bit L = static_cast<u32bit>(T >> 32);
u32bit R = static_cast<u32bit>(T);
- des_decrypt(L, R, &round_key[64]);
- des_encrypt(R, L, &round_key[32]);
- des_decrypt(L, R, &round_key[0]);
+ des_decrypt(L, R, &m_round_key[64]);
+ des_encrypt(R, L, &m_round_key[32]);
+ des_decrypt(L, R, &m_round_key[0]);
T = (DES_FPTAB1[get_byte(0, L)] << 5) | (DES_FPTAB1[get_byte(1, L)] << 3) |
(DES_FPTAB1[get_byte(2, L)] << 1) | (DES_FPTAB2[get_byte(3, L)] << 1) |
@@ -285,19 +285,19 @@ void TripleDES::decrypt_n(const byte in[], byte out[], size_t blocks) const
*/
void TripleDES::key_schedule(const byte key[], size_t length)
{
- round_key.resize(3*32);
- des_key_schedule(&round_key[0], key);
- des_key_schedule(&round_key[32], key + 8);
+ m_round_key.resize(3*32);
+ des_key_schedule(&m_round_key[0], key);
+ des_key_schedule(&m_round_key[32], key + 8);
if(length == 24)
- des_key_schedule(&round_key[64], key + 16);
+ des_key_schedule(&m_round_key[64], key + 16);
else
- copy_mem(&round_key[64], &round_key[0], 32);
+ copy_mem(&m_round_key[64], &m_round_key[0], 32);
}
void TripleDES::clear()
{
- zap(round_key);
+ zap(m_round_key);
}
}
diff --git a/src/lib/block/des/des.h b/src/lib/block/des/des.h
index 1a2fdc5c9..8ea132ac1 100644
--- a/src/lib/block/des/des.h
+++ b/src/lib/block/des/des.h
@@ -27,7 +27,7 @@ class BOTAN_DLL DES : public Block_Cipher_Fixed_Params<8, 8>
private:
void key_schedule(const byte[], size_t) override;
- secure_vector<u32bit> round_key;
+ secure_vector<u32bit> m_round_key;
};
/**
@@ -45,7 +45,7 @@ class BOTAN_DLL TripleDES : public Block_Cipher_Fixed_Params<8, 16, 24, 8>
private:
void key_schedule(const byte[], size_t) override;
- secure_vector<u32bit> round_key;
+ secure_vector<u32bit> m_round_key;
};
/*
diff --git a/src/lib/block/des/desx.cpp b/src/lib/block/des/desx.cpp
index f6538748c..76a50f9a2 100644
--- a/src/lib/block/des/desx.cpp
+++ b/src/lib/block/des/desx.cpp
@@ -16,9 +16,9 @@ void DESX::encrypt_n(const byte in[], byte out[], size_t blocks) const
{
for(size_t i = 0; i != blocks; ++i)
{
- xor_buf(out, in, K1.data(), BLOCK_SIZE);
- des.encrypt(out);
- xor_buf(out, K2.data(), BLOCK_SIZE);
+ xor_buf(out, in, m_K1.data(), BLOCK_SIZE);
+ m_des.encrypt(out);
+ xor_buf(out, m_K2.data(), BLOCK_SIZE);
in += BLOCK_SIZE;
out += BLOCK_SIZE;
@@ -32,9 +32,9 @@ void DESX::decrypt_n(const byte in[], byte out[], size_t blocks) const
{
for(size_t i = 0; i != blocks; ++i)
{
- xor_buf(out, in, K2.data(), BLOCK_SIZE);
- des.decrypt(out);
- xor_buf(out, K1.data(), BLOCK_SIZE);
+ xor_buf(out, in, m_K2.data(), BLOCK_SIZE);
+ m_des.decrypt(out);
+ xor_buf(out, m_K1.data(), BLOCK_SIZE);
in += BLOCK_SIZE;
out += BLOCK_SIZE;
@@ -46,16 +46,16 @@ void DESX::decrypt_n(const byte in[], byte out[], size_t blocks) const
*/
void DESX::key_schedule(const byte key[], size_t)
{
- K1.assign(key, key + 8);
- des.set_key(key + 8, 8);
- K2.assign(key + 16, key + 24);
+ m_K1.assign(key, key + 8);
+ m_des.set_key(key + 8, 8);
+ m_K2.assign(key + 16, key + 24);
}
void DESX::clear()
{
- des.clear();
- zap(K1);
- zap(K2);
+ m_des.clear();
+ zap(m_K1);
+ zap(m_K2);
}
}
diff --git a/src/lib/block/des/desx.h b/src/lib/block/des/desx.h
index 0f155b241..06ca91c9f 100644
--- a/src/lib/block/des/desx.h
+++ b/src/lib/block/des/desx.h
@@ -26,8 +26,8 @@ class BOTAN_DLL DESX : public Block_Cipher_Fixed_Params<8, 24>
BlockCipher* clone() const override { return new DESX; }
private:
void key_schedule(const byte[], size_t) override;
- secure_vector<byte> K1, K2;
- DES des;
+ secure_vector<byte> m_K1, m_K2;
+ DES m_des;
};
}