aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/tls
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2017-09-16 14:45:52 -0400
committerJack Lloyd <[email protected]>2017-09-16 14:45:52 -0400
commit83932f30ff02d285c8a7e2a363601f460d55d268 (patch)
tree4bb4a54d89c8584bea8fa19774e9e22ae77278cf /src/lib/tls
parentf39aa7bb4e43e27b10d3f890da7ba1acba9f14ca (diff)
Use constant_time_compare instead of same_mem
New name, same great operation
Diffstat (limited to 'src/lib/tls')
-rw-r--r--src/lib/tls/msg_finished.cpp2
-rw-r--r--src/lib/tls/tls_cbc/tls_cbc.cpp4
2 files changed, 3 insertions, 3 deletions
diff --git a/src/lib/tls/msg_finished.cpp b/src/lib/tls/msg_finished.cpp
index f00311729..0fbfc0738 100644
--- a/src/lib/tls/msg_finished.cpp
+++ b/src/lib/tls/msg_finished.cpp
@@ -81,7 +81,7 @@ bool Finished::verify(const Handshake_State& state,
return true;
#else
return (m_verification_data.size() == computed_verify.size()) &&
- same_mem(m_verification_data.data(), computed_verify.data(), computed_verify.size());
+ constant_time_compare(m_verification_data.data(), computed_verify.data(), computed_verify.size());
#endif
}
diff --git a/src/lib/tls/tls_cbc/tls_cbc.cpp b/src/lib/tls/tls_cbc/tls_cbc.cpp
index e63893d75..244ddfb99 100644
--- a/src/lib/tls/tls_cbc/tls_cbc.cpp
+++ b/src/lib/tls/tls_cbc/tls_cbc.cpp
@@ -397,7 +397,7 @@ void TLS_CBC_HMAC_AEAD_Decryption::finish(secure_vector<uint8_t>& buffer, size_t
const size_t mac_offset = enc_size;
- const bool mac_ok = same_mem(&record_contents[mac_offset], mac_buf.data(), tag_size());
+ const bool mac_ok = constant_time_compare(&record_contents[mac_offset], mac_buf.data(), tag_size());
if(!mac_ok)
{
@@ -459,7 +459,7 @@ void TLS_CBC_HMAC_AEAD_Decryption::finish(secure_vector<uint8_t>& buffer, size_t
const size_t mac_offset = record_len - (tag_size() + pad_size);
- const bool mac_ok = same_mem(&record_contents[mac_offset], mac_buf.data(), tag_size());
+ const bool mac_ok = constant_time_compare(&record_contents[mac_offset], mac_buf.data(), tag_size());
const uint16_t ok_mask = size_ok_mask & CT::expand_mask<uint16_t>(mac_ok) & CT::expand_mask<uint16_t>(pad_size);