do nothing when version is zero

This commit is contained in:
Hideki Miyazaki
2021-04-25 10:25:56 +09:00
parent 3b070e1bd0
commit 6d381a6c7f
2 changed files with 14 additions and 0 deletions

View File

@ -46251,9 +46251,17 @@ long wolfSSL_CTX_ctrl(WOLFSSL_CTX* ctx, int cmd, long opt, void* pt)
break;
case SSL_CTRL_SET_MIN_PROTO_VERSION:
WOLFSSL_MSG("set min proto version");
if (opt == 0) {
/* do nothing */
return WOLFSSL_SUCCESS;
}
return wolfSSL_CTX_set_min_proto_version(ctx, (int)opt);
case SSL_CTRL_SET_MAX_PROTO_VERSION:
WOLFSSL_MSG("set max proto version");
if (opt == 0) {
/* do nothing */
return WOLFSSL_SUCCESS;
}
return wolfSSL_CTX_set_max_proto_version(ctx, (int)opt);
default:
WOLFSSL_MSG("CTX_ctrl cmd not implemented");

View File

@ -35940,11 +35940,17 @@ static void test_wolfSSL_CTX_ctrl(void)
/* Test for min/max proto */
#ifndef WOLFSSL_NO_TLS12
AssertIntEQ((int)wolfSSL_CTX_ctrl(ctx, SSL_CTRL_SET_MIN_PROTO_VERSION,
0, NULL), SSL_SUCCESS);
AssertIntEQ((int)wolfSSL_CTX_ctrl(ctx, SSL_CTRL_SET_MIN_PROTO_VERSION,
TLS1_2_VERSION, NULL), SSL_SUCCESS);
AssertIntEQ(wolfSSL_CTX_get_min_proto_version(ctx), TLS1_2_VERSION);
#endif
#ifdef WOLFSSL_TLS13
AssertIntEQ((int)wolfSSL_CTX_ctrl(ctx, SSL_CTRL_SET_MAX_PROTO_VERSION,
0, NULL), SSL_SUCCESS);
AssertIntEQ((int)wolfSSL_CTX_ctrl(ctx, SSL_CTRL_SET_MAX_PROTO_VERSION,
TLS1_3_VERSION, NULL), SSL_SUCCESS);
#endif