diff options
author | Jay Berkenbilt <ejb@ql.org> | 2021-11-04 22:21:34 +0100 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2021-11-04 23:24:54 +0100 |
commit | 3794f8e2ad536db93ce780ae11f55d86a683c536 (patch) | |
tree | b7d3568d3fccfb24b7f126b135d4cd4fc6a4d726 /libqpdf/qpdf/QPDFCrypto_openssl.hh | |
parent | 043779187e8050673078683492dd9cbe33474cb7 (diff) | |
download | qpdf-3794f8e2ad536db93ce780ae11f55d86a683c536.tar.zst |
Support OpenSSL 3 (fixes #568)
Diffstat (limited to 'libqpdf/qpdf/QPDFCrypto_openssl.hh')
-rw-r--r-- | libqpdf/qpdf/QPDFCrypto_openssl.hh | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/libqpdf/qpdf/QPDFCrypto_openssl.hh b/libqpdf/qpdf/QPDFCrypto_openssl.hh index 58f54c3f..eb369c8a 100644 --- a/libqpdf/qpdf/QPDFCrypto_openssl.hh +++ b/libqpdf/qpdf/QPDFCrypto_openssl.hh @@ -3,6 +3,14 @@ #include <qpdf/QPDFCryptoImpl.hh> #include <string> +#if (defined(__GNUC__) || defined(__clang__)) +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wold-style-cast" +#endif +#include <openssl/opensslv.h> +#if !defined(OPENSSL_VERSION_MAJOR) || OPENSSL_VERSION_MAJOR < 3 +# define QPDF_OPENSSL_1 +#endif #include <openssl/rand.h> #ifdef OPENSSL_IS_BORINGSSL #include <openssl/cipher.h> @@ -10,6 +18,9 @@ #else #include <openssl/evp.h> #endif +#if (defined(__GNUC__) || defined(__clang__)) +# pragma GCC diagnostic pop +#endif class QPDFCrypto_openssl: public QPDFCryptoImpl { @@ -44,6 +55,13 @@ class QPDFCrypto_openssl: public QPDFCryptoImpl void rijndael_finalize() override; private: +#ifdef QPDF_OPENSSL_1 + EVP_CIPHER const* rc4; +#else + OSSL_LIB_CTX* libctx; + OSSL_PROVIDER* legacy; + EVP_CIPHER* rc4; +#endif EVP_MD_CTX* const md_ctx; EVP_CIPHER_CTX* const cipher_ctx; uint8_t md_out[EVP_MAX_MD_SIZE]; |