aboutsummaryrefslogtreecommitdiffstats
path: root/src/rng
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-10-13 02:56:03 +0000
committerlloyd <[email protected]>2010-10-13 02:56:03 +0000
commit3697dcff8b5e9765b41114281ce10e7ed3d3abb4 (patch)
tree670853a74b0fe173e7e9fce9cd3e6eda7a03d2c7 /src/rng
parent63121e1e169616f724bf79b8aac1a2b4423c8904 (diff)
s/BLOCK_SIZE/block_size()/
Diffstat (limited to 'src/rng')
-rw-r--r--src/rng/randpool/randpool.cpp4
-rw-r--r--src/rng/x931_rng/x931_rng.cpp16
2 files changed, 12 insertions, 8 deletions
diff --git a/src/rng/randpool/randpool.cpp b/src/rng/randpool/randpool.cpp
index e66081a07..92f225a9c 100644
--- a/src/rng/randpool/randpool.cpp
+++ b/src/rng/randpool/randpool.cpp
@@ -71,7 +71,7 @@ void Randpool::update_buffer()
*/
void Randpool::mix_pool()
{
- const size_t BLOCK_SIZE = cipher->BLOCK_SIZE;
+ const size_t BLOCK_SIZE = cipher->block_size();
mac->update(static_cast<byte>(MAC_KEY));
mac->update(pool);
@@ -175,7 +175,7 @@ Randpool::Randpool(BlockCipher* cipher_in,
cipher(cipher_in),
mac(mac_in)
{
- const size_t BLOCK_SIZE = cipher->BLOCK_SIZE;
+ const size_t BLOCK_SIZE = cipher->block_size();
const size_t OUTPUT_LENGTH = mac->output_length();
if(OUTPUT_LENGTH < BLOCK_SIZE ||
diff --git a/src/rng/x931_rng/x931_rng.cpp b/src/rng/x931_rng/x931_rng.cpp
index 6da1e214d..0911ce526 100644
--- a/src/rng/x931_rng/x931_rng.cpp
+++ b/src/rng/x931_rng/x931_rng.cpp
@@ -38,13 +38,15 @@ void ANSI_X931_RNG::randomize(byte out[], size_t length)
*/
void ANSI_X931_RNG::update_buffer()
{
- SecureVector<byte> DT = prng->random_vec(cipher->BLOCK_SIZE);
+ const size_t BLOCK_SIZE = cipher->block_size();
+
+ SecureVector<byte> DT = prng->random_vec(BLOCK_SIZE);
cipher->encrypt(DT);
- xor_buf(&R[0], &V[0], &DT[0], cipher->BLOCK_SIZE);
+ xor_buf(&R[0], &V[0], &DT[0], BLOCK_SIZE);
cipher->encrypt(R);
- xor_buf(&V[0], &R[0], &DT[0], cipher->BLOCK_SIZE);
+ xor_buf(&V[0], &R[0], &DT[0], BLOCK_SIZE);
cipher->encrypt(V);
position = 0;
@@ -55,12 +57,14 @@ void ANSI_X931_RNG::update_buffer()
*/
void ANSI_X931_RNG::rekey()
{
+ const size_t BLOCK_SIZE = cipher->block_size();
+
if(prng->is_seeded())
{
cipher->set_key(prng->random_vec(cipher->MAXIMUM_KEYLENGTH));
- if(V.size() != cipher->BLOCK_SIZE)
- V.resize(cipher->BLOCK_SIZE);
+ if(V.size() != BLOCK_SIZE)
+ V.resize(BLOCK_SIZE);
prng->randomize(&V[0], V.size());
update_buffer();
@@ -134,7 +138,7 @@ ANSI_X931_RNG::ANSI_X931_RNG(BlockCipher* cipher_in,
cipher = cipher_in;
prng = prng_in;
- R.resize(cipher->BLOCK_SIZE);
+ R.resize(cipher->block_size());
position = 0;
}