aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/vmime/security/cert/openssl/X509Certificate_OpenSSL.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/vmime/security/cert/openssl/X509Certificate_OpenSSL.cpp b/src/vmime/security/cert/openssl/X509Certificate_OpenSSL.cpp
index 5df8703c..c949ab03 100644
--- a/src/vmime/security/cert/openssl/X509Certificate_OpenSSL.cpp
+++ b/src/vmime/security/cert/openssl/X509Certificate_OpenSSL.cpp
@@ -437,7 +437,11 @@ bool X509Certificate_OpenSSL::verifyHostName(
char CNBuffer[1024];
CNBuffer[sizeof(CNBuffer) - 1] = '\0';
+#if OPENSSL_VERSION_NUMBER >= 0x30000000L
+ const X509_NAME* xname = X509_get_subject_name(m_data->cert);
+#else
X509_NAME* xname = X509_get_subject_name(m_data->cert);
+#endif
if (X509_NAME_get_text_by_NID(xname, NID_commonName, CNBuffer, sizeof(CNBuffer)) != -1) {
@@ -468,7 +472,11 @@ bool X509Certificate_OpenSSL::verifyHostName(
if (currentName->type == GEN_DNS) {
// Current name is a DNS name, let's check it
- char *DNSName = (char *) ASN1_STRING_data(currentName->d.dNSName);
+#if OPENSSL_VERSION_NUMBER >= 0x10100000L
+ const char *DNSName = (const char *) ASN1_STRING_get0_data(currentName->d.dNSName);
+#else
+ const char *DNSName = (const char *) ASN1_STRING_data(currentName->d.dNSName);
+#endif
// Make sure there isn't an embedded NUL character in the DNS name
if (ASN1_STRING_length(currentName->d.dNSName) != strlen(DNSName)) {