aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/block/blowfish
diff options
context:
space:
mode:
authorRenĂ© Korthaus <[email protected]>2015-12-23 11:52:19 +0100
committerJack Lloyd <[email protected]>2016-01-08 19:09:51 -0500
commitd22bc10cd4f67924acd82bcd46a31e3de3b20ce3 (patch)
tree58459585e6675cd799b6ef5900be026825cd6f9d /src/lib/block/blowfish
parent2fbfdd7e5afb5e888fd8c0b56c6df09e2bdeaca7 (diff)
Mass-prefix member vars with m_
Diffstat (limited to 'src/lib/block/blowfish')
-rw-r--r--src/lib/block/blowfish/blowfish.cpp68
-rw-r--r--src/lib/block/blowfish/blowfish.h2
2 files changed, 35 insertions, 35 deletions
diff --git a/src/lib/block/blowfish/blowfish.cpp b/src/lib/block/blowfish/blowfish.cpp
index 0b0e685a8..e38668934 100644
--- a/src/lib/block/blowfish/blowfish.cpp
+++ b/src/lib/block/blowfish/blowfish.cpp
@@ -15,10 +15,10 @@ namespace Botan {
*/
void Blowfish::encrypt_n(const byte in[], byte out[], size_t blocks) const
{
- const u32bit* S1 = &S[0];
- const u32bit* S2 = &S[256];
- const u32bit* S3 = &S[512];
- const u32bit* S4 = &S[768];
+ const u32bit* S1 = &m_S[0];
+ const u32bit* S2 = &m_S[256];
+ const u32bit* S3 = &m_S[512];
+ const u32bit* S4 = &m_S[768];
for(size_t i = 0; i != blocks; ++i)
{
@@ -27,16 +27,16 @@ void Blowfish::encrypt_n(const byte in[], byte out[], size_t blocks) const
for(size_t j = 0; j != 16; j += 2)
{
- L ^= P[j];
+ L ^= m_P[j];
R ^= ((S1[get_byte(0, L)] + S2[get_byte(1, L)]) ^
S3[get_byte(2, L)]) + S4[get_byte(3, L)];
- R ^= P[j+1];
+ R ^= m_P[j+1];
L ^= ((S1[get_byte(0, R)] + S2[get_byte(1, R)]) ^
S3[get_byte(2, R)]) + S4[get_byte(3, R)];
}
- L ^= P[16]; R ^= P[17];
+ L ^= m_P[16]; R ^= m_P[17];
store_be(out, R, L);
@@ -50,10 +50,10 @@ void Blowfish::encrypt_n(const byte in[], byte out[], size_t blocks) const
*/
void Blowfish::decrypt_n(const byte in[], byte out[], size_t blocks) const
{
- const u32bit* S1 = &S[0];
- const u32bit* S2 = &S[256];
- const u32bit* S3 = &S[512];
- const u32bit* S4 = &S[768];
+ const u32bit* S1 = &m_S[0];
+ const u32bit* S2 = &m_S[256];
+ const u32bit* S3 = &m_S[512];
+ const u32bit* S4 = &m_S[768];
for(size_t i = 0; i != blocks; ++i)
{
@@ -62,16 +62,16 @@ void Blowfish::decrypt_n(const byte in[], byte out[], size_t blocks) const
for(size_t j = 17; j != 1; j -= 2)
{
- L ^= P[j];
+ L ^= m_P[j];
R ^= ((S1[get_byte(0, L)] + S2[get_byte(1, L)]) ^
S3[get_byte(2, L)]) + S4[get_byte(3, L)];
- R ^= P[j-1];
+ R ^= m_P[j-1];
L ^= ((S1[get_byte(0, R)] + S2[get_byte(1, R)]) ^
S3[get_byte(2, R)]) + S4[get_byte(3, R)];
}
- L ^= P[1]; R ^= P[0];
+ L ^= m_P[1]; R ^= m_P[0];
store_be(out, R, L);
@@ -85,11 +85,11 @@ void Blowfish::decrypt_n(const byte in[], byte out[], size_t blocks) const
*/
void Blowfish::key_schedule(const byte key[], size_t length)
{
- P.resize(18);
- copy_mem(P.data(), P_INIT, 18);
+ m_P.resize(18);
+ copy_mem(m_P.data(), P_INIT, 18);
- S.resize(1024);
- copy_mem(S.data(), S_INIT, 1024);
+ m_S.resize(1024);
+ copy_mem(m_S.data(), S_INIT, 1024);
const byte null_salt[16] = { 0 };
@@ -101,12 +101,12 @@ void Blowfish::key_expansion(const byte key[],
const byte salt[16])
{
for(size_t i = 0, j = 0; i != 18; ++i, j += 4)
- P[i] ^= make_u32bit(key[(j ) % length], key[(j+1) % length],
+ m_P[i] ^= make_u32bit(key[(j ) % length], key[(j+1) % length],
key[(j+2) % length], key[(j+3) % length]);
u32bit L = 0, R = 0;
- generate_sbox(P, L, R, salt, 0);
- generate_sbox(S, L, R, salt, 2);
+ generate_sbox(m_P, L, R, salt, 0);
+ generate_sbox(m_S, L, R, salt, 2);
}
/*
@@ -130,11 +130,11 @@ void Blowfish::eks_key_schedule(const byte key[], size_t length,
throw Invalid_Argument("Requested Bcrypt work factor " +
std::to_string(workfactor) + " too large");
- P.resize(18);
- copy_mem(P.data(), P_INIT, 18);
+ m_P.resize(18);
+ copy_mem(m_P.data(), P_INIT, 18);
- S.resize(1024);
- copy_mem(S.data(), S_INIT, 1024);
+ m_S.resize(1024);
+ copy_mem(m_S.data(), S_INIT, 1024);
key_expansion(key, length, salt);
@@ -156,10 +156,10 @@ void Blowfish::generate_sbox(secure_vector<u32bit>& box,
const byte salt[16],
size_t salt_off) const
{
- const u32bit* S1 = &S[0];
- const u32bit* S2 = &S[256];
- const u32bit* S3 = &S[512];
- const u32bit* S4 = &S[768];
+ const u32bit* S1 = &m_S[0];
+ const u32bit* S2 = &m_S[256];
+ const u32bit* S3 = &m_S[512];
+ const u32bit* S4 = &m_S[768];
for(size_t i = 0; i != box.size(); i += 2)
{
@@ -168,16 +168,16 @@ void Blowfish::generate_sbox(secure_vector<u32bit>& box,
for(size_t j = 0; j != 16; j += 2)
{
- L ^= P[j];
+ L ^= m_P[j];
R ^= ((S1[get_byte(0, L)] + S2[get_byte(1, L)]) ^
S3[get_byte(2, L)]) + S4[get_byte(3, L)];
- R ^= P[j+1];
+ R ^= m_P[j+1];
L ^= ((S1[get_byte(0, R)] + S2[get_byte(1, R)]) ^
S3[get_byte(2, R)]) + S4[get_byte(3, R)];
}
- u32bit T = R; R = L ^ P[16]; L = T ^ P[17];
+ u32bit T = R; R = L ^ m_P[16]; L = T ^ m_P[17];
box[i] = L;
box[i+1] = R;
}
@@ -188,8 +188,8 @@ void Blowfish::generate_sbox(secure_vector<u32bit>& box,
*/
void Blowfish::clear()
{
- zap(P);
- zap(S);
+ zap(m_P);
+ zap(m_S);
}
}
diff --git a/src/lib/block/blowfish/blowfish.h b/src/lib/block/blowfish/blowfish.h
index e1042465f..ef2ecc3c4 100644
--- a/src/lib/block/blowfish/blowfish.h
+++ b/src/lib/block/blowfish/blowfish.h
@@ -45,7 +45,7 @@ class BOTAN_DLL Blowfish : public Block_Cipher_Fixed_Params<8, 1, 56>
static const u32bit P_INIT[18];
static const u32bit S_INIT[1024];
- secure_vector<u32bit> S, P;
+ secure_vector<u32bit> m_S, m_P;
};
}