aboutsummaryrefslogtreecommitdiff
path: root/src/crypto
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@protonmail.com>2019-10-28 13:41:45 +0100
committerWladimir J. van der Laan <laanwj@protonmail.com>2019-10-28 13:41:45 +0100
commitf3b51eb9352d7a7c5dfa15615efc8bc0a52ffecf (patch)
treeb580be6a30428150b6ec40ca5da5bb96ee746fb1 /src/crypto
parenta25945318fdc2890a141a28843c2c5af251c9605 (diff)
Fix occurences of c_str() used with size() to data()
Using `data()` better communicates the intent here. Also, depending on how `c_str()` is implemented, this fixes undefined behavior: The part of the string after the first NULL character might have undefined contents.
Diffstat (limited to 'src/crypto')
-rw-r--r--src/crypto/hkdf_sha256_32.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/crypto/hkdf_sha256_32.cpp b/src/crypto/hkdf_sha256_32.cpp
index 9cea5995ec..e684eced37 100644
--- a/src/crypto/hkdf_sha256_32.cpp
+++ b/src/crypto/hkdf_sha256_32.cpp
@@ -9,7 +9,7 @@
CHKDF_HMAC_SHA256_L32::CHKDF_HMAC_SHA256_L32(const unsigned char* ikm, size_t ikmlen, const std::string& salt)
{
- CHMAC_SHA256((const unsigned char*)salt.c_str(), salt.size()).Write(ikm, ikmlen).Finalize(m_prk);
+ CHMAC_SHA256((const unsigned char*)salt.data(), salt.size()).Write(ikm, ikmlen).Finalize(m_prk);
}
void CHKDF_HMAC_SHA256_L32::Expand32(const std::string& info, unsigned char hash[OUTPUT_SIZE])