From 060dfe1a693940fff31616570166be7f53b49ad8 Mon Sep 17 00:00:00 2001 From: Marco Oliverio Date: Tue, 28 Jun 2022 12:10:18 +0200 Subject: [PATCH] server: fix wrong minVersion setting when non in dtls --- examples/server/server.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/examples/server/server.c b/examples/server/server.c index fb1388fea..406fb422b 100644 --- a/examples/server/server.c +++ b/examples/server/server.c @@ -2328,16 +2328,18 @@ THREAD_RETURN WOLFSSL_THREAD server_test(void* args) if (minVersion != SERVER_INVALID_VERSION) { #ifdef WOLFSSL_DTLS13 - switch (minVersion) { - case 4: - minVersion = WOLFSSL_DTLSV1_3; - break; - case 3: - minVersion = WOLFSSL_DTLSV1_2; - break; - case 2: - minVersion = WOLFSSL_DTLSV1; - break; + if (wolfSSL_dtls(ssl)) { + switch (minVersion) { + case 4: + minVersion = WOLFSSL_DTLSV1_3; + break; + case 3: + minVersion = WOLFSSL_DTLSV1_2; + break; + case 2: + minVersion = WOLFSSL_DTLSV1; + break; + } } #endif /* WOLFSSL_DTLS13 */ wolfSSL_CTX_SetMinVersion(ctx, minVersion);