diff options
Diffstat (limited to 'src/lib/pubkey')
-rw-r--r-- | src/lib/pubkey/dlies/dlies.cpp | 2 | ||||
-rw-r--r-- | src/lib/pubkey/ecies/ecies.cpp | 2 | ||||
-rw-r--r-- | src/lib/pubkey/ed25519/ed25519.cpp | 2 | ||||
-rw-r--r-- | src/lib/pubkey/sm2/sm2_enc.cpp | 2 |
4 files changed, 4 insertions, 4 deletions
diff --git a/src/lib/pubkey/dlies/dlies.cpp b/src/lib/pubkey/dlies/dlies.cpp index a4171a55f..a4603f0d7 100644 --- a/src/lib/pubkey/dlies/dlies.cpp +++ b/src/lib/pubkey/dlies/dlies.cpp @@ -175,7 +175,7 @@ secure_vector<uint8_t> DLIES_Decryptor::do_decrypt(uint8_t& valid_mask, secure_vector<uint8_t> tag(msg + m_pub_key_size + ciphertext_len, msg + m_pub_key_size + ciphertext_len + m_mac->output_length()); - valid_mask = CT::expand_mask<uint8_t>(same_mem(tag.data(), calculated_tag.data(), tag.size())); + valid_mask = CT::expand_mask<uint8_t>(constant_time_compare(tag.data(), calculated_tag.data(), tag.size())); // decrypt if(m_cipher) diff --git a/src/lib/pubkey/ecies/ecies.cpp b/src/lib/pubkey/ecies/ecies.cpp index df676cfb3..b8fcea64b 100644 --- a/src/lib/pubkey/ecies/ecies.cpp +++ b/src/lib/pubkey/ecies/ecies.cpp @@ -363,7 +363,7 @@ secure_vector<uint8_t> ECIES_Decryptor::do_decrypt(uint8_t& valid_mask, const ui mac->update(m_label); } const secure_vector<uint8_t> calculated_mac = mac->final(); - valid_mask = CT::expand_mask<uint8_t>(same_mem(mac_data.data(), calculated_mac.data(), mac_data.size())); + valid_mask = CT::expand_mask<uint8_t>(constant_time_compare(mac_data.data(), calculated_mac.data(), mac_data.size())); if(valid_mask) { diff --git a/src/lib/pubkey/ed25519/ed25519.cpp b/src/lib/pubkey/ed25519/ed25519.cpp index 13f75ac3b..5c9bd2b3d 100644 --- a/src/lib/pubkey/ed25519/ed25519.cpp +++ b/src/lib/pubkey/ed25519/ed25519.cpp @@ -90,7 +90,7 @@ bool ed25519_verify(const uint8_t* m, size_t mlen, ge_double_scalarmult_vartime(rcheck, h, &A, sig + 32); - return same_mem(rcheck, sig, 32); + return constant_time_compare(rcheck, sig, 32); } } diff --git a/src/lib/pubkey/sm2/sm2_enc.cpp b/src/lib/pubkey/sm2/sm2_enc.cpp index b05ce12da..aca31941d 100644 --- a/src/lib/pubkey/sm2/sm2_enc.cpp +++ b/src/lib/pubkey/sm2/sm2_enc.cpp @@ -190,7 +190,7 @@ class SM2_Decryption_Operation : public PK_Ops::Decryption hash->update(y2_bytes); secure_vector<uint8_t> u = hash->final(); - if(same_mem(u.data(), ciphertext + (1+p_bytes*2), hash->output_length()) == false) + if(constant_time_compare(u.data(), ciphertext + (1+p_bytes*2), hash->output_length()) == false) return secure_vector<uint8_t>(); valid_mask = 0xFF; |