diff options
author | Daniel Neus <[email protected]> | 2016-01-09 12:37:13 +0100 |
---|---|---|
committer | Daniel Neus <[email protected]> | 2016-01-09 12:37:13 +0100 |
commit | f391635f202cf6f83539bd69688975a30f5f874f (patch) | |
tree | 206459e94ab379ba18a8e8035b1855327aa02126 /src/lib/block/rc2 | |
parent | 52afcc69d97621e5a3880798d7814a474e71c03b (diff) | |
parent | 791b3dc9947a94d35e6d54b274b0512fb0ebd09c (diff) |
Merge remote-tracking branch 'remotes/github/master' into noreturn
# Conflicts:
# src/build-data/cc/gcc.txt
Diffstat (limited to 'src/lib/block/rc2')
-rw-r--r-- | src/lib/block/rc2/rc2.cpp | 38 | ||||
-rw-r--r-- | src/lib/block/rc2/rc2.h | 2 |
2 files changed, 20 insertions, 20 deletions
diff --git a/src/lib/block/rc2/rc2.cpp b/src/lib/block/rc2/rc2.cpp index bcd8475e3..112c6561d 100644 --- a/src/lib/block/rc2/rc2.cpp +++ b/src/lib/block/rc2/rc2.cpp @@ -24,24 +24,24 @@ void RC2::encrypt_n(const byte in[], byte out[], size_t blocks) const for(size_t j = 0; j != 16; ++j) { - R0 += (R1 & ~R3) + (R2 & R3) + K[4*j]; + R0 += (R1 & ~R3) + (R2 & R3) + m_K[4*j]; R0 = rotate_left(R0, 1); - R1 += (R2 & ~R0) + (R3 & R0) + K[4*j + 1]; + R1 += (R2 & ~R0) + (R3 & R0) + m_K[4*j + 1]; R1 = rotate_left(R1, 2); - R2 += (R3 & ~R1) + (R0 & R1) + K[4*j + 2]; + R2 += (R3 & ~R1) + (R0 & R1) + m_K[4*j + 2]; R2 = rotate_left(R2, 3); - R3 += (R0 & ~R2) + (R1 & R2) + K[4*j + 3]; + R3 += (R0 & ~R2) + (R1 & R2) + m_K[4*j + 3]; R3 = rotate_left(R3, 5); if(j == 4 || j == 10) { - R0 += K[R3 % 64]; - R1 += K[R0 % 64]; - R2 += K[R1 % 64]; - R3 += K[R2 % 64]; + R0 += m_K[R3 % 64]; + R1 += m_K[R0 % 64]; + R2 += m_K[R1 % 64]; + R3 += m_K[R2 % 64]; } } @@ -67,23 +67,23 @@ void RC2::decrypt_n(const byte in[], byte out[], size_t blocks) const for(size_t j = 0; j != 16; ++j) { R3 = rotate_right(R3, 5); - R3 -= (R0 & ~R2) + (R1 & R2) + K[63 - (4*j + 0)]; + R3 -= (R0 & ~R2) + (R1 & R2) + m_K[63 - (4*j + 0)]; R2 = rotate_right(R2, 3); - R2 -= (R3 & ~R1) + (R0 & R1) + K[63 - (4*j + 1)]; + R2 -= (R3 & ~R1) + (R0 & R1) + m_K[63 - (4*j + 1)]; R1 = rotate_right(R1, 2); - R1 -= (R2 & ~R0) + (R3 & R0) + K[63 - (4*j + 2)]; + R1 -= (R2 & ~R0) + (R3 & R0) + m_K[63 - (4*j + 2)]; R0 = rotate_right(R0, 1); - R0 -= (R1 & ~R3) + (R2 & R3) + K[63 - (4*j + 3)]; + R0 -= (R1 & ~R3) + (R2 & R3) + m_K[63 - (4*j + 3)]; if(j == 4 || j == 10) { - R3 -= K[R2 % 64]; - R2 -= K[R1 % 64]; - R1 -= K[R0 % 64]; - R0 -= K[R3 % 64]; + R3 -= m_K[R2 % 64]; + R2 -= m_K[R1 % 64]; + R1 -= m_K[R0 % 64]; + R0 -= m_K[R3 % 64]; } } @@ -134,13 +134,13 @@ void RC2::key_schedule(const byte key[], size_t length) for(s32bit i = 127-length; i >= 0; --i) L[i] = TABLE[L[i+1] ^ L[i+length]]; - K.resize(64); - load_le<u16bit>(K.data(), L.data(), 64); + m_K.resize(64); + load_le<u16bit>(m_K.data(), L.data(), 64); } void RC2::clear() { - zap(K); + zap(m_K); } /* diff --git a/src/lib/block/rc2/rc2.h b/src/lib/block/rc2/rc2.h index 11956f408..76391791a 100644 --- a/src/lib/block/rc2/rc2.h +++ b/src/lib/block/rc2/rc2.h @@ -34,7 +34,7 @@ class BOTAN_DLL RC2 : public Block_Cipher_Fixed_Params<8, 1, 32> private: void key_schedule(const byte[], size_t) override; - secure_vector<u16bit> K; + secure_vector<u16bit> m_K; }; } |