diff options
| author | Carl Hetherington <cth@carlh.net> | 2016-11-10 09:53:52 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2016-11-10 11:22:37 +0000 |
| commit | f3f25108a1ea5ef90e6fc172dca56cf55befe772 (patch) | |
| tree | 17d46abe41b323bcf50504a950b6affecbc319e8 /src/certificate_chain.cc | |
| parent | 4c2fb8ea9d3c02ea5243122201eb8282daac5adb (diff) | |
Fix build with OpenSSL 1.1 and later.
Diffstat (limited to 'src/certificate_chain.cc')
| -rw-r--r-- | src/certificate_chain.cc | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/certificate_chain.cc b/src/certificate_chain.cc index 29ae7feb..f06b2c3e 100644 --- a/src/certificate_chain.cc +++ b/src/certificate_chain.cc @@ -51,6 +51,7 @@ #include <openssl/bio.h> #include <openssl/evp.h> #include <openssl/pem.h> +#include <openssl/rsa.h> #include <boost/filesystem.hpp> #include <boost/algorithm/string.hpp> #include <boost/foreach.hpp> @@ -463,7 +464,17 @@ CertificateChain::valid () const RSA* private_key = PEM_read_bio_RSAPrivateKey (bio, 0, 0, 0); RSA* public_key = leaf().public_key (); + +#if OPENSSL_VERSION_NUMBER > 0x10100000L +#warning "Using new OpenSSL API" + BIGNUM const * private_key_n; + RSA_get0_key(private_key, &private_key_n, 0, 0); + BIGNUM const * public_key_n; + RSA_get0_key(public_key, &public_key_n, 0, 0); + bool const valid = !BN_cmp (private_key_n, public_key_n); +#else bool const valid = !BN_cmp (private_key->n, public_key->n); +#endif BIO_free (bio); return valid; |
