From ed970e7cd8c9e4522d6c28e5494eea1405fad9e9 Mon Sep 17 00:00:00 2001 From: Juliusz Sosinowicz Date: Mon, 3 Nov 2025 16:36:49 +0100 Subject: [PATCH 1/2] Add missing WOLFSSL_HOSTNAME_VERIFY_ALT_NAME_ONLY guards --- src/internal.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/internal.c b/src/internal.c index 88caf2d73..4297e72ce 100644 --- a/src/internal.c +++ b/src/internal.c @@ -16467,6 +16467,7 @@ int ProcessPeerCerts(WOLFSSL* ssl, byte* input, word32* inOutIdx, } } else { + #ifndef WOLFSSL_HOSTNAME_VERIFY_ALT_NAME_ONLY if (MatchDomainName( args->dCert->subjectCN, args->dCert->subjectCNLen, @@ -16475,6 +16476,7 @@ int ProcessPeerCerts(WOLFSSL* ssl, byte* input, word32* inOutIdx, (word32)XSTRLEN( (const char *)ssl->buffers.domainName.buffer) ), 0) == 0) + #endif { WOLFSSL_MSG("DomainName match on common name failed"); ret = DOMAIN_NAME_MISMATCH; @@ -16483,11 +16485,13 @@ int ProcessPeerCerts(WOLFSSL* ssl, byte* input, word32* inOutIdx, } #else /* WOLFSSL_ALL_NO_CN_IN_SAN */ /* Old behavior. */ + #ifndef WOLFSSL_HOSTNAME_VERIFY_ALT_NAME_ONLY if (MatchDomainName(args->dCert->subjectCN, args->dCert->subjectCNLen, (char*)ssl->buffers.domainName.buffer, (ssl->buffers.domainName.buffer == NULL ? 0 : (word32)XSTRLEN(ssl->buffers.domainName.buffer)), 0) == 0) + #endif { WOLFSSL_MSG("DomainName match on common name failed"); if (CheckForAltNames(args->dCert, From 3ebc0c5f9984e74d06363271573497dd027de433 Mon Sep 17 00:00:00 2001 From: Juliusz Sosinowicz Date: Thu, 6 Nov 2025 16:39:48 +0100 Subject: [PATCH 2/2] Update logs --- src/internal.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/internal.c b/src/internal.c index 4297e72ce..6fff2c587 100644 --- a/src/internal.c +++ b/src/internal.c @@ -16478,7 +16478,7 @@ int ProcessPeerCerts(WOLFSSL* ssl, byte* input, word32* inOutIdx, ), 0) == 0) #endif { - WOLFSSL_MSG("DomainName match on common name failed"); + WOLFSSL_MSG("DomainName match failed"); ret = DOMAIN_NAME_MISMATCH; WOLFSSL_ERROR_VERBOSE(ret); } @@ -16493,14 +16493,12 @@ int ProcessPeerCerts(WOLFSSL* ssl, byte* input, word32* inOutIdx, (word32)XSTRLEN(ssl->buffers.domainName.buffer)), 0) == 0) #endif { - WOLFSSL_MSG("DomainName match on common name failed"); if (CheckForAltNames(args->dCert, (char*)ssl->buffers.domainName.buffer, (ssl->buffers.domainName.buffer == NULL ? 0 : (word32)XSTRLEN(ssl->buffers.domainName.buffer)), NULL, 0) != 1) { - WOLFSSL_MSG( - "DomainName match on alt names failed too"); + WOLFSSL_MSG("DomainName match failed"); /* try to get peer key still */ ret = DOMAIN_NAME_MISMATCH; WOLFSSL_ERROR_VERBOSE(ret);