aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Warta <[email protected]>2015-06-25 11:19:24 +0200
committerSimon Warta <[email protected]>2015-06-25 11:19:24 +0200
commit3f91cbe7e5143dedb388fa2ce324194a1656f82f (patch)
tree2275ca2bb523cb57cd11f794d94f24fc0b643df4
parent026329021ca6693be545752238c517d477166a63 (diff)
lib/kdf: Convert &vec[0] to vec.data()
-rw-r--r--src/lib/kdf/hkdf/hkdf.cpp2
-rw-r--r--src/lib/kdf/kdf.h10
-rw-r--r--src/lib/kdf/kdf1/kdf1.cpp2
-rw-r--r--src/lib/kdf/kdf2/kdf2.cpp2
-rw-r--r--src/lib/kdf/prf_tls/prf_tls.cpp2
-rw-r--r--src/lib/kdf/prf_x942/prf_x942.cpp2
6 files changed, 10 insertions, 10 deletions
diff --git a/src/lib/kdf/hkdf/hkdf.cpp b/src/lib/kdf/hkdf/hkdf.cpp
index e725c3a4a..b643db6d9 100644
--- a/src/lib/kdf/hkdf/hkdf.cpp
+++ b/src/lib/kdf/hkdf/hkdf.cpp
@@ -41,7 +41,7 @@ size_t HKDF::kdf(byte out[], size_t out_len,
m_prf->final(h);
const size_t written = std::min(h.size(), out_len - offset);
- copy_mem(&out[offset], &h[0], written);
+ copy_mem(&out[offset], h.data(), written);
offset += written;
}
diff --git a/src/lib/kdf/kdf.h b/src/lib/kdf/kdf.h
index dc23a82bd..d69c1ece5 100644
--- a/src/lib/kdf/kdf.h
+++ b/src/lib/kdf/kdf.h
@@ -45,7 +45,7 @@ class BOTAN_DLL KDF
size_t salt_len) const
{
secure_vector<byte> key(key_len);
- key.resize(kdf(&key[0], key.size(), secret, secret_len, salt, salt_len));
+ key.resize(kdf(key.data(), key.size(), secret, secret_len, salt, salt_len));
return key;
}
@@ -59,7 +59,7 @@ class BOTAN_DLL KDF
const secure_vector<byte>& secret,
const std::string& salt = "") const
{
- return derive_key(key_len, &secret[0], secret.size(),
+ return derive_key(key_len, secret.data(), secret.size(),
reinterpret_cast<const byte*>(salt.data()),
salt.length());
}
@@ -76,8 +76,8 @@ class BOTAN_DLL KDF
const std::vector<byte, Alloc2>& salt) const
{
return derive_key(key_len,
- &secret[0], secret.size(),
- &salt[0], salt.size());
+ secret.data(), secret.size(),
+ salt.data(), salt.size());
}
/**
@@ -93,7 +93,7 @@ class BOTAN_DLL KDF
size_t salt_len) const
{
return derive_key(key_len,
- &secret[0], secret.size(),
+ secret.data(), secret.size(),
salt, salt_len);
}
diff --git a/src/lib/kdf/kdf1/kdf1.cpp b/src/lib/kdf/kdf1/kdf1.cpp
index c2a74027b..fa3432467 100644
--- a/src/lib/kdf/kdf1/kdf1.cpp
+++ b/src/lib/kdf/kdf1/kdf1.cpp
@@ -22,7 +22,7 @@ size_t KDF1::kdf(byte key[], size_t key_len,
if(key_len < m_hash->output_length())
{
secure_vector<byte> v = m_hash->final();
- copy_mem(key, &v[0], key_len);
+ copy_mem(key, v.data(), key_len);
return key_len;
}
diff --git a/src/lib/kdf/kdf2/kdf2.cpp b/src/lib/kdf/kdf2/kdf2.cpp
index f1a702887..9deb1a22f 100644
--- a/src/lib/kdf/kdf2/kdf2.cpp
+++ b/src/lib/kdf/kdf2/kdf2.cpp
@@ -28,7 +28,7 @@ size_t KDF2::kdf(byte key[], size_t key_len,
m_hash->final(h);
const size_t added = std::min(h.size(), key_len - offset);
- copy_mem(&key[offset], &h[0], added);
+ copy_mem(&key[offset], h.data(), added);
offset += added;
}
diff --git a/src/lib/kdf/prf_tls/prf_tls.cpp b/src/lib/kdf/prf_tls/prf_tls.cpp
index 2deb133e9..4fdec8fef 100644
--- a/src/lib/kdf/prf_tls/prf_tls.cpp
+++ b/src/lib/kdf/prf_tls/prf_tls.cpp
@@ -64,7 +64,7 @@ void P_hash(byte out[], size_t out_len,
mac.final(h);
const size_t writing = std::min(h.size(), out_len - offset);
- xor_buf(&out[offset], &h[0], writing);
+ xor_buf(&out[offset], h.data(), writing);
offset += writing;
}
}
diff --git a/src/lib/kdf/prf_x942/prf_x942.cpp b/src/lib/kdf/prf_x942/prf_x942.cpp
index 47e869bd5..622d68c1a 100644
--- a/src/lib/kdf/prf_x942/prf_x942.cpp
+++ b/src/lib/kdf/prf_x942/prf_x942.cpp
@@ -70,7 +70,7 @@ size_t X942_PRF::kdf(byte key[], size_t key_len,
hash->final(h);
const size_t copied = std::min(h.size(), key_len - offset);
- copy_mem(&key[offset], &h[0], copied);
+ copy_mem(&key[offset], h.data(), copied);
offset += copied;
++counter;