aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorSimon Warta <[email protected]>2015-06-23 18:01:16 +0200
committerSimon Warta <[email protected]>2015-06-23 18:01:16 +0200
commit345ca08a751ae2969cfb78ef38fddfa0f0f30c00 (patch)
treedd7fee76d8fb074b90b9c87a18ae9678cb2f0094 /src/lib
parent2a83523815461a4aa461ce5cc3b1288727440705 (diff)
lib/vendor: Convert &vec[0] to vec.data()
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/vendor/openssl/openssl_block.cpp4
-rw-r--r--src/lib/vendor/openssl/openssl_rsa.cpp8
-rw-r--r--src/lib/vendor/sqlite3/sqlite3.cpp2
3 files changed, 7 insertions, 7 deletions
diff --git a/src/lib/vendor/openssl/openssl_block.cpp b/src/lib/vendor/openssl/openssl_block.cpp
index 34f0e5607..4fd41112b 100644
--- a/src/lib/vendor/openssl/openssl_block.cpp
+++ b/src/lib/vendor/openssl/openssl_block.cpp
@@ -113,8 +113,8 @@ void OpenSSL_BlockCipher::key_schedule(const byte key[], size_t length)
throw Invalid_Argument("OpenSSL_BlockCipher: Bad key length for " +
cipher_name);
- EVP_EncryptInit_ex(&encrypt, nullptr, nullptr, &full_key[0], nullptr);
- EVP_DecryptInit_ex(&decrypt, nullptr, nullptr, &full_key[0], nullptr);
+ EVP_EncryptInit_ex(&encrypt, nullptr, nullptr, full_key.data(), nullptr);
+ EVP_DecryptInit_ex(&decrypt, nullptr, nullptr, full_key.data(), nullptr);
}
/*
diff --git a/src/lib/vendor/openssl/openssl_rsa.cpp b/src/lib/vendor/openssl/openssl_rsa.cpp
index 6055039b5..214f1667d 100644
--- a/src/lib/vendor/openssl/openssl_rsa.cpp
+++ b/src/lib/vendor/openssl/openssl_rsa.cpp
@@ -61,7 +61,7 @@ class OpenSSL_RSA_Encryption_Operation : public PK_Ops::Encryption
m_openssl_rsa(nullptr, ::RSA_free), m_padding(pad)
{
const std::vector<byte> der = rsa.x509_subject_public_key();
- const byte* der_ptr = &der[0];
+ const byte* der_ptr = der.data();
m_openssl_rsa.reset(d2i_RSAPublicKey(nullptr, &der_ptr, der.size()));
if(!m_openssl_rsa)
throw OpenSSL_Error("d2i_RSAPublicKey");
@@ -76,7 +76,7 @@ class OpenSSL_RSA_Encryption_Operation : public PK_Ops::Encryption
{
secure_vector<byte> buf(::RSA_size(m_openssl_rsa.get()));
- int rc = ::RSA_public_encrypt(msg_len, msg, &buf[0], m_openssl_rsa.get(), m_padding);
+ int rc = ::RSA_public_encrypt(msg_len, msg, buf.data(), m_openssl_rsa.get(), m_padding);
if(rc < 0)
throw OpenSSL_Error("RSA_public_encrypt");
return buf;
@@ -112,7 +112,7 @@ class OpenSSL_RSA_Decryption_Operation : public PK_Ops::Decryption
m_openssl_rsa(nullptr, ::RSA_free), m_padding(pad)
{
const secure_vector<byte> der = rsa.pkcs8_private_key();
- const byte* der_ptr = &der[0];
+ const byte* der_ptr = der.data();
m_openssl_rsa.reset(d2i_RSAPrivateKey(nullptr, &der_ptr, der.size()));
if(!m_openssl_rsa)
throw OpenSSL_Error("d2i_RSAPrivateKey");
@@ -125,7 +125,7 @@ class OpenSSL_RSA_Decryption_Operation : public PK_Ops::Decryption
secure_vector<byte> decrypt(const byte msg[], size_t msg_len) override
{
secure_vector<byte> buf(::RSA_size(m_openssl_rsa.get()));
- int rc = ::RSA_private_decrypt(msg_len, msg, &buf[0], m_openssl_rsa.get(), m_padding);
+ int rc = ::RSA_private_decrypt(msg_len, msg, buf.data(), m_openssl_rsa.get(), m_padding);
if(rc < 0 || static_cast<size_t>(rc) > buf.size())
throw OpenSSL_Error("RSA_private_decrypt");
buf.resize(rc);
diff --git a/src/lib/vendor/sqlite3/sqlite3.cpp b/src/lib/vendor/sqlite3/sqlite3.cpp
index 61c7f15bc..be3c2b227 100644
--- a/src/lib/vendor/sqlite3/sqlite3.cpp
+++ b/src/lib/vendor/sqlite3/sqlite3.cpp
@@ -94,7 +94,7 @@ void Sqlite3_Database::Sqlite3_Statement::bind(int column, std::chrono::system_c
void Sqlite3_Database::Sqlite3_Statement::bind(int column, const std::vector<byte>& val)
{
- int rc = ::sqlite3_bind_blob(m_stmt, column, &val[0], val.size(), SQLITE_TRANSIENT);
+ int rc = ::sqlite3_bind_blob(m_stmt, column, val.data(), val.size(), SQLITE_TRANSIENT);
if(rc != SQLITE_OK)
throw std::runtime_error("sqlite3_bind_text failed, code " + std::to_string(rc));
}