aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/pk_pad
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/pk_pad
parentf39aa7bb4e43e27b10d3f890da7ba1acba9f14ca (diff)
Use constant_time_compare instead of same_mem
New name, same great operation
Diffstat (limited to 'src/lib/pk_pad')
-rw-r--r--src/lib/pk_pad/eme_oaep/oaep.cpp2
-rw-r--r--src/lib/pk_pad/emsa1/emsa1.cpp2
-rw-r--r--src/lib/pk_pad/emsa_pssr/pssr.cpp2
-rw-r--r--src/lib/pk_pad/emsa_raw/emsa_raw.cpp2
-rw-r--r--src/lib/pk_pad/iso9796/iso9796.cpp2
5 files changed, 5 insertions, 5 deletions
diff --git a/src/lib/pk_pad/eme_oaep/oaep.cpp b/src/lib/pk_pad/eme_oaep/oaep.cpp
index ef2fb81bb..71f5c14e0 100644
--- a/src/lib/pk_pad/eme_oaep/oaep.cpp
+++ b/src/lib/pk_pad/eme_oaep/oaep.cpp
@@ -106,7 +106,7 @@ secure_vector<uint8_t> OAEP::unpad(uint8_t& valid_mask,
// If we never saw any non-zero byte, then it's not valid input
bad_input |= waiting_for_delim;
- bad_input |= CT::is_equal<uint8_t>(same_mem(&input[hlen], m_Phash.data(), hlen), false);
+ bad_input |= CT::is_equal<uint8_t>(constant_time_compare(&input[hlen], m_Phash.data(), hlen), false);
CT::unpoison(input.data(), input.size());
CT::unpoison(&bad_input, 1);
diff --git a/src/lib/pk_pad/emsa1/emsa1.cpp b/src/lib/pk_pad/emsa1/emsa1.cpp
index 82c3b86a7..e3580ff93 100644
--- a/src/lib/pk_pad/emsa1/emsa1.cpp
+++ b/src/lib/pk_pad/emsa1/emsa1.cpp
@@ -85,7 +85,7 @@ bool EMSA1::verify(const secure_vector<uint8_t>& input,
if(our_coding[i] != 0)
return false;
- return same_mem(input.data(), &our_coding[offset], input.size());
+ return constant_time_compare(input.data(), &our_coding[offset], input.size());
}
catch(Invalid_Argument)
{
diff --git a/src/lib/pk_pad/emsa_pssr/pssr.cpp b/src/lib/pk_pad/emsa_pssr/pssr.cpp
index 5f76b5a6f..65ee5a145 100644
--- a/src/lib/pk_pad/emsa_pssr/pssr.cpp
+++ b/src/lib/pk_pad/emsa_pssr/pssr.cpp
@@ -122,7 +122,7 @@ bool PSSR::verify(const secure_vector<uint8_t>& const_coded,
m_hash->update(&DB[salt_offset], DB_size - salt_offset);
secure_vector<uint8_t> H2 = m_hash->final();
- return same_mem(H, H2.data(), HASH_SIZE);
+ return constant_time_compare(H, H2.data(), HASH_SIZE);
}
PSSR::PSSR(HashFunction* h) :
diff --git a/src/lib/pk_pad/emsa_raw/emsa_raw.cpp b/src/lib/pk_pad/emsa_raw/emsa_raw.cpp
index bae7b2d04..cf2426298 100644
--- a/src/lib/pk_pad/emsa_raw/emsa_raw.cpp
+++ b/src/lib/pk_pad/emsa_raw/emsa_raw.cpp
@@ -75,7 +75,7 @@ bool EMSA_Raw::verify(const secure_vector<uint8_t>& coded,
if(raw[i])
same_modulo_leading_zeros = false;
- if(!same_mem(coded.data(), raw.data() + leading_zeros_expected, coded.size()))
+ if(!constant_time_compare(coded.data(), raw.data() + leading_zeros_expected, coded.size()))
same_modulo_leading_zeros = false;
return same_modulo_leading_zeros;
diff --git a/src/lib/pk_pad/iso9796/iso9796.cpp b/src/lib/pk_pad/iso9796/iso9796.cpp
index 6dcae799a..8608e7239 100644
--- a/src/lib/pk_pad/iso9796/iso9796.cpp
+++ b/src/lib/pk_pad/iso9796/iso9796.cpp
@@ -202,7 +202,7 @@ bool iso9796_verification(const secure_vector<uint8_t>& const_coded,
secure_vector<uint8_t> H2 = hash->final();
//check if H3 == H2
- bad_input |= CT::is_equal<uint8_t>(same_mem(H3.data(), H2.data(), HASH_SIZE), false);
+ bad_input |= CT::is_equal<uint8_t>(constant_time_compare(H3.data(), H2.data(), HASH_SIZE), false);
CT::unpoison(bad_input);
return (bad_input == 0);