From 3697dcff8b5e9765b41114281ce10e7ed3d3abb4 Mon Sep 17 00:00:00 2001 From: lloyd Date: Wed, 13 Oct 2010 02:56:03 +0000 Subject: s/BLOCK_SIZE/block_size()/ --- src/rng/x931_rng/x931_rng.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'src/rng/x931_rng') 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 DT = prng->random_vec(cipher->BLOCK_SIZE); + const size_t BLOCK_SIZE = cipher->block_size(); + + SecureVector 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; } -- cgit v1.2.3