aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/pubkey
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2015-10-26 10:45:47 -0400
committerJack Lloyd <[email protected]>2015-10-26 10:45:47 -0400
commita3d1249709fa983829774bf5536aa114a43077bb (patch)
tree876db0b25ac9deec37c40b790870a3b58860f934 /src/lib/pubkey
parentb2da74ca508745f00bb3d6b35cbe34d5031e27e7 (diff)
Asan fix - referencing &vec[vec.size()] instead of vec.end()
Convert to a const time algo
Diffstat (limited to 'src/lib/pubkey')
-rw-r--r--src/lib/pubkey/rsa/openssl_rsa.cpp20
1 files changed, 3 insertions, 17 deletions
diff --git a/src/lib/pubkey/rsa/openssl_rsa.cpp b/src/lib/pubkey/rsa/openssl_rsa.cpp
index f2825634a..44e44b225 100644
--- a/src/lib/pubkey/rsa/openssl_rsa.cpp
+++ b/src/lib/pubkey/rsa/openssl_rsa.cpp
@@ -11,6 +11,7 @@
#include <botan/internal/openssl.h>
#include <botan/internal/pk_utils.h>
+#include <botan/internal/ct_utils.h>
#include <functional>
#include <memory>
@@ -35,22 +36,6 @@ std::pair<int, size_t> get_openssl_enc_pad(const std::string& eme)
throw Lookup_Error("OpenSSL RSA does not support EME " + eme);
}
-secure_vector<byte> strip_leading_zeros(const secure_vector<byte>& input)
- {
- size_t leading_zeros = 0;
-
- for(size_t i = 0; i != input.size(); ++i)
- {
- if(input[i] != 0)
- break;
- ++leading_zeros;
- }
-
- secure_vector<byte> output(&input[leading_zeros],
- &input[input.size()]);
- return output;
- }
-
class OpenSSL_RSA_Encryption_Operation : public PK_Ops::Encryption
{
public:
@@ -164,8 +149,9 @@ class OpenSSL_RSA_Decryption_Operation : public PK_Ops::Decryption
if(m_padding == RSA_NO_PADDING)
{
- return strip_leading_zeros(buf);
+ return CT::strip_leading_zeros(buf);
}
+
return buf;
}