[cpp-xmltooling] 02/02: CPPXT-137 OpenSSL 1.1.1

Rod Widdowson rdw at steadingsoftware.com
Sat Oct 13 12:24:02 EDT 2018


This is an automated email from the git hooks/post-receive script.

rdw pushed a commit to branch master
in repository cpp-xmltooling.

View the commit online:
http://git.shibboleth.net/view/?p=cpp-xmltooling.git;a=commit;h=6feb1baf4f80210e9222d817664c9c792d7979fe

commit 6feb1baf4f80210e9222d817664c9c792d7979fe
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Sat Oct 13 14:21:35 2018 +0100

    CPPXT-137 OpenSSL 1.1.1
    
    https://issues.shibboleth.net/jira/browse/CPPXT-137
    
    OpenSSL 1.1.1 defined functions that we defined for 1.1.0.
    Fix the compile by being explicit about the namespace and
    add use of the new functions to the support module.
---
 xmltooling/security/impl/OpenSSLSecurityHelper.cpp |  4 ++--
 xmltooling/security/impl/OpenSSLSupport.cpp        | 20 +++++++++++++++-----
 2 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/xmltooling/security/impl/OpenSSLSecurityHelper.cpp b/xmltooling/security/impl/OpenSSLSecurityHelper.cpp
index 624e1b4..bca739b 100644
--- a/xmltooling/security/impl/OpenSSLSecurityHelper.cpp
+++ b/xmltooling/security/impl/OpenSSLSecurityHelper.cpp
@@ -50,7 +50,7 @@ bool OpenSSLSecurityHelper::matchesPublic(const RSA* rsa, const XSECCryptoKey& k
         return false;
 
     const RSA* rsa1 = static_cast<const OpenSSLCryptoKeyRSA&>(key).getOpenSSLRSA();
-    return (rsa1 && rsa && BN_cmp(RSA_get0_n(rsa1), RSA_get0_n(rsa)) == 0 && BN_cmp(RSA_get0_e(rsa1), RSA_get0_e(rsa)) == 0);
+    return (rsa1 && rsa && BN_cmp(xmltooling::RSA_get0_n(rsa1), xmltooling::RSA_get0_n(rsa)) == 0 && BN_cmp(xmltooling::RSA_get0_e(rsa1), xmltooling::RSA_get0_e(rsa)) == 0);
 }
 bool OpenSSLSecurityHelper::matchesPrivate(const RSA* rsa, const XSECCryptoKey& key)
 {
@@ -59,7 +59,7 @@ bool OpenSSLSecurityHelper::matchesPrivate(const RSA* rsa, const XSECCryptoKey&
         return false;
 
     const RSA* rsa2 = static_cast<const OpenSSLCryptoKeyRSA&>(key).getOpenSSLRSA();
-    return (rsa && rsa2 && BN_cmp(RSA_get0_n(rsa), RSA_get0_n(rsa2)) == 0 && BN_cmp(RSA_get0_d(rsa), RSA_get0_d(rsa2)) == 0);
+    return (rsa && rsa2 && BN_cmp(xmltooling::RSA_get0_n(rsa), xmltooling::RSA_get0_n(rsa2)) == 0 && BN_cmp(xmltooling::RSA_get0_d(rsa), xmltooling::RSA_get0_d(rsa2)) == 0);
 }
 bool OpenSSLSecurityHelper::matchesPublic(const DSA* dsa, const XSECCryptoKey& key)
 {
diff --git a/xmltooling/security/impl/OpenSSLSupport.cpp b/xmltooling/security/impl/OpenSSLSupport.cpp
index ab9fe00..e10e0c8 100644
--- a/xmltooling/security/impl/OpenSSLSupport.cpp
+++ b/xmltooling/security/impl/OpenSSLSupport.cpp
@@ -73,10 +73,12 @@ const BIGNUM *xmltooling::DSA_get0_pubkey(const DSA *dsa)
 {
 #if (OPENSSL_VERSION_NUMBER < 0x10100000L)
     return dsa->pub_key;
-#else
+#elif (OPENSSL_VERSION_NUMBER  < 0x10101000L)
     const BIGNUM *result;
     DSA_get0_key(dsa, &result, NULL);
     return result;
+#else
+    return ::DSA_get0_pub_key(dsa);
 #endif
 }
 
@@ -84,10 +86,12 @@ const BIGNUM *xmltooling::DSA_get0_privkey(const DSA *dsa)
 {
 #if (OPENSSL_VERSION_NUMBER < 0x10100000L)
     return dsa->priv_key;
-#else
+#elif (OPENSSL_VERSION_NUMBER  < 0x10101000L)
     const BIGNUM *result;
     DSA_get0_key(dsa, NULL, &result);
     return result;
+#else
+    return ::DSA_get0_priv_key(dsa);
 #endif
 }
 
@@ -95,10 +99,12 @@ const BIGNUM *xmltooling::RSA_get0_n(const RSA *rsa)
 {
 #if (OPENSSL_VERSION_NUMBER < 0x10100000L)
     return rsa->n;
-#else
+#elif (OPENSSL_VERSION_NUMBER  < 0x10101000L)
     const BIGNUM *result;
     RSA_get0_key(rsa, &result, NULL, NULL);
     return result;
+#else
+    return ::RSA_get0_n(rsa);
 #endif
 }
 
@@ -106,10 +112,12 @@ const BIGNUM *xmltooling::RSA_get0_e(const RSA *rsa)
 {
 #if (OPENSSL_VERSION_NUMBER < 0x10100000L)
     return rsa->e;
-#else
+#elif (OPENSSL_VERSION_NUMBER  < 0x10101000L)
     const BIGNUM *result;
     RSA_get0_key(rsa, NULL, &result, NULL);
     return result;
+#else
+    return ::RSA_get0_e(rsa);
 #endif
 }
 
@@ -117,9 +125,11 @@ const BIGNUM *xmltooling::RSA_get0_d(const RSA *rsa)
 {
 #if (OPENSSL_VERSION_NUMBER < 0x10100000L)
     return rsa->d;
-#else
+#elif (OPENSSL_VERSION_NUMBER  < 0x10101000L)
     const BIGNUM *result;
     RSA_get0_key(rsa, NULL, NULL, &result);
     return result;
+#else
+    return ::RSA_get0_d(rsa);
 #endif
 }

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list