aboutsummaryrefslogtreecommitdiffstats
path: root/src/pbe/pbes2
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-09-13 15:54:50 +0000
committerlloyd <[email protected]>2010-09-13 15:54:50 +0000
commit36bfef27271eadffefbc6891a9d7fa7eed7b1e10 (patch)
tree81fe9b37bb580cedba5bb25ac04dfecdd36b18de /src/pbe/pbes2
parent4a7e9edcc92b08a285ea24549fd8c813d10b63b9 (diff)
More vector->pointer conversion removals.
Add RandomNumberGenerator::random_vec, which takes an length n and returns a new SecureVector with randomized contents of that size. This nicely covers most of the cases where randomize was being called on a vector, and is a little cleaner in the code as well, instead of vec.resize(length); rng.randomize(&vec[0], vec.size()); we just write vec = rng.random_vec(length);
Diffstat (limited to 'src/pbe/pbes2')
-rw-r--r--src/pbe/pbes2/pbes2.cpp7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/pbe/pbes2/pbes2.cpp b/src/pbe/pbes2/pbes2.cpp
index 5b77acff5..55b3a781a 100644
--- a/src/pbe/pbes2/pbes2.cpp
+++ b/src/pbe/pbes2/pbes2.cpp
@@ -100,11 +100,8 @@ void PBE_PKCS5v20::new_params(RandomNumberGenerator& rng)
iterations = 10000;
key_length = block_cipher->MAXIMUM_KEYLENGTH;
- salt.resize(12);
- rng.randomize(salt, salt.size());
-
- iv.resize(block_cipher->BLOCK_SIZE);
- rng.randomize(iv, iv.size());
+ salt = rng.random_vec(12);
+ iv = rng.random_vec(block_cipher->BLOCK_SIZE);
}
/*