Build for whichever openssl.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3422 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
Cory McWilliams 2019-09-29 21:05:49 +00:00
parent 7753c4567d
commit c7b13dd1ae

View File

@ -279,9 +279,13 @@ bool TlsSession_openssl::verifyHostname(X509* certificate, const char* hostname)
int count = sk_GENERAL_NAME_num(names);
for (int i = 0; i < count; ++i) {
const GENERAL_NAME* check = sk_GENERAL_NAME_value(names, i);
#if OPENSSL_VERSION_NUMBER <= 0x1000211fL
const unsigned char* name = ASN1_STRING_data(check->d.ia5);
#else
const char* name = ASN1_STRING_get0_data(check->d.ia5);
#endif
size_t length = ASN1_STRING_length(check->d.ia5);
if (wildcardMatch(std::string(name, length).c_str(), hostname)) {
if (wildcardMatch(std::string((const char*)name, length).c_str(), hostname)) {
verified = true;
break;
}
@ -295,9 +299,13 @@ bool TlsSession_openssl::verifyHostname(X509* certificate, const char* hostname)
if (entry) {
ASN1_STRING* asn1 = X509_NAME_ENTRY_get_data(entry);
if (asn1) {
#if OPENSSL_VERSION_NUMBER <= 0x1000211fL
const unsigned char* commonName = ASN1_STRING_data(asn1);
#else
const char* commonName = ASN1_STRING_get0_data(asn1);
if (static_cast<size_t>(ASN1_STRING_length(asn1)) == std::strlen(commonName)) {
verified = wildcardMatch(commonName, hostname);
#endif
if (static_cast<size_t>(ASN1_STRING_length(asn1)) == std::strlen((const char*)commonName)) {
verified = wildcardMatch((const char*)commonName, hostname);
}
}
}