diff options
author | René Korthaus <[email protected]> | 2015-12-23 11:52:19 +0100 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2016-01-08 19:09:51 -0500 |
commit | d22bc10cd4f67924acd82bcd46a31e3de3b20ce3 (patch) | |
tree | 58459585e6675cd799b6ef5900be026825cd6f9d /src/lib/hash/gost_3411 | |
parent | 2fbfdd7e5afb5e888fd8c0b56c6df09e2bdeaca7 (diff) |
Mass-prefix member vars with m_
Diffstat (limited to 'src/lib/hash/gost_3411')
-rw-r--r-- | src/lib/hash/gost_3411/gost_3411.cpp | 68 | ||||
-rw-r--r-- | src/lib/hash/gost_3411/gost_3411.h | 8 |
2 files changed, 38 insertions, 38 deletions
diff --git a/src/lib/hash/gost_3411/gost_3411.cpp b/src/lib/hash/gost_3411/gost_3411.cpp index f8c9c0069..17c590a5c 100644 --- a/src/lib/hash/gost_3411/gost_3411.cpp +++ b/src/lib/hash/gost_3411/gost_3411.cpp @@ -13,22 +13,22 @@ namespace Botan { * GOST 34.11 Constructor */ GOST_34_11::GOST_34_11() : - cipher(GOST_28147_89_Params("R3411_CryptoPro")), - buffer(32), - sum(32), - hash(32) + m_cipher(GOST_28147_89_Params("R3411_CryptoPro")), + m_buffer(32), + m_sum(32), + m_hash(32) { - count = 0; - position = 0; + m_count = 0; + m_position = 0; } void GOST_34_11::clear() { - cipher.clear(); - zeroise(sum); - zeroise(hash); - count = 0; - position = 0; + m_cipher.clear(); + zeroise(m_sum); + zeroise(m_hash); + m_count = 0; + m_position = 0; } /** @@ -36,18 +36,18 @@ void GOST_34_11::clear() */ void GOST_34_11::add_data(const byte input[], size_t length) { - count += length; + m_count += length; - if(position) + if(m_position) { - buffer_insert(buffer, position, input, length); + buffer_insert(m_buffer, m_position, input, length); - if(position + length >= hash_block_size()) + if(m_position + length >= hash_block_size()) { - compress_n(buffer.data(), 1); - input += (hash_block_size() - position); - length -= (hash_block_size() - position); - position = 0; + compress_n(m_buffer.data(), 1); + input += (hash_block_size() - m_position); + length -= (hash_block_size() - m_position); + m_position = 0; } } @@ -57,8 +57,8 @@ void GOST_34_11::add_data(const byte input[], size_t length) if(full_blocks) compress_n(input, full_blocks); - buffer_insert(buffer, position, input + full_blocks * hash_block_size(), remaining); - position += remaining; + buffer_insert(m_buffer, m_position, input + full_blocks * hash_block_size(), remaining); + m_position += remaining; } /** @@ -70,15 +70,15 @@ void GOST_34_11::compress_n(const byte input[], size_t blocks) { for(u16bit j = 0, carry = 0; j != 32; ++j) { - u16bit s = sum[j] + input[32*i+j] + carry; + u16bit s = m_sum[j] + input[32*i+j] + carry; carry = get_byte(0, s); - sum[j] = get_byte(1, s); + m_sum[j] = get_byte(1, s); } byte S[32] = { 0 }; u64bit U[4], V[4]; - load_be(U, hash.data(), 4); + load_be(U, m_hash.data(), 4); load_be(V, input + 32*i, 4); for(size_t j = 0; j != 4; ++j) @@ -90,8 +90,8 @@ void GOST_34_11::compress_n(const byte input[], size_t blocks) for(size_t l = 0; l != 8; ++l) key[4*l+k] = get_byte(l, U[k]) ^ get_byte(l, V[k]); - cipher.set_key(key, 32); - cipher.encrypt(&hash[8*j], S + 8*j); + m_cipher.set_key(key, 32); + m_cipher.encrypt(&m_hash[8*j], S + 8*j); if(j == 3) break; @@ -165,7 +165,7 @@ void GOST_34_11::compress_n(const byte input[], size_t blocks) S[30] = S2[0]; S[31] = S2[1]; - xor_buf(S, hash.data(), 32); + xor_buf(S, m_hash.data(), 32); // 61 rounds of psi S2[ 0] = S[ 2] ^ S[ 6] ^ S[14] ^ S[20] ^ S[22] ^ S[26] ^ S[28] ^ S[30]; @@ -207,7 +207,7 @@ void GOST_34_11::compress_n(const byte input[], size_t blocks) S2[30] = S[ 2] ^ S[ 4] ^ S[ 8] ^ S[14] ^ S[16] ^ S[18] ^ S[22] ^ S[24] ^ S[28] ^ S[30]; S2[31] = S[ 3] ^ S[ 5] ^ S[ 9] ^ S[15] ^ S[17] ^ S[19] ^ S[23] ^ S[25] ^ S[29] ^ S[31]; - copy_mem(hash.data(), S2, 32); + copy_mem(m_hash.data(), S2, 32); } } @@ -216,22 +216,22 @@ void GOST_34_11::compress_n(const byte input[], size_t blocks) */ void GOST_34_11::final_result(byte out[]) { - if(position) + if(m_position) { - clear_mem(buffer.data() + position, buffer.size() - position); - compress_n(buffer.data(), 1); + clear_mem(m_buffer.data() + m_position, m_buffer.size() - m_position); + compress_n(m_buffer.data(), 1); } secure_vector<byte> length_buf(32); - const u64bit bit_count = count * 8; + const u64bit bit_count = m_count * 8; store_le(bit_count, length_buf.data()); - secure_vector<byte> sum_buf = sum; + secure_vector<byte> sum_buf = m_sum; compress_n(length_buf.data(), 1); compress_n(sum_buf.data(), 1); - copy_mem(out, hash.data(), 32); + copy_mem(out, m_hash.data(), 32); clear(); } diff --git a/src/lib/hash/gost_3411/gost_3411.h b/src/lib/hash/gost_3411/gost_3411.h index 2ad96dbdb..326873d38 100644 --- a/src/lib/hash/gost_3411/gost_3411.h +++ b/src/lib/hash/gost_3411/gost_3411.h @@ -33,10 +33,10 @@ class BOTAN_DLL GOST_34_11 : public HashFunction void add_data(const byte[], size_t) override; void final_result(byte[]) override; - GOST_28147_89 cipher; - secure_vector<byte> buffer, sum, hash; - size_t position; - u64bit count; + GOST_28147_89 m_cipher; + secure_vector<byte> m_buffer, m_sum, m_hash; + size_t m_position; + u64bit m_count; }; } |