From 63b4c475d4e637f89d08e1d6954a75c21da86971 Mon Sep 17 00:00:00 2001 From: Juliusz Sosinowicz Date: Wed, 6 Jul 2022 14:23:08 +0200 Subject: [PATCH] wolfSSL_set_session_secret_cb: fix for NULL input --- src/ssl.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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; }