Home > front end >  how to set the min and max protocol versions in openssl library
how to set the min and max protocol versions in openssl library

Time:10-07

I could not find out how to set the min and max protocol version in this library:

There is a function: static int test_func(void) in a test file

sysdefaulttest.c

That uses the min and max protocol version:

static int test_func(void) {
if (!TEST_int_eq(SSL_CTX_get_min_proto_version(ctx), TLS1_2_VERSION)
    && !TEST_int_eq(SSL_CTX_get_max_proto_version(ctx), TLS1_2_VERSION)) {
    TEST_info("min/max version setting incorrect");
    return 0;
}
return 1;}

This test fails in my case. The 'ctx' context struct has these 2 values as zero in my case. It looks like these have to be set somewhere in the library.

ctx.min_proto_ver, ctx.max_proto_ver

Both of the above are showing Zero value in my case.

SSL_CTX_get_min_proto_version(ctx);
SSL_CTX_get_max_proto_version(ctx);

Where can I set these version values in the library?

CodePudding user response:

Most probably with

  • SSL_CTX_set_min_proto_version and
  • SSL_CTX_set_max_proto_version

functions (https://github.com/openssl/openssl/blob/master/include/openssl/ssl.h.in#L1451).

From docs:

The setter functions were added in OpenSSL 1.1.0. The getter functions were added in OpenSSL 1.1.1.

  • Related