aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorSimon Warta <[email protected]>2015-06-23 18:59:02 +0200
committerSimon Warta <[email protected]>2015-06-23 18:59:02 +0200
commit28b2beef62d4b465193659545e857f253d59f817 (patch)
tree05f6a67bd364c04f9e71ee2b6e8e3ac0bcf9be1c /src/lib
parent9a841344acb1844082a0e46c26f91b4f50af86dd (diff)
lib/rng: Convert &vec[0] to vec.data()
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/rng/hmac_drbg/hmac_drbg.cpp4
-rw-r--r--src/lib/rng/hmac_rng/hmac_rng.cpp6
-rw-r--r--src/lib/rng/rng.h2
-rw-r--r--src/lib/rng/x931_rng/x931_rng.cpp6
4 files changed, 9 insertions, 9 deletions
diff --git a/src/lib/rng/hmac_drbg/hmac_drbg.cpp b/src/lib/rng/hmac_drbg/hmac_drbg.cpp
index dc0d18afe..af0565120 100644
--- a/src/lib/rng/hmac_drbg/hmac_drbg.cpp
+++ b/src/lib/rng/hmac_drbg/hmac_drbg.cpp
@@ -32,7 +32,7 @@ void HMAC_DRBG::randomize(byte out[], size_t length)
{
const size_t to_copy = std::min(length, m_V.size());
m_V = m_mac->process(m_V);
- copy_mem(&out[0], &m_V[0], to_copy);
+ copy_mem(out, m_V.data(), to_copy);
length -= to_copy;
out += to_copy;
@@ -75,7 +75,7 @@ void HMAC_DRBG::reseed(size_t poll_bits)
if(m_prng->is_seeded())
{
secure_vector<byte> input = m_prng->random_vec(m_mac->output_length());
- update(&input[0], input.size());
+ update(input.data(), input.size());
m_reseed_counter = 1;
}
}
diff --git a/src/lib/rng/hmac_rng/hmac_rng.cpp b/src/lib/rng/hmac_rng/hmac_rng.cpp
index 873a83ae9..36003385a 100644
--- a/src/lib/rng/hmac_rng/hmac_rng.cpp
+++ b/src/lib/rng/hmac_rng/hmac_rng.cpp
@@ -55,7 +55,7 @@ void HMAC_RNG::clear()
sets m_seeded to true.
*/
std::vector<byte> prf_zero_key(m_extractor->output_length());
- m_prf->set_key(&prf_zero_key[0], prf_zero_key.size());
+ m_prf->set_key(prf_zero_key.data(), prf_zero_key.size());
/*
Use PRF("Botan HMAC_RNG XTS") as the intitial XTS key.
@@ -77,7 +77,7 @@ void HMAC_RNG::new_K_value(byte label)
m_prf->update_be(clock::now().time_since_epoch().count());
m_prf->update_be(m_counter++);
m_prf->update(label);
- m_prf->final(&m_K[0]);
+ m_prf->final(m_K.data());
}
/*
@@ -108,7 +108,7 @@ void HMAC_RNG::randomize(byte out[], size_t length)
const size_t copied = std::min<size_t>(length, max_per_prf_iter);
- copy_mem(out, &m_K[0], copied);
+ copy_mem(out, m_K.data(), copied);
out += copied;
length -= copied;
}
diff --git a/src/lib/rng/rng.h b/src/lib/rng/rng.h
index 836eb1006..2abd11532 100644
--- a/src/lib/rng/rng.h
+++ b/src/lib/rng/rng.h
@@ -42,7 +42,7 @@ class BOTAN_DLL RandomNumberGenerator
virtual secure_vector<byte> random_vec(size_t bytes)
{
secure_vector<byte> output(bytes);
- randomize(&output[0], output.size());
+ randomize(output.data(), output.size());
return output;
}
diff --git a/src/lib/rng/x931_rng/x931_rng.cpp b/src/lib/rng/x931_rng/x931_rng.cpp
index 3793f546e..976e324c3 100644
--- a/src/lib/rng/x931_rng/x931_rng.cpp
+++ b/src/lib/rng/x931_rng/x931_rng.cpp
@@ -45,10 +45,10 @@ void ANSI_X931_RNG::update_buffer()
secure_vector<byte> DT = m_prng->random_vec(BLOCK_SIZE);
m_cipher->encrypt(DT);
- xor_buf(&m_R[0], &m_V[0], &DT[0], BLOCK_SIZE);
+ xor_buf(m_R.data(), m_V.data(), DT.data(), BLOCK_SIZE);
m_cipher->encrypt(m_R);
- xor_buf(&m_V[0], &m_R[0], &DT[0], BLOCK_SIZE);
+ xor_buf(m_V.data(), m_R.data(), DT.data(), BLOCK_SIZE);
m_cipher->encrypt(m_V);
m_R_pos = 0;
@@ -67,7 +67,7 @@ void ANSI_X931_RNG::rekey()
if(m_V.size() != BLOCK_SIZE)
m_V.resize(BLOCK_SIZE);
- m_prng->randomize(&m_V[0], m_V.size());
+ m_prng->randomize(m_V.data(), m_V.size());
update_buffer();
}