aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Warta <[email protected]>2015-06-23 20:07:15 +0200
committerSimon Warta <[email protected]>2015-06-23 20:07:15 +0200
commitfd1c77c5cf8d86c6ba6d2f5c8cf898502c463eba (patch)
tree6ac5df8e74d2ad203f03da28aba46e2a4bfdbea5
parent2a83523815461a4aa461ce5cc3b1288727440705 (diff)
lib/pubkey: Convert &vec[0] to vec.data()
-rw-r--r--src/lib/pubkey/curve25519/curve25519.cpp2
-rw-r--r--src/lib/pubkey/dlies/dlies.cpp6
-rw-r--r--src/lib/pubkey/gost_3410/gost_3410.cpp4
-rw-r--r--src/lib/pubkey/mce/code_based_key_gen.cpp2
-rw-r--r--src/lib/pubkey/mce/gf2m_rootfind_dcmp.cpp2
-rw-r--r--src/lib/pubkey/mce/goppa_code.cpp6
-rw-r--r--src/lib/pubkey/mce/mce_kem.cpp6
-rw-r--r--src/lib/pubkey/mce/mce_kem.h2
-rw-r--r--src/lib/pubkey/mce/mceliece.cpp12
-rw-r--r--src/lib/pubkey/mce/mceliece.h18
-rw-r--r--src/lib/pubkey/mce/mceliece_key.cpp6
-rw-r--r--src/lib/pubkey/mceies/mceies.cpp8
-rw-r--r--src/lib/pubkey/pk_ops.cpp6
-rw-r--r--src/lib/pubkey/pubkey.cpp2
-rw-r--r--src/lib/pubkey/pubkey.h22
-rw-r--r--src/lib/pubkey/rfc6979/rfc6979.cpp8
16 files changed, 56 insertions, 56 deletions
diff --git a/src/lib/pubkey/curve25519/curve25519.cpp b/src/lib/pubkey/curve25519/curve25519.cpp
index d6934748b..b314e16dc 100644
--- a/src/lib/pubkey/curve25519/curve25519.cpp
+++ b/src/lib/pubkey/curve25519/curve25519.cpp
@@ -24,7 +24,7 @@ secure_vector<byte> curve25519(const secure_vector<byte>& secret,
const byte pubval[32])
{
secure_vector<byte> out(32);
- const int rc = curve25519_donna(&out[0], &secret[0], &pubval[0]);
+ const int rc = curve25519_donna(out.data(), secret.data(), pubval);
BOTAN_ASSERT_EQUAL(rc, 0, "Return value of curve25519_donna is ok");
return out;
}
diff --git a/src/lib/pubkey/dlies/dlies.cpp b/src/lib/pubkey/dlies/dlies.cpp
index 899ee98aa..4b1a63f2c 100644
--- a/src/lib/pubkey/dlies/dlies.cpp
+++ b/src/lib/pubkey/dlies/dlies.cpp
@@ -50,7 +50,7 @@ std::vector<byte> DLIES_Encryptor::enc(const byte in[], size_t length,
throw Encoding_Error("DLIES: KDF did not provide sufficient output");
byte* C = &out[my_key.size()];
- mac->set_key(&K[0], mac_keylen);
+ mac->set_key(K.data(), mac_keylen);
xor_buf(C, &K[mac_keylen], length);
mac->update(C, length);
@@ -118,7 +118,7 @@ secure_vector<byte> DLIES_Decryptor::dec(const byte msg[], size_t length) const
if(K.size() != K_LENGTH)
throw Encoding_Error("DLIES: KDF did not provide sufficient output");
- mac->set_key(&K[0], mac_keylen);
+ mac->set_key(K.data(), mac_keylen);
mac->update(C);
for(size_t j = 0; j != 8; ++j)
mac->update(0);
@@ -126,7 +126,7 @@ secure_vector<byte> DLIES_Decryptor::dec(const byte msg[], size_t length) const
if(T != T2)
throw Decoding_Error("DLIES: message authentication failed");
- xor_buf(C, &K[0] + mac_keylen, C.size());
+ xor_buf(C, K.data() + mac_keylen, C.size());
return C;
}
diff --git a/src/lib/pubkey/gost_3410/gost_3410.cpp b/src/lib/pubkey/gost_3410/gost_3410.cpp
index 8eb711617..3950c0e43 100644
--- a/src/lib/pubkey/gost_3410/gost_3410.cpp
+++ b/src/lib/pubkey/gost_3410/gost_3410.cpp
@@ -70,7 +70,7 @@ GOST_3410_PublicKey::GOST_3410_PublicKey(const AlgorithmIdentifier& alg_id,
std::swap(bits[part_size+i], bits[2*part_size-1-i]);
}
- BigInt x(&bits[0], part_size);
+ BigInt x(bits.data(), part_size);
BigInt y(&bits[part_size], part_size);
public_key = PointGFp(domain().get_curve(), x, y);
@@ -88,7 +88,7 @@ BigInt decode_le(const byte msg[], size_t msg_len)
for(size_t i = 0; i != msg_le.size() / 2; ++i)
std::swap(msg_le[i], msg_le[msg_le.size()-1-i]);
- return BigInt(&msg_le[0], msg_le.size());
+ return BigInt(msg_le.data(), msg_le.size());
}
/**
diff --git a/src/lib/pubkey/mce/code_based_key_gen.cpp b/src/lib/pubkey/mce/code_based_key_gen.cpp
index 150f9b2ee..7adf85112 100644
--- a/src/lib/pubkey/mce/code_based_key_gen.cpp
+++ b/src/lib/pubkey/mce/code_based_key_gen.cpp
@@ -149,7 +149,7 @@ McEliece_PrivateKey generate_mceliece_key( RandomNumberGenerator & rng, u32bit e
//
//
std::vector<u32bit> H(bit_size_to_32bit_size(codimension) * code_length );
- u32bit* sk = &H[0];
+ u32bit* sk = H.data();
for (i = 0; i < code_length; ++i)
{
for (l = 0; l < t; ++l)
diff --git a/src/lib/pubkey/mce/gf2m_rootfind_dcmp.cpp b/src/lib/pubkey/mce/gf2m_rootfind_dcmp.cpp
index 85da0ec1d..2d4f06130 100644
--- a/src/lib/pubkey/mce/gf2m_rootfind_dcmp.cpp
+++ b/src/lib/pubkey/mce/gf2m_rootfind_dcmp.cpp
@@ -312,7 +312,7 @@ secure_vector<gf2m> gf2m_decomp_rootfind_state::find_roots(const polyn_gf2m & si
}while(1);
// side channel / fault attack countermeasure:
- root_pos = patch_root_array(&result[0], result.size(), root_pos);
+ root_pos = patch_root_array(result.data(), result.size(), root_pos);
result.resize(root_pos);
return result;
}
diff --git a/src/lib/pubkey/mce/goppa_code.cpp b/src/lib/pubkey/mce/goppa_code.cpp
index 6f4b40226..175508eac 100644
--- a/src/lib/pubkey/mce/goppa_code.cpp
+++ b/src/lib/pubkey/mce/goppa_code.cpp
@@ -161,14 +161,14 @@ secure_vector<byte> mceliece_decrypt(
key.get_code_length(),
bit_size_to_32bit_size(codimension),
ciphertext,
- &syndrome_vec[0], syndrome_vec.size() );
+ syndrome_vec.data(), syndrome_vec.size() );
secure_vector<byte> syndrome_byte_vec(bit_size_to_byte_size(codimension));
u32bit syndrome_byte_vec_size = syndrome_byte_vec.size();
for(u32bit i = 0; i < syndrome_byte_vec_size; i++)
{
syndrome_byte_vec[i] = syndrome_vec[i/4] >> (8* (i % 4));
}
- syndrome_polyn = polyn_gf2m( t-1, &syndrome_byte_vec[0],bit_size_to_byte_size(codimension), key.get_goppa_polyn().get_sp_field());
+ syndrome_polyn = polyn_gf2m(t-1, syndrome_byte_vec.data(), bit_size_to_byte_size(codimension), key.get_goppa_polyn().get_sp_field());
@@ -179,7 +179,7 @@ secure_vector<byte> mceliece_decrypt(
secure_vector<byte> cleartext(cleartext_len);
- copy_mem(&cleartext[0], ciphertext, cleartext_len);
+ copy_mem(cleartext.data(), ciphertext, cleartext_len);
for(u32bit i = 0; i < nb_err; i++)
{
diff --git a/src/lib/pubkey/mce/mce_kem.cpp b/src/lib/pubkey/mce/mce_kem.cpp
index dd4af4acc..b24c42f85 100644
--- a/src/lib/pubkey/mce/mce_kem.cpp
+++ b/src/lib/pubkey/mce/mce_kem.cpp
@@ -21,7 +21,7 @@ McEliece_KEM_Encryptor::encrypt(RandomNumberGenerator& rng)
{
const McEliece_PublicKey& key = m_raw_pub_op.get_key();
secure_vector<Botan::byte> plaintext((key.get_message_word_bit_length()+7)/8);
- rng.randomize(&plaintext[0], plaintext.size() );
+ rng.randomize(plaintext.data(), plaintext.size());
// unset unused bits in the last plaintext byte
u32bit used = key.get_message_word_bit_length() % 8;
@@ -39,7 +39,7 @@ McEliece_KEM_Encryptor::encrypt(RandomNumberGenerator& rng)
SHA_512 hash;
hash.update(message_and_error_input);
secure_vector<byte> sym_key = hash.final();
- secure_vector<byte> ciphertext = m_raw_pub_op.encrypt(&message_and_error_input[0],
+ secure_vector<byte> ciphertext = m_raw_pub_op.encrypt(message_and_error_input.data(),
message_and_error_input.size(), rng);
return std::make_pair(ciphertext, sym_key);
@@ -53,7 +53,7 @@ McEliece_KEM_Decryptor::McEliece_KEM_Decryptor(const McEliece_PrivateKey& mce_ke
secure_vector<Botan::byte> McEliece_KEM_Decryptor::decrypt(const byte msg[], size_t msg_len)
{
- secure_vector<Botan::byte> message_and_error = m_raw_priv_op.decrypt(&msg[0], msg_len );
+ secure_vector<Botan::byte> message_and_error = m_raw_priv_op.decrypt(msg, msg_len);
SHA_512 hash;
hash.update(message_and_error);
diff --git a/src/lib/pubkey/mce/mce_kem.h b/src/lib/pubkey/mce/mce_kem.h
index cbb2fc553..7a8d2f7ff 100644
--- a/src/lib/pubkey/mce/mce_kem.h
+++ b/src/lib/pubkey/mce/mce_kem.h
@@ -44,7 +44,7 @@ class BOTAN_DLL McEliece_KEM_Decryptor
template<typename Alloc>
secure_vector<Botan::byte> decrypt_vec(const std::vector<byte, Alloc>& v)
{
- return decrypt(&v[0], v.size());
+ return decrypt(v.data(), v.size());
}
private:
diff --git a/src/lib/pubkey/mce/mceliece.cpp b/src/lib/pubkey/mce/mceliece.cpp
index ed4d24467..6bbe93ce3 100644
--- a/src/lib/pubkey/mce/mceliece.cpp
+++ b/src/lib/pubkey/mce/mceliece.cpp
@@ -60,7 +60,7 @@ std::vector<byte> mult_by_pubkey(const byte *cleartext,
u32bit dimension = code_length - codimension;
std::vector<byte> cR(bit_size_to_32bit_size(codimension)* sizeof(u32bit));
- const byte* pt = &public_matrix[0];
+ const byte* pt = public_matrix.data();
for(i = 0; i < dimension / 8; ++i)
{
@@ -68,7 +68,7 @@ std::vector<byte> mult_by_pubkey(const byte *cleartext,
{
if(cleartext[i] & (1 << j))
{
- xor_buf(&cR[0], pt, cR.size());
+ xor_buf(cR.data(), pt, cR.size());
}
pt += bit_size_to_32bit_size(codimension) * sizeof(u32bit);
}
@@ -78,12 +78,12 @@ std::vector<byte> mult_by_pubkey(const byte *cleartext,
{
if(cleartext[i] & (1 << j))
{
- xor_buf(&cR[0], pt, bit_size_to_byte_size(codimension));
+ xor_buf(cR.data(), pt, bit_size_to_byte_size(codimension));
}
pt += bit_size_to_32bit_size(codimension) * sizeof(u32bit);
}
- concat_vectors( &ciphertext[0], cleartext, &cR[0], dimension, codimension);
+ concat_vectors(ciphertext.data(), cleartext, cR.data(), dimension, codimension);
return ciphertext;
}
@@ -150,7 +150,7 @@ secure_vector<byte> McEliece_Public_Operation::encrypt(const byte msg[], size_t
std::vector<byte> ciphertext_tmp = mceliece_encrypt( message_word, m_pub_key.get_public_matrix(), err_pos, m_code_length);
- copy_mem(&ciphertext[0], &ciphertext_tmp[0], ciphertext.size());
+ copy_mem(ciphertext.data(), ciphertext_tmp.data(), ciphertext.size());
return ciphertext;
}
@@ -159,7 +159,7 @@ std::vector<byte> mceliece_encrypt(const secure_vector<byte> & cleartext,
const secure_vector<gf2m> & err_pos,
u32bit code_length)
{
- std::vector<byte> ciphertext = mult_by_pubkey(&cleartext[0], public_matrix, code_length, err_pos.size());
+ std::vector<byte> ciphertext = mult_by_pubkey(cleartext.data(), public_matrix, code_length, err_pos.size());
// flip t error positions
for(size_t i = 0; i < err_pos.size(); ++i)
diff --git a/src/lib/pubkey/mce/mceliece.h b/src/lib/pubkey/mce/mceliece.h
index 19de27d8e..b62afee3a 100644
--- a/src/lib/pubkey/mce/mceliece.h
+++ b/src/lib/pubkey/mce/mceliece.h
@@ -30,15 +30,15 @@ class mceliece_message_parts
public:
mceliece_message_parts(const secure_vector<gf2m>& err_pos, const byte* message, u32bit message_length, u32bit code_length) :
- m_error_vector(error_vector_from_error_positions(&err_pos[0], err_pos.size(), code_length)),
+ m_error_vector(error_vector_from_error_positions(err_pos.data(), err_pos.size(), code_length)),
m_code_length(code_length)
{
m_message_word.resize(message_length);
- copy_mem(&m_message_word[0], message, message_length);
+ copy_mem(m_message_word.data(), message, message_length);
}
mceliece_message_parts(const secure_vector<gf2m>& err_pos, const secure_vector<byte>& message, unsigned code_length) :
- m_error_vector(error_vector_from_error_positions(&err_pos[0], err_pos.size(), code_length)),
+ m_error_vector(error_vector_from_error_positions(err_pos.data(), err_pos.size(), code_length)),
m_message_word(message),
m_code_length(code_length)
{}
@@ -68,17 +68,17 @@ class mceliece_message_parts
throw Invalid_Argument("cannot split McEliece message parts");
}
size_t err_vec_start_pos = message_concat_errors_len - err_vec_len;
- m_message_word = secure_vector<byte>(err_vec_start_pos );
- copy_mem(&m_message_word[0], &message_concat_errors[0], err_vec_start_pos);
- m_error_vector = secure_vector<byte>(err_vec_len );
- copy_mem(&m_error_vector[0], &message_concat_errors[err_vec_start_pos], err_vec_len);
+ m_message_word = secure_vector<byte>(err_vec_start_pos);
+ copy_mem(m_message_word.data(), message_concat_errors, err_vec_start_pos);
+ m_error_vector = secure_vector<byte>(err_vec_len);
+ copy_mem(m_error_vector.data(), &message_concat_errors[err_vec_start_pos], err_vec_len);
}
secure_vector<byte> get_concat() const
{
secure_vector<byte> result(m_error_vector.size() + m_message_word.size());
- copy_mem(&result[0], &m_message_word[0], m_message_word.size());
- copy_mem(&result[m_message_word.size()], &m_error_vector[0], m_error_vector.size());
+ copy_mem(result.data(), m_message_word.data(), m_message_word.size());
+ copy_mem(&result[m_message_word.size()], m_error_vector.data(), m_error_vector.size());
return result;
}
diff --git a/src/lib/pubkey/mce/mceliece_key.cpp b/src/lib/pubkey/mce/mceliece_key.cpp
index e0f8b4cd6..41392f695 100644
--- a/src/lib/pubkey/mce/mceliece_key.cpp
+++ b/src/lib/pubkey/mce/mceliece_key.cpp
@@ -139,13 +139,13 @@ bool McEliece_PrivateKey::check_key(RandomNumberGenerator& rng, bool) const
McEliece_Public_Operation pub_op(*this, get_code_length());
secure_vector<byte> plaintext((this->get_message_word_bit_length()+7)/8);
- rng.randomize(&plaintext[0], plaintext.size() - 1);
+ rng.randomize(plaintext.data(), plaintext.size() - 1);
const secure_vector<gf2m> err_pos = create_random_error_positions(this->get_code_length(), this->get_t(), rng);
mceliece_message_parts parts(err_pos, plaintext, this->get_code_length());
secure_vector<byte> message_and_error_input = parts.get_concat();
- secure_vector<byte> ciphertext = pub_op.encrypt(&message_and_error_input[0], message_and_error_input.size(), rng);
- secure_vector<byte> message_and_error_output = priv_op.decrypt(&ciphertext[0], ciphertext.size());
+ secure_vector<byte> ciphertext = pub_op.encrypt(message_and_error_input.data(), message_and_error_input.size(), rng);
+ secure_vector<byte> message_and_error_output = priv_op.decrypt(ciphertext.data(), ciphertext.size());
return (message_and_error_input == message_and_error_output);
}
diff --git a/src/lib/pubkey/mceies/mceies.cpp b/src/lib/pubkey/mceies/mceies.cpp
index 3fec1fd48..6b013c250 100644
--- a/src/lib/pubkey/mceies/mceies.cpp
+++ b/src/lib/pubkey/mceies/mceies.cpp
@@ -57,9 +57,9 @@ mceies_encrypt(const McEliece_PublicKey& pubkey,
const secure_vector<byte> nonce = rng.random_vec(nonce_len);
secure_vector<byte> msg(mce_ciphertext.size() + nonce.size() + pt.size());
- copy_mem(&msg[0], &mce_ciphertext[0], mce_ciphertext.size());
- copy_mem(&msg[mce_ciphertext.size()], &nonce[0], nonce.size());
- copy_mem(&msg[mce_ciphertext.size() + nonce.size()], &pt[0], pt.size());
+ copy_mem(msg.data(), mce_ciphertext.data(), mce_ciphertext.size());
+ copy_mem(&msg[mce_ciphertext.size()], nonce.data(), nonce.size());
+ copy_mem(&msg[mce_ciphertext.size() + nonce.size()], pt.data(), pt.size());
aead->start(nonce);
aead->finish(msg, mce_ciphertext.size() + nonce.size());
@@ -86,7 +86,7 @@ mceies_decrypt(const McEliece_PrivateKey& privkey,
if(ct.size() < mce_code_bytes + nonce_len + aead->tag_size())
throw std::runtime_error("Input message too small to be valid");
- const secure_vector<byte> mce_key = kem_op.decrypt(&ct[0], mce_code_bytes);
+ const secure_vector<byte> mce_key = kem_op.decrypt(ct.data(), mce_code_bytes);
aead->set_key(aead_key(mce_key, *aead));
aead->set_associated_data(ad, ad_len);
diff --git a/src/lib/pubkey/pk_ops.cpp b/src/lib/pubkey/pk_ops.cpp
index f78861b9f..9f264af12 100644
--- a/src/lib/pubkey/pk_ops.cpp
+++ b/src/lib/pubkey/pk_ops.cpp
@@ -37,7 +37,7 @@ secure_vector<byte> PK_Ops::Encryption_with_EME::encrypt(const byte msg[], size_
if(8*(encoded.size() - 1) + high_bit(encoded[0]) > max_raw)
throw std::runtime_error("Input is too large to encrypt with this key");
- return raw_encrypt(&encoded[0], encoded.size(), rng);
+ return raw_encrypt(encoded.data(), encoded.size(), rng);
}
PK_Ops::Decryption_with_EME::Decryption_with_EME(const std::string& eme)
@@ -95,7 +95,7 @@ secure_vector<byte> PK_Ops::Signature_with_EMSA::sign(RandomNumberGenerator& rng
{
const secure_vector<byte> msg = m_emsa->raw_data();
const auto padded = m_emsa->encoding_of(msg, this->max_input_bits(), rng);
- return raw_sign(&padded[0], padded.size(), rng);
+ return raw_sign(padded.data(), padded.size(), rng);
}
PK_Ops::Verification_with_EMSA::Verification_with_EMSA(const std::string& emsa)
@@ -125,7 +125,7 @@ bool PK_Ops::Verification_with_EMSA::is_valid_signature(const byte sig[], size_t
{
Null_RNG rng;
secure_vector<byte> encoded = m_emsa->encoding_of(msg, max_input_bits(), rng);
- return verify(&encoded[0], encoded.size(), sig, sig_len);
+ return verify(encoded.data(), encoded.size(), sig, sig_len);
}
}
diff --git a/src/lib/pubkey/pubkey.cpp b/src/lib/pubkey/pubkey.cpp
index 685cccfc1..74b6a2053 100644
--- a/src/lib/pubkey/pubkey.cpp
+++ b/src/lib/pubkey/pubkey.cpp
@@ -173,7 +173,7 @@ bool PK_Verifier::check_signature(const byte sig[], size_t length)
m_op->message_part_size(),
m_op->message_parts());
- return m_op->is_valid_signature(&real_sig[0], real_sig.size());
+ return m_op->is_valid_signature(real_sig.data(), real_sig.size());
}
else
throw Decoding_Error("PK_Verifier: Unknown signature format " +
diff --git a/src/lib/pubkey/pubkey.h b/src/lib/pubkey/pubkey.h
index 54c55c597..c95ed4469 100644
--- a/src/lib/pubkey/pubkey.h
+++ b/src/lib/pubkey/pubkey.h
@@ -53,7 +53,7 @@ class BOTAN_DLL PK_Encryptor
std::vector<byte> encrypt(const std::vector<byte, Alloc>& in,
RandomNumberGenerator& rng) const
{
- return enc(&in[0], in.size(), rng);
+ return enc(in.data(), in.size(), rng);
}
/**
@@ -99,7 +99,7 @@ class BOTAN_DLL PK_Decryptor
template<typename Alloc>
secure_vector<byte> decrypt(const std::vector<byte, Alloc>& in) const
{
- return dec(&in[0], in.size());
+ return dec(in.data(), in.size());
}
PK_Decryptor() {}
@@ -142,11 +142,11 @@ class BOTAN_DLL PK_Signer
*/
std::vector<byte> sign_message(const std::vector<byte>& in,
RandomNumberGenerator& rng)
- { return sign_message(&in[0], in.size(), rng); }
+ { return sign_message(in.data(), in.size(), rng); }
std::vector<byte> sign_message(const secure_vector<byte>& in,
RandomNumberGenerator& rng)
- { return sign_message(&in[0], in.size(), rng); }
+ { return sign_message(in.data(), in.size(), rng); }
/**
* Add a message part (single byte).
@@ -165,7 +165,7 @@ class BOTAN_DLL PK_Signer
* Add a message part.
* @param in the message part to add
*/
- void update(const std::vector<byte>& in) { update(&in[0], in.size()); }
+ void update(const std::vector<byte>& in) { update(in.data(), in.size()); }
/**
* Get the signature of the so far processed message (provided by the
@@ -224,8 +224,8 @@ class BOTAN_DLL PK_Verifier
bool verify_message(const std::vector<byte, Alloc>& msg,
const std::vector<byte, Alloc2>& sig)
{
- return verify_message(&msg[0], msg.size(),
- &sig[0], sig.size());
+ return verify_message(msg.data(), msg.size(),
+ sig.data(), sig.size());
}
/**
@@ -249,7 +249,7 @@ class BOTAN_DLL PK_Verifier
* @param in the new message part
*/
void update(const std::vector<byte>& in)
- { update(&in[0], in.size()); }
+ { update(in.data(), in.size()); }
/**
* Check the signature of the buffered message, i.e. the one build
@@ -269,7 +269,7 @@ class BOTAN_DLL PK_Verifier
template<typename Alloc>
bool check_signature(const std::vector<byte, Alloc>& sig)
{
- return check_signature(&sig[0], sig.size());
+ return check_signature(sig.data(), sig.size());
}
/**
@@ -326,7 +326,7 @@ class BOTAN_DLL PK_Key_Agreement
const byte params[],
size_t params_len) const
{
- return derive_key(key_len, &in[0], in.size(),
+ return derive_key(key_len, in.data(), in.size(),
params, params_len);
}
@@ -356,7 +356,7 @@ class BOTAN_DLL PK_Key_Agreement
const std::vector<byte>& in,
const std::string& params = "") const
{
- return derive_key(key_len, &in[0], in.size(),
+ return derive_key(key_len, in.data(), in.size(),
reinterpret_cast<const byte*>(params.data()),
params.length());
}
diff --git a/src/lib/pubkey/rfc6979/rfc6979.cpp b/src/lib/pubkey/rfc6979/rfc6979.cpp
index 58cdbaa1b..5f606891d 100644
--- a/src/lib/pubkey/rfc6979/rfc6979.cpp
+++ b/src/lib/pubkey/rfc6979/rfc6979.cpp
@@ -35,19 +35,19 @@ RFC6979_Nonce_Generator::RFC6979_Nonce_Generator(const std::string& hash,
m_rng_in(m_rlen * 2),
m_rng_out(m_rlen)
{
- BigInt::encode_1363(&m_rng_in[0], m_rlen, x);
+ BigInt::encode_1363(m_rng_in.data(), m_rlen, x);
}
const BigInt& RFC6979_Nonce_Generator::nonce_for(const BigInt& m)
{
BigInt::encode_1363(&m_rng_in[m_rlen], m_rlen, m);
m_hmac_drbg->clear();
- m_hmac_drbg->add_entropy(&m_rng_in[0], m_rng_in.size());
+ m_hmac_drbg->add_entropy(m_rng_in.data(), m_rng_in.size());
do
{
- m_hmac_drbg->randomize(&m_rng_out[0], m_rng_out.size());
- m_k.binary_decode(&m_rng_out[0], m_rng_out.size());
+ m_hmac_drbg->randomize(m_rng_out.data(), m_rng_out.size());
+ m_k.binary_decode(m_rng_out.data(), m_rng_out.size());
m_k >>= (8*m_rlen - m_qlen);
}
while(m_k == 0 || m_k >= m_order);