diff options
author | lloyd <[email protected]> | 2010-10-13 02:56:03 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2010-10-13 02:56:03 +0000 |
commit | 3697dcff8b5e9765b41114281ce10e7ed3d3abb4 (patch) | |
tree | 670853a74b0fe173e7e9fce9cd3e6eda7a03d2c7 /src/rng/x931_rng | |
parent | 63121e1e169616f724bf79b8aac1a2b4423c8904 (diff) |
s/BLOCK_SIZE/block_size()/
Diffstat (limited to 'src/rng/x931_rng')
-rw-r--r-- | src/rng/x931_rng/x931_rng.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
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; } |