diff options
author | Simon Warta <[email protected]> | 2015-06-26 11:30:15 +0200 |
---|---|---|
committer | Simon Warta <[email protected]> | 2015-06-27 11:15:18 +0200 |
commit | 105fb962ae525428c2385098abdf20bbf4382353 (patch) | |
tree | 6bc8800e1e9ee9adbe3f0f345b96b99beb8189fc /src | |
parent | 4b70dbf7c24dc4f60349e96220601f6c55c81c52 (diff) |
lib/base: Convert &vec[0] to vec.data()
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/base/buf_comp.h | 12 | ||||
-rw-r--r-- | src/lib/base/sym_algo.h | 2 | ||||
-rw-r--r-- | src/lib/base/symkey.cpp | 10 | ||||
-rw-r--r-- | src/lib/base/symkey.h | 2 | ||||
-rw-r--r-- | src/lib/base/transform.h | 6 |
5 files changed, 16 insertions, 16 deletions
diff --git a/src/lib/base/buf_comp.h b/src/lib/base/buf_comp.h index 564da2262..30e30c71c 100644 --- a/src/lib/base/buf_comp.h +++ b/src/lib/base/buf_comp.h @@ -39,7 +39,7 @@ class BOTAN_DLL Buffered_Computation */ void update(const secure_vector<byte>& in) { - add_data(&in[0], in.size()); + add_data(in.data(), in.size()); } /** @@ -48,7 +48,7 @@ class BOTAN_DLL Buffered_Computation */ void update(const std::vector<byte>& in) { - add_data(&in[0], in.size()); + add_data(in.data(), in.size()); } /** @@ -97,7 +97,7 @@ class BOTAN_DLL Buffered_Computation secure_vector<byte> final() { secure_vector<byte> output(output_length()); - final_result(&output[0]); + final_result(output.data()); return output; } @@ -105,7 +105,7 @@ class BOTAN_DLL Buffered_Computation void final(std::vector<byte, Alloc>& out) { out.resize(output_length()); - final_result(&out[0]); + final_result(out.data()); } /** @@ -129,7 +129,7 @@ class BOTAN_DLL Buffered_Computation */ secure_vector<byte> process(const secure_vector<byte>& in) { - add_data(&in[0], in.size()); + add_data(in.data(), in.size()); return final(); } @@ -141,7 +141,7 @@ class BOTAN_DLL Buffered_Computation */ secure_vector<byte> process(const std::vector<byte>& in) { - add_data(&in[0], in.size()); + add_data(in.data(), in.size()); return final(); } diff --git a/src/lib/base/sym_algo.h b/src/lib/base/sym_algo.h index 7c37b2a47..ee6eb5f4a 100644 --- a/src/lib/base/sym_algo.h +++ b/src/lib/base/sym_algo.h @@ -68,7 +68,7 @@ class BOTAN_DLL SymmetricAlgorithm template<typename Alloc> void set_key(const std::vector<byte, Alloc>& key) { - set_key(&key[0], key.size()); + set_key(key.data(), key.size()); } /** diff --git a/src/lib/base/symkey.cpp b/src/lib/base/symkey.cpp index 0cb0d9e35..88642747b 100644 --- a/src/lib/base/symkey.cpp +++ b/src/lib/base/symkey.cpp @@ -28,7 +28,7 @@ OctetString::OctetString(RandomNumberGenerator& rng, OctetString::OctetString(const std::string& hex_string) { bits.resize(1 + hex_string.length() / 2); - bits.resize(hex_decode(&bits[0], hex_string)); + bits.resize(hex_decode(bits.data(), hex_string)); } /* @@ -77,7 +77,7 @@ void OctetString::set_odd_parity() */ std::string OctetString::as_string() const { - return hex_encode(&bits[0], bits.size()); + return hex_encode(bits.data(), bits.size()); } /* @@ -86,7 +86,7 @@ std::string OctetString::as_string() const OctetString& OctetString::operator^=(const OctetString& k) { if(&k == this) { zeroise(bits); return (*this); } - xor_buf(&bits[0], k.begin(), std::min(length(), k.length())); + xor_buf(bits.data(), k.begin(), std::min(length(), k.length())); return (*this); } @@ -124,8 +124,8 @@ OctetString operator^(const OctetString& k1, const OctetString& k2) { secure_vector<byte> ret(std::max(k1.length(), k2.length())); - copy_mem(&ret[0], k1.begin(), k1.length()); - xor_buf(&ret[0], k2.begin(), k2.length()); + copy_mem(ret.data(), k1.begin(), k1.length()); + xor_buf(ret.data(), k2.begin(), k2.length()); return OctetString(ret); } diff --git a/src/lib/base/symkey.h b/src/lib/base/symkey.h index c837e8ca5..23b7d030b 100644 --- a/src/lib/base/symkey.h +++ b/src/lib/base/symkey.h @@ -33,7 +33,7 @@ class BOTAN_DLL OctetString /** * @return start of this string */ - const byte* begin() const { return &bits[0]; } + const byte* begin() const { return bits.data(); } /** * @return end of this string diff --git a/src/lib/base/transform.h b/src/lib/base/transform.h index 75bd5004a..b5916a3a4 100644 --- a/src/lib/base/transform.h +++ b/src/lib/base/transform.h @@ -33,7 +33,7 @@ class BOTAN_DLL Transform template<typename Alloc> secure_vector<byte> start(const std::vector<byte, Alloc>& nonce) { - return start(&nonce[0], nonce.size()); + return start(nonce.data(), nonce.size()); } /** @@ -44,7 +44,7 @@ class BOTAN_DLL Transform BOTAN_DEPRECATED("Use Transform::start") secure_vector<byte> start_vec(const std::vector<byte, Alloc>& nonce) { - return start(&nonce[0], nonce.size()); + return start(nonce.data(), nonce.size()); } /** @@ -147,7 +147,7 @@ class BOTAN_DLL Keyed_Transform : public Transform template<typename Alloc> void set_key(const std::vector<byte, Alloc>& key) { - set_key(&key[0], key.size()); + set_key(key.data(), key.size()); } void set_key(const SymmetricKey& key) |