diff options
author | Jack Lloyd <[email protected]> | 2017-09-16 14:45:52 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2017-09-16 14:45:52 -0400 |
commit | 83932f30ff02d285c8a7e2a363601f460d55d268 (patch) | |
tree | 4bb4a54d89c8584bea8fa19774e9e22ae77278cf /src/lib/modes | |
parent | f39aa7bb4e43e27b10d3f890da7ba1acba9f14ca (diff) |
Use constant_time_compare instead of same_mem
New name, same great operation
Diffstat (limited to 'src/lib/modes')
-rw-r--r-- | src/lib/modes/aead/ccm/ccm.cpp | 2 | ||||
-rw-r--r-- | src/lib/modes/aead/chacha20poly1305/chacha20poly1305.cpp | 2 | ||||
-rw-r--r-- | src/lib/modes/aead/eax/eax.cpp | 2 | ||||
-rw-r--r-- | src/lib/modes/aead/gcm/gcm.cpp | 2 | ||||
-rw-r--r-- | src/lib/modes/aead/ocb/ocb.cpp | 2 |
5 files changed, 5 insertions, 5 deletions
diff --git a/src/lib/modes/aead/ccm/ccm.cpp b/src/lib/modes/aead/ccm/ccm.cpp index b7f81e5ab..5a1de4908 100644 --- a/src/lib/modes/aead/ccm/ccm.cpp +++ b/src/lib/modes/aead/ccm/ccm.cpp @@ -260,7 +260,7 @@ void CCM_Decryption::finish(secure_vector<uint8_t>& buffer, size_t offset) T ^= S0; - if(!same_mem(T.data(), buf_end, tag_size())) + if(!constant_time_compare(T.data(), buf_end, tag_size())) throw Integrity_Failure("CCM tag check failed"); buffer.resize(buffer.size() - tag_size()); diff --git a/src/lib/modes/aead/chacha20poly1305/chacha20poly1305.cpp b/src/lib/modes/aead/chacha20poly1305/chacha20poly1305.cpp index 64169a9b8..e1fd4978c 100644 --- a/src/lib/modes/aead/chacha20poly1305/chacha20poly1305.cpp +++ b/src/lib/modes/aead/chacha20poly1305/chacha20poly1305.cpp @@ -157,7 +157,7 @@ void ChaCha20Poly1305_Decryption::finish(secure_vector<uint8_t>& buffer, size_t m_ctext_len = 0; - if(!same_mem(mac.data(), included_tag, tag_size())) + if(!constant_time_compare(mac.data(), included_tag, tag_size())) throw Integrity_Failure("ChaCha20Poly1305 tag check failed"); buffer.resize(offset + remaining); } diff --git a/src/lib/modes/aead/eax/eax.cpp b/src/lib/modes/aead/eax/eax.cpp index 4889ac21a..66cd90151 100644 --- a/src/lib/modes/aead/eax/eax.cpp +++ b/src/lib/modes/aead/eax/eax.cpp @@ -169,7 +169,7 @@ void EAX_Decryption::finish(secure_vector<uint8_t>& buffer, size_t offset) mac ^= m_ad_mac; - if(!same_mem(mac.data(), included_tag, tag_size())) + if(!constant_time_compare(mac.data(), included_tag, tag_size())) throw Integrity_Failure("EAX tag check failed"); buffer.resize(offset + remaining); diff --git a/src/lib/modes/aead/gcm/gcm.cpp b/src/lib/modes/aead/gcm/gcm.cpp index becd3484b..9c6a85282 100644 --- a/src/lib/modes/aead/gcm/gcm.cpp +++ b/src/lib/modes/aead/gcm/gcm.cpp @@ -317,7 +317,7 @@ void GCM_Decryption::finish(secure_vector<uint8_t>& buffer, size_t offset) const uint8_t* included_tag = &buffer[remaining+offset]; - if(!same_mem(mac.data(), included_tag, tag_size())) + if(!constant_time_compare(mac.data(), included_tag, tag_size())) throw Integrity_Failure("GCM tag check failed"); buffer.resize(offset + remaining); diff --git a/src/lib/modes/aead/ocb/ocb.cpp b/src/lib/modes/aead/ocb/ocb.cpp index aa8532526..4e1076cba 100644 --- a/src/lib/modes/aead/ocb/ocb.cpp +++ b/src/lib/modes/aead/ocb/ocb.cpp @@ -409,7 +409,7 @@ void OCB_Decryption::finish(secure_vector<uint8_t>& buffer, size_t offset) // compare mac const uint8_t* included_tag = &buf[remaining]; - if(!same_mem(mac.data(), included_tag, tag_size())) + if(!constant_time_compare(mac.data(), included_tag, tag_size())) throw Integrity_Failure("OCB tag check failed"); // remove tag from end of message |