aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/pubkey
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2015-10-26 12:33:05 -0400
committerJack Lloyd <[email protected]>2015-10-26 12:33:05 -0400
commit191abfe7c95d79118f0f9b4ed6411796204c0db3 (patch)
tree672470d35a08dedac63c901f843e113d3088960e /src/lib/pubkey
parent475a9dacb8d285d6e5a0244bcf816d2ae72a00a8 (diff)
parent05ca920f0d8461b7da258f4e17afbf3d072b9327 (diff)
Merge pull request #314 from randombit/ct-tls-cbc-padding
TLS improvements
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;
}