forked from wolfSSL/wolfssl
Only clear session when we didn't complete a handshake
- Allow overriding buffer size with `WOLFSSL_MSG_EX_BUF_SZ` - Allow disabling `WOLFSSL_MSG_EX` by defining `NO_WOLFSSL_MSG_EX`
This commit is contained in:
15
src/ssl.c
15
src/ssl.c
@@ -17976,6 +17976,15 @@ size_t wolfSSL_get_client_random(const WOLFSSL* ssl, unsigned char* out,
|
||||
return WOLFSSL_FAILURE;
|
||||
}
|
||||
|
||||
if (!ssl->options.handShakeDone) {
|
||||
/* Only reset the session if we didn't complete a handshake */
|
||||
wolfSSL_SESSION_free(ssl->session);
|
||||
ssl->session = wolfSSL_NewSession(ssl->heap);
|
||||
if (ssl->session == NULL) {
|
||||
return WOLFSSL_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
ssl->options.isClosed = 0;
|
||||
ssl->options.connReset = 0;
|
||||
ssl->options.sentNotify = 0;
|
||||
@@ -18000,12 +18009,6 @@ size_t wolfSSL_get_client_random(const WOLFSSL* ssl, unsigned char* out,
|
||||
InitX509(&ssl->peerCert, 0, ssl->heap);
|
||||
#endif
|
||||
|
||||
wolfSSL_SESSION_free(ssl->session);
|
||||
ssl->session = wolfSSL_NewSession(ssl->heap);
|
||||
if (ssl->session == NULL) {
|
||||
return WOLFSSL_FAILURE;
|
||||
}
|
||||
|
||||
return WOLFSSL_SUCCESS;
|
||||
}
|
||||
|
||||
|
@@ -364,16 +364,20 @@ static void wolfssl_log(const int logLevel, const char *const logMessage)
|
||||
}
|
||||
|
||||
#ifndef WOLFSSL_DEBUG_ERRORS_ONLY
|
||||
|
||||
#if !defined(_WIN32) && defined(XVSNPRINTF) && !defined(NO_WOLFSSL_MSG_EX)
|
||||
#include <stdarg.h> /* for var args */
|
||||
#ifndef WOLFSSL_MSG_EX_BUF_SZ
|
||||
#define WOLFSSL_MSG_EX_BUF_SZ 100
|
||||
#endif
|
||||
#ifdef __clang__
|
||||
/* tell clang argument 1 is format */
|
||||
__attribute__((__format__ (__printf__, 1, 0)))
|
||||
#endif
|
||||
#if !defined(_WIN32) && defined(XVSNPRINTF)
|
||||
#include <stdarg.h> /* for var args */
|
||||
void WOLFSSL_MSG_EX(const char* fmt, ...)
|
||||
{
|
||||
if (loggingEnabled) {
|
||||
char msg[100];
|
||||
char msg[WOLFSSL_MSG_EX_BUF_SZ];
|
||||
int written;
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
|
Reference in New Issue
Block a user