-
Notifications
You must be signed in to change notification settings - Fork 637
Use additional OpensslCredentials_t parameter for hostname checking. #1819
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -244,12 +244,15 @@ static OpensslStatus_t tlsHandshake( const ServerInfo_t * pServerInfo, | |
int32_t sslStatus = -1, verifyPeerCertStatus = X509_V_OK; | ||
|
||
/* Validate the hostname against the server's certificate. */ | ||
sslStatus = SSL_set1_host( pOpensslParams->pSsl, pServerInfo->pHostName ); | ||
|
||
if( sslStatus != 1 ) | ||
if( pOpensslCredentials->disableHostnameCheck == 0U ) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would prefer that we add a separate connect() function which takes a sockaddr_in rather than a hostname. This would encourage the use of SNI whenever possible. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But I think just checking for pOpensslCredentials->sniHostName != NULL should be sufficient here. |
||
{ | ||
LogError( ( "SSL_set1_host failed to set the hostname to validate." ) ); | ||
returnStatus = OPENSSL_API_ERROR; | ||
sslStatus = SSL_set1_host( pOpensslParams->pSsl, pServerInfo->pHostName ); | ||
|
||
if( sslStatus != 1 ) | ||
{ | ||
LogError( ( "SSL_set1_host failed to set the hostname to validate." ) ); | ||
returnStatus = OPENSSL_API_ERROR; | ||
} | ||
} | ||
|
||
/* Enable SSL peer verification. */ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sniHostName == NULL should result in SNI being disabled rather than an explicit disableHostnameCheck.