Merge pull request #6455 from lealem47/INIT_SSL_NO_CTX_KEY

Allow option to create SSL without key/cert in ctx
This commit is contained in:
David Garske
2023-06-30 10:35:52 -07:00
committed by GitHub
2 changed files with 10 additions and 3 deletions

View File

@@ -89,6 +89,9 @@
* - WOLFSSL_HARDEN_TLS_NO_SCR_CHECK
* - WOLFSSL_HARDEN_TLS_NO_PKEY_CHECK
* - WOLFSSL_HARDEN_TLS_ALLOW_ALL_CIPHERSUITES
* WOLFSSL_NO_INIT_CTX_KEY
* Allows SSL objects to be created from a CTX without a loaded key/cert
* pair
*/
@@ -7082,9 +7085,13 @@ int InitSSL(WOLFSSL* ssl, WOLFSSL_CTX* ctx, int writeDup)
/* Initialize SSL with the appropriate fields from it's ctx */
/* requires valid arrays and suites unless writeDup ing */
if ((ret = SetSSL_CTX(ssl, ctx, writeDup)) != WOLFSSL_SUCCESS)
if ((ret = SetSSL_CTX(ssl, ctx, writeDup)) != WOLFSSL_SUCCESS
#ifdef WOLFSSL_NO_INIT_CTX_KEY
&& ret != NO_PRIVATE_KEY
#endif
) {
return ret;
}
ssl->options.dtls = ssl->version.major == DTLS_MAJOR;
#ifdef HAVE_WRITE_DUP

View File

@@ -3785,7 +3785,7 @@ static int test_server_wolfSSL_new(void)
/* invalid context */
ExpectNull(ssl = wolfSSL_new(NULL));
#if !defined(WOLFSSL_SESSION_EXPORT) && !defined(WOLFSSL_QT) && \
!defined(OPENSSL_EXTRA)
!defined(OPENSSL_EXTRA) && !defined(WOLFSSL_NO_INIT_CTX_KEY)
ExpectNull(ssl = wolfSSL_new(ctx_nocert));
#endif