diff options
author | Jack Lloyd <[email protected]> | 2018-08-10 12:44:55 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2018-08-10 12:44:55 -0400 |
commit | 87e4cd8c71511837b38406802f6e92e32b1890e9 (patch) | |
tree | 000aed5da6cfabd3009937a88cafb959f3988ea1 /src/lib/prov/openssl | |
parent | 256cfa3be098fb45d5c2de047f88786e88051e73 (diff) |
Add functions to get size of PK ciphertext,plaintext
Needed for https://github.com/strongswan/strongswan/pull/109
Diffstat (limited to 'src/lib/prov/openssl')
-rw-r--r-- | src/lib/prov/openssl/openssl_ec.cpp | 2 | ||||
-rw-r--r-- | src/lib/prov/openssl/openssl_rsa.cpp | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/src/lib/prov/openssl/openssl_ec.cpp b/src/lib/prov/openssl/openssl_ec.cpp index 33f277d5a..5da466c0c 100644 --- a/src/lib/prov/openssl/openssl_ec.cpp +++ b/src/lib/prov/openssl/openssl_ec.cpp @@ -232,7 +232,7 @@ class OpenSSL_ECDSA_Signing_Operation final : public PK_Ops::Signature_with_EMSA m_order_bytes = (m_order_bits + 7) / 8; } - size_t signature_length() const { return 2*m_order_bytes; } + size_t signature_length() const override { return 2*m_order_bytes; } secure_vector<uint8_t> raw_sign(const uint8_t msg[], size_t msg_len, RandomNumberGenerator&) override diff --git a/src/lib/prov/openssl/openssl_rsa.cpp b/src/lib/prov/openssl/openssl_rsa.cpp index cf9c2b52b..8108526a1 100644 --- a/src/lib/prov/openssl/openssl_rsa.cpp +++ b/src/lib/prov/openssl/openssl_rsa.cpp @@ -57,6 +57,8 @@ class OpenSSL_RSA_Encryption_Operation final : public PK_Ops::Encryption m_bits = 8 * (n_size() - pad_overhead) - 1; } + size_t ciphertext_length(size_t) const override { return ::RSA_size(m_openssl_rsa.get()); } + size_t max_input_bits() const override { return m_bits; }; secure_vector<uint8_t> encrypt(const uint8_t msg[], size_t msg_len, @@ -110,6 +112,8 @@ class OpenSSL_RSA_Decryption_Operation final : public PK_Ops::Decryption throw OpenSSL_Error("d2i_RSAPrivateKey"); } + size_t plaintext_length(size_t) const override { return ::RSA_size(m_openssl_rsa.get()); } + secure_vector<uint8_t> decrypt(uint8_t& valid_mask, const uint8_t msg[], size_t msg_len) override { |