diff --git a/src/ssl.c b/src/ssl.c index cf53a5a06..8d45ebd13 100644 --- a/src/ssl.c +++ b/src/ssl.c @@ -10476,9 +10476,11 @@ int wolfSSL_set_session_secret_cb(WOLFSSL* ssl, SessionSecretCb cb, void* ctx) ssl->sessionSecretCb = cb; ssl->sessionSecretCtx = ctx; - /* If using a pre-set key, assume session resumption. */ - ssl->session->sessionIDSz = 0; - ssl->options.resuming = 1; + if (cb != NULL) { + /* If using a pre-set key, assume session resumption. */ + ssl->session->sessionIDSz = 0; + ssl->options.resuming = 1; + } return WOLFSSL_SUCCESS; }