test/sslapitest.c:4793: error: NULL_DEREFERENCE
  pointer `sctx2` last assigned on line 4660 could be null and is dereferenced by call to `SSL_CTX_free()` at line 4793, column 5.
Showing all 57 steps of the trace


test/sslapitest.c:4657:1: start of procedure test_export_key_mat()
4655.   #define SMALL_LABEL_LEN 10
4656.   #define LONG_LABEL_LEN  249
4657. > static int test_export_key_mat(int tst)
4658.   {
4659.       int testresult = 0;

test/sslapitest.c:4659:5: 
4657.   static int test_export_key_mat(int tst)
4658.   {
4659. >     int testresult = 0;
4660.       SSL_CTX *cctx = NULL, *sctx = NULL, *sctx2 = NULL;
4661.       SSL *clientssl = NULL, *serverssl = NULL;

test/sslapitest.c:4660:5: 
4658.   {
4659.       int testresult = 0;
4660. >     SSL_CTX *cctx = NULL, *sctx = NULL, *sctx2 = NULL;
4661.       SSL *clientssl = NULL, *serverssl = NULL;
4662.       const char label[LONG_LABEL_LEN + 1] = "test label";

test/sslapitest.c:4661:5: 
4659.       int testresult = 0;
4660.       SSL_CTX *cctx = NULL, *sctx = NULL, *sctx2 = NULL;
4661. >     SSL *clientssl = NULL, *serverssl = NULL;
4662.       const char label[LONG_LABEL_LEN + 1] = "test label";
4663.       const unsigned char context[] = "context";

test/sslapitest.c:4662:5: 
4660.       SSL_CTX *cctx = NULL, *sctx = NULL, *sctx2 = NULL;
4661.       SSL *clientssl = NULL, *serverssl = NULL;
4662. >     const char label[LONG_LABEL_LEN + 1] = "test label";
4663.       const unsigned char context[] = "context";
4664.       const unsigned char *emptycontext = NULL;

test/sslapitest.c:4663:5: 
4661.       SSL *clientssl = NULL, *serverssl = NULL;
4662.       const char label[LONG_LABEL_LEN + 1] = "test label";
4663. >     const unsigned char context[] = "context";
4664.       const unsigned char *emptycontext = NULL;
4665.       unsigned char ckeymat1[80], ckeymat2[80], ckeymat3[80];

test/sslapitest.c:4664:5: 
4662.       const char label[LONG_LABEL_LEN + 1] = "test label";
4663.       const unsigned char context[] = "context";
4664. >     const unsigned char *emptycontext = NULL;
4665.       unsigned char ckeymat1[80], ckeymat2[80], ckeymat3[80];
4666.       unsigned char skeymat1[80], skeymat2[80], skeymat3[80];

test/sslapitest.c:4668:5: 
4666.       unsigned char skeymat1[80], skeymat2[80], skeymat3[80];
4667.       size_t labellen;
4668. >     const int protocols[] = {
4669.           TLS1_VERSION,
4670.           TLS1_1_VERSION,

test/sslapitest.c:4693:10: 
4691.           return 1;
4692.   #endif
4693. >     if (!TEST_true(create_ssl_ctx_pair(TLS_server_method(), TLS_client_method(),
4694.                                          TLS1_VERSION, 0,
4695.                                          &sctx, &cctx, cert, privkey)))

ssl/methods.c:49:1: start of procedure TLS_server_method()
  47.    * TLS/SSLv3 server methods
  48.    */
  49. > IMPLEMENT_tls_meth_func(TLS_ANY_VERSION, 0, 0,
  50.                           TLS_server_method,
  51.                           ossl_statem_accept,

ssl/methods.c:49:1: return from a call to TLS_server_method
  47.    * TLS/SSLv3 server methods
  48.    */
  49. > IMPLEMENT_tls_meth_func(TLS_ANY_VERSION, 0, 0,
  50.                           TLS_server_method,
  51.                           ossl_statem_accept,

ssl/methods.c:82:1: start of procedure TLS_client_method()
  80.    * TLS/SSLv3 client methods
  81.    */
  82. > IMPLEMENT_tls_meth_func(TLS_ANY_VERSION, 0, 0,
  83.                           TLS_client_method,
  84.                           ssl_undefined_function,

ssl/methods.c:82:1: return from a call to TLS_client_method
  80.    * TLS/SSLv3 client methods
  81.    */
  82. > IMPLEMENT_tls_meth_func(TLS_ANY_VERSION, 0, 0,
  83.                           TLS_client_method,
  84.                           ssl_undefined_function,

test/sslapitest.c:4693:10: Condition is true
4691.           return 1;
4692.   #endif
4693.       if (!TEST_true(create_ssl_ctx_pair(TLS_server_method(), TLS_client_method(),
                 ^
4694.                                          TLS1_VERSION, 0,
4695.                                          &sctx, &cctx, cert, privkey)))

test/testutil/tests.c:260:1: start of procedure test_true()
  258.   }
  259.   
  260. > int test_true(const char *file, int line, const char *s, int b)
  261.   {
  262.       if (b)

test/testutil/tests.c:262:9: Taking true branch
  260.   int test_true(const char *file, int line, const char *s, int b)
  261.   {
  262.       if (b)
                 ^
  263.           return 1;
  264.       test_fail_message(NULL, file, line, "bool", s, "true", "==", "false");

test/testutil/tests.c:263:9: 
  261.   {
  262.       if (b)
  263. >         return 1;
  264.       test_fail_message(NULL, file, line, "bool", s, "true", "==", "false");
  265.       return 0;

test/testutil/tests.c:266:1: return from a call to test_true
  264.       test_fail_message(NULL, file, line, "bool", s, "true", "==", "false");
  265.       return 0;
  266. > }
  267.   
  268.   int test_false(const char *file, int line, const char *s, int b)

test/sslapitest.c:4693:10: Taking false branch
4691.           return 1;
4692.   #endif
4693.       if (!TEST_true(create_ssl_ctx_pair(TLS_server_method(), TLS_client_method(),
                 ^
4694.                                          TLS1_VERSION, 0,
4695.                                          &sctx, &cctx, cert, privkey)))

test/sslapitest.c:4698:5: Condition is true
4696.           goto end;
4697.   
4698.       OPENSSL_assert(tst >= 0 && (size_t)tst < OSSL_NELEM(protocols));
            ^
4699.       SSL_CTX_set_max_proto_version(cctx, protocols[tst]);
4700.       SSL_CTX_set_min_proto_version(cctx, protocols[tst]);

test/sslapitest.c:4698:5: Condition is true
4696.           goto end;
4697.   
4698.       OPENSSL_assert(tst >= 0 && (size_t)tst < OSSL_NELEM(protocols));
            ^
4699.       SSL_CTX_set_max_proto_version(cctx, protocols[tst]);
4700.       SSL_CTX_set_min_proto_version(cctx, protocols[tst]);

test/sslapitest.c:4699:5: Skipping SSL_CTX_ctrl(): empty list of specs
4697.   
4698.       OPENSSL_assert(tst >= 0 && (size_t)tst < OSSL_NELEM(protocols));
4699.       SSL_CTX_set_max_proto_version(cctx, protocols[tst]);
            ^
4700.       SSL_CTX_set_min_proto_version(cctx, protocols[tst]);
4701.   

test/sslapitest.c:4700:5: Skipping SSL_CTX_ctrl(): empty list of specs
4698.       OPENSSL_assert(tst >= 0 && (size_t)tst < OSSL_NELEM(protocols));
4699.       SSL_CTX_set_max_proto_version(cctx, protocols[tst]);
4700.       SSL_CTX_set_min_proto_version(cctx, protocols[tst]);
            ^
4701.   
4702.       if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, NULL,

test/sslapitest.c:4702:10: Condition is true
4700.       SSL_CTX_set_min_proto_version(cctx, protocols[tst]);
4701.   
4702.       if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, NULL,
                 ^
4703.                                         NULL))
4704.               || !TEST_true(create_ssl_connection(serverssl, clientssl,

test/testutil/tests.c:260:1: start of procedure test_true()
  258.   }
  259.   
  260. > int test_true(const char *file, int line, const char *s, int b)
  261.   {
  262.       if (b)

test/testutil/tests.c:262:9: Taking true branch
  260.   int test_true(const char *file, int line, const char *s, int b)
  261.   {
  262.       if (b)
                 ^
  263.           return 1;
  264.       test_fail_message(NULL, file, line, "bool", s, "true", "==", "false");

test/testutil/tests.c:263:9: 
  261.   {
  262.       if (b)
  263. >         return 1;
  264.       test_fail_message(NULL, file, line, "bool", s, "true", "==", "false");
  265.       return 0;

test/testutil/tests.c:266:1: return from a call to test_true
  264.       test_fail_message(NULL, file, line, "bool", s, "true", "==", "false");
  265.       return 0;
  266. > }
  267.   
  268.   int test_false(const char *file, int line, const char *s, int b)

test/sslapitest.c:4702:10: Taking false branch
4700.       SSL_CTX_set_min_proto_version(cctx, protocols[tst]);
4701.   
4702.       if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, NULL,
                 ^
4703.                                         NULL))
4704.               || !TEST_true(create_ssl_connection(serverssl, clientssl,

test/sslapitest.c:4704:17: 
4702.       if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, NULL,
4703.                                         NULL))
4704. >             || !TEST_true(create_ssl_connection(serverssl, clientssl,
4705.                                                   SSL_ERROR_NONE)))
4706.           goto end;

test/ssltestlib.c:1027:1: start of procedure create_ssl_connection()
  1025.    * messages.
  1026.    */
  1027. > int create_ssl_connection(SSL *serverssl, SSL *clientssl, int want)
  1028.   {
  1029.       int i;

test/ssltestlib.c:1033:10: Taking true branch
  1031.       size_t readbytes;
  1032.   
  1033.       if (!create_bare_ssl_connection(serverssl, clientssl, want, 1))
                   ^
  1034.           return 0;
  1035.   

test/ssltestlib.c:1034:9: 
  1032.   
  1033.       if (!create_bare_ssl_connection(serverssl, clientssl, want, 1))
  1034. >         return 0;
  1035.   
  1036.       /*

test/ssltestlib.c:1052:1: return from a call to create_ssl_connection
  1050.   
  1051.       return 1;
  1052. > }
  1053.   
  1054.   void shutdown_ssl_connection(SSL *serverssl, SSL *clientssl)

test/sslapitest.c:4704:17: Condition is false
4702.       if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, NULL,
4703.                                         NULL))
4704.               || !TEST_true(create_ssl_connection(serverssl, clientssl,
                        ^
4705.                                                   SSL_ERROR_NONE)))
4706.           goto end;

test/testutil/tests.c:260:1: start of procedure test_true()
  258.   }
  259.   
  260. > int test_true(const char *file, int line, const char *s, int b)
  261.   {
  262.       if (b)

test/testutil/tests.c:262:9: Taking false branch
  260.   int test_true(const char *file, int line, const char *s, int b)
  261.   {
  262.       if (b)
                 ^
  263.           return 1;
  264.       test_fail_message(NULL, file, line, "bool", s, "true", "==", "false");

test/testutil/tests.c:264:5: Skipping test_fail_message(): empty list of specs
  262.       if (b)
  263.           return 1;
  264.       test_fail_message(NULL, file, line, "bool", s, "true", "==", "false");
             ^
  265.       return 0;
  266.   }

test/testutil/tests.c:265:5: 
  263.           return 1;
  264.       test_fail_message(NULL, file, line, "bool", s, "true", "==", "false");
  265. >     return 0;
  266.   }
  267.   

test/testutil/tests.c:266:1: return from a call to test_true
  264.       test_fail_message(NULL, file, line, "bool", s, "true", "==", "false");
  265.       return 0;
  266. > }
  267.   
  268.   int test_false(const char *file, int line, const char *s, int b)

test/sslapitest.c:4704:17: Taking true branch
4702.       if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, NULL,
4703.                                         NULL))
4704.               || !TEST_true(create_ssl_connection(serverssl, clientssl,
                        ^
4705.                                                   SSL_ERROR_NONE)))
4706.           goto end;

test/sslapitest.c:4790:2: 
4788.       testresult = 1;
4789.   
4790. >  end:
4791.       SSL_free(serverssl);
4792.       SSL_free(clientssl);

test/sslapitest.c:4791:5: Skipping SSL_free(): empty list of specs
4789.   
4790.    end:
4791.       SSL_free(serverssl);
            ^
4792.       SSL_free(clientssl);
4793.       SSL_CTX_free(sctx2);

test/sslapitest.c:4792:5: Skipping SSL_free(): empty list of specs
4790.    end:
4791.       SSL_free(serverssl);
4792.       SSL_free(clientssl);
            ^
4793.       SSL_CTX_free(sctx2);
4794.       SSL_CTX_free(sctx);

test/sslapitest.c:4793:5: 
4791.       SSL_free(serverssl);
4792.       SSL_free(clientssl);
4793. >     SSL_CTX_free(sctx2);
4794.       SSL_CTX_free(sctx);
4795.       SSL_CTX_free(cctx);

ssl/ssl_lib.c:3240:1: start of procedure SSL_CTX_free()
  3238.   }
  3239.   
  3240. > void SSL_CTX_free(SSL_CTX *a)
  3241.   {
  3242.       int i;

ssl/ssl_lib.c:3244:9: Taking false branch
  3242.       int i;
  3243.   
  3244.       if (a == NULL)
                  ^
  3245.           return;
  3246.   

ssl/ssl_lib.c:3247:5: 
  3245.           return;
  3246.   
  3247. >     CRYPTO_DOWN_REF(&a->references, &i, a->lock);
  3248.       REF_PRINT_COUNT("SSL_CTX", a);
  3249.       if (i > 0)

include/internal/refcount.h:49:1: start of procedure CRYPTO_DOWN_REF()
    47.    * otherwise imply an acquire fence. Hence conditional acquire fence...
    48.    */
    49. > static inline int CRYPTO_DOWN_REF(_Atomic int *val, int *ret, void *lock)
    50.   {
    51.       *ret = atomic_fetch_sub_explicit(val, 1, memory_order_relaxed) - 1;

include/internal/refcount.h:51:5: 
    49.   static inline int CRYPTO_DOWN_REF(_Atomic int *val, int *ret, void *lock)
    50.   {
    51. >     *ret = atomic_fetch_sub_explicit(val, 1, memory_order_relaxed) - 1;
    52.       if (*ret == 0)
    53.           atomic_thread_fence(memory_order_acquire);

include/internal/refcount.h:52:9: Taking true branch
    50.   {
    51.       *ret = atomic_fetch_sub_explicit(val, 1, memory_order_relaxed) - 1;
    52.       if (*ret == 0)
                  ^
    53.           atomic_thread_fence(memory_order_acquire);
    54.       return 1;

include/internal/refcount.h:53:9: Skipping __c11_atomic_thread_fence(): method has no implementation
    51.       *ret = atomic_fetch_sub_explicit(val, 1, memory_order_relaxed) - 1;
    52.       if (*ret == 0)
    53.           atomic_thread_fence(memory_order_acquire);
                  ^
    54.       return 1;
    55.   }

include/internal/refcount.h:54:5: 
    52.       if (*ret == 0)
    53.           atomic_thread_fence(memory_order_acquire);
    54. >     return 1;
    55.   }
    56.   

include/internal/refcount.h:55:1: return from a call to CRYPTO_DOWN_REF
    53.           atomic_thread_fence(memory_order_acquire);
    54.       return 1;
    55. > }
    56.   
    57.   #  elif defined(__GNUC__) && defined(__ATOMIC_RELAXED) && __GCC_ATOMIC_INT_LOCK_FREE > 0

ssl/ssl_lib.c:3249:9: Taking true branch
  3247.       CRYPTO_DOWN_REF(&a->references, &i, a->lock);
  3248.       REF_PRINT_COUNT("SSL_CTX", a);
  3249.       if (i > 0)
                  ^
  3250.           return;
  3251.       REF_ASSERT_ISNT(i < 0);

ssl/ssl_lib.c:3250:9: 
  3248.       REF_PRINT_COUNT("SSL_CTX", a);
  3249.       if (i > 0)
  3250. >         return;
  3251.       REF_ASSERT_ISNT(i < 0);
  3252.   

ssl/ssl_lib.c:3302:1: return from a call to SSL_CTX_free
  3300.   
  3301.       OPENSSL_free(a);
  3302. > }
  3303.   
  3304.   void SSL_CTX_set_default_passwd_cb(SSL_CTX *ctx, pem_password_cb *cb)

static int test_export_key_mat(int tst)
{
    int testresult = 0;
    SSL_CTX *cctx = NULL, *sctx = NULL, *sctx2 = NULL;
    SSL *clientssl = NULL, *serverssl = NULL;
    const char label[LONG_LABEL_LEN + 1] = "test label";
    const unsigned char context[] = "context";
    const unsigned char *emptycontext = NULL;
    unsigned char ckeymat1[80], ckeymat2[80], ckeymat3[80];
    unsigned char skeymat1[80], skeymat2[80], skeymat3[80];
    size_t labellen;
    const int protocols[] = {
        TLS1_VERSION,
        TLS1_1_VERSION,
        TLS1_2_VERSION,
        TLS1_3_VERSION,
        TLS1_3_VERSION,
        TLS1_3_VERSION
    };
#ifdef OPENSSL_NO_TLS1
    if (tst == 0)
        return 1;
#endif
#ifdef OPENSSL_NO_TLS1_1
    if (tst == 1)
        return 1;
#endif
#ifdef OPENSSL_NO_TLS1_2
    if (tst == 2)
        return 1;
#endif
#ifdef OPENSSL_NO_TLS1_3
    if (tst >= 3)
        return 1;
#endif
    if (!TEST_true(create_ssl_ctx_pair(TLS_server_method(), TLS_client_method(),
                                       TLS1_VERSION, 0,
                                       &sctx, &cctx, cert, privkey)))
        goto end;
    OPENSSL_assert(tst >= 0 && (size_t)tst < OSSL_NELEM(protocols));
    SSL_CTX_set_max_proto_version(cctx, protocols[tst]);
    SSL_CTX_set_min_proto_version(cctx, protocols[tst]);
    if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, NULL,
                                      NULL))
            || !TEST_true(create_ssl_connection(serverssl, clientssl,
                                                SSL_ERROR_NONE)))
        goto end;
    if (tst == 5) {
        if (!TEST_int_le(SSL_export_keying_material(clientssl, ckeymat1,
                                                    sizeof(ckeymat1), label,
                                                    LONG_LABEL_LEN + 1, context,
                                                    sizeof(context) - 1, 1), 0))
            goto end;
        testresult = 1;
        goto end;
    } else if (tst == 4) {
        labellen = LONG_LABEL_LEN;
    } else {
        labellen = SMALL_LABEL_LEN;
    }
    if (!TEST_int_eq(SSL_export_keying_material(clientssl, ckeymat1,
                                                sizeof(ckeymat1), label,
                                                labellen, context,
                                                sizeof(context) - 1, 1), 1)
            || !TEST_int_eq(SSL_export_keying_material(clientssl, ckeymat2,
                                                       sizeof(ckeymat2), label,
                                                       labellen,
                                                       emptycontext,
                                                       0, 1), 1)
            || !TEST_int_eq(SSL_export_keying_material(clientssl, ckeymat3,
                                                       sizeof(ckeymat3), label,
                                                       labellen,
                                                       NULL, 0, 0), 1)
            || !TEST_int_eq(SSL_export_keying_material(serverssl, skeymat1,
                                                       sizeof(skeymat1), label,
                                                       labellen,
                                                       context,
                                                       sizeof(context) -1, 1),
                            1)
            || !TEST_int_eq(SSL_export_keying_material(serverssl, skeymat2,
                                                       sizeof(skeymat2), label,
                                                       labellen,
                                                       emptycontext,
                                                       0, 1), 1)
            || !TEST_int_eq(SSL_export_keying_material(serverssl, skeymat3,
                                                       sizeof(skeymat3), label,
                                                       labellen,
                                                       NULL, 0, 0), 1)
            || !TEST_mem_eq(ckeymat1, sizeof(ckeymat1), skeymat1,
                            sizeof(skeymat1))
            || !TEST_mem_eq(ckeymat2, sizeof(ckeymat2), skeymat2,
                            sizeof(skeymat2))
            || !TEST_mem_eq(ckeymat3, sizeof(ckeymat3), skeymat3,
                            sizeof(skeymat3))
            || !TEST_mem_ne(ckeymat1, sizeof(ckeymat1), ckeymat2,
                            sizeof(ckeymat2)))
        goto end;
    if ((tst < 3 && !TEST_mem_ne(ckeymat2, sizeof(ckeymat2), ckeymat3,
                                  sizeof(ckeymat3)))
            || (tst >= 3 && !TEST_mem_eq(ckeymat2, sizeof(ckeymat2), ckeymat3,
                                         sizeof(ckeymat3))))
        goto end;
    testresult = 1;
 end:
    SSL_free(serverssl);
    SSL_free(clientssl);
    SSL_CTX_free(sctx2);
    SSL_CTX_free(sctx);
    SSL_CTX_free(cctx);
    return testresult;
}
['static int test_export_key_mat(int tst)\n{\n    int testresult = 0;\n    SSL_CTX *cctx = NULL, *sctx = NULL, *sctx2 = NULL;\n    SSL *clientssl = NULL, *serverssl = NULL;\n    const char label[LONG_LABEL_LEN + 1] = "test label";\n    const unsigned char context[] = "context";\n    const unsigned char *emptycontext = NULL;\n    unsigned char ckeymat1[80], ckeymat2[80], ckeymat3[80];\n    unsigned char skeymat1[80], skeymat2[80], skeymat3[80];\n    size_t labellen;\n    const int protocols[] = {\n        TLS1_VERSION,\n        TLS1_1_VERSION,\n        TLS1_2_VERSION,\n        TLS1_3_VERSION,\n        TLS1_3_VERSION,\n        TLS1_3_VERSION\n    };\n#ifdef OPENSSL_NO_TLS1\n    if (tst == 0)\n        return 1;\n#endif\n#ifdef OPENSSL_NO_TLS1_1\n    if (tst == 1)\n        return 1;\n#endif\n#ifdef OPENSSL_NO_TLS1_2\n    if (tst == 2)\n        return 1;\n#endif\n#ifdef OPENSSL_NO_TLS1_3\n    if (tst >= 3)\n        return 1;\n#endif\n    if (!TEST_true(create_ssl_ctx_pair(TLS_server_method(), TLS_client_method(),\n                                       TLS1_VERSION, 0,\n                                       &sctx, &cctx, cert, privkey)))\n        goto end;\n    OPENSSL_assert(tst >= 0 && (size_t)tst < OSSL_NELEM(protocols));\n    SSL_CTX_set_max_proto_version(cctx, protocols[tst]);\n    SSL_CTX_set_min_proto_version(cctx, protocols[tst]);\n    if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, NULL,\n                                      NULL))\n            || !TEST_true(create_ssl_connection(serverssl, clientssl,\n                                                SSL_ERROR_NONE)))\n        goto end;\n    if (tst == 5) {\n        if (!TEST_int_le(SSL_export_keying_material(clientssl, ckeymat1,\n                                                    sizeof(ckeymat1), label,\n                                                    LONG_LABEL_LEN + 1, context,\n                                                    sizeof(context) - 1, 1), 0))\n            goto end;\n        testresult = 1;\n        goto end;\n    } else if (tst == 4) {\n        labellen = LONG_LABEL_LEN;\n    } else {\n        labellen = SMALL_LABEL_LEN;\n    }\n    if (!TEST_int_eq(SSL_export_keying_material(clientssl, ckeymat1,\n                                                sizeof(ckeymat1), label,\n                                                labellen, context,\n                                                sizeof(context) - 1, 1), 1)\n            || !TEST_int_eq(SSL_export_keying_material(clientssl, ckeymat2,\n                                                       sizeof(ckeymat2), label,\n                                                       labellen,\n                                                       emptycontext,\n                                                       0, 1), 1)\n            || !TEST_int_eq(SSL_export_keying_material(clientssl, ckeymat3,\n                                                       sizeof(ckeymat3), label,\n                                                       labellen,\n                                                       NULL, 0, 0), 1)\n            || !TEST_int_eq(SSL_export_keying_material(serverssl, skeymat1,\n                                                       sizeof(skeymat1), label,\n                                                       labellen,\n                                                       context,\n                                                       sizeof(context) -1, 1),\n                            1)\n            || !TEST_int_eq(SSL_export_keying_material(serverssl, skeymat2,\n                                                       sizeof(skeymat2), label,\n                                                       labellen,\n                                                       emptycontext,\n                                                       0, 1), 1)\n            || !TEST_int_eq(SSL_export_keying_material(serverssl, skeymat3,\n                                                       sizeof(skeymat3), label,\n                                                       labellen,\n                                                       NULL, 0, 0), 1)\n            || !TEST_mem_eq(ckeymat1, sizeof(ckeymat1), skeymat1,\n                            sizeof(skeymat1))\n            || !TEST_mem_eq(ckeymat2, sizeof(ckeymat2), skeymat2,\n                            sizeof(skeymat2))\n            || !TEST_mem_eq(ckeymat3, sizeof(ckeymat3), skeymat3,\n                            sizeof(skeymat3))\n            || !TEST_mem_ne(ckeymat1, sizeof(ckeymat1), ckeymat2,\n                            sizeof(ckeymat2)))\n        goto end;\n    if ((tst < 3 && !TEST_mem_ne(ckeymat2, sizeof(ckeymat2), ckeymat3,\n                                  sizeof(ckeymat3)))\n            || (tst >= 3 && !TEST_mem_eq(ckeymat2, sizeof(ckeymat2), ckeymat3,\n                                         sizeof(ckeymat3))))\n        goto end;\n    testresult = 1;\n end:\n    SSL_free(serverssl);\n    SSL_free(clientssl);\n    SSL_CTX_free(sctx2);\n    SSL_CTX_free(sctx);\n    SSL_CTX_free(cctx);\n    return testresult;\n}', 'IMPLEMENT_tls_meth_func(TLS_ANY_VERSION, 0, 0,\n                        TLS_server_method,\n                        ossl_statem_accept,\n                        ssl_undefined_function, TLSv1_2_enc_data)', 'IMPLEMENT_tls_meth_func(TLS_ANY_VERSION, 0, 0,\n                        TLS_client_method,\n                        ssl_undefined_function,\n                        ossl_statem_connect, TLSv1_2_enc_data)', 'int test_true(const char *file, int line, const char *s, int b)\n{\n    if (b)\n        return 1;\n    test_fail_message(NULL, file, line, "bool", s, "true", "==", "false");\n    return 0;\n}', 'int create_ssl_connection(SSL *serverssl, SSL *clientssl, int want)\n{\n    int i;\n    unsigned char buf;\n    size_t readbytes;\n    if (!create_bare_ssl_connection(serverssl, clientssl, want, 1))\n        return 0;\n    for (i = 0; i < 2; i++) {\n        if (SSL_read_ex(clientssl, &buf, sizeof(buf), &readbytes) > 0) {\n            if (!TEST_ulong_eq(readbytes, 0))\n                return 0;\n        } else if (!TEST_int_eq(SSL_get_error(clientssl, 0),\n                                SSL_ERROR_WANT_READ)) {\n            return 0;\n        }\n    }\n    return 1;\n}', 'void SSL_CTX_free(SSL_CTX *a)\n{\n    int i;\n    if (a == NULL)\n        return;\n    CRYPTO_DOWN_REF(&a->references, &i, a->lock);\n    REF_PRINT_COUNT("SSL_CTX", a);\n    if (i > 0)\n        return;\n    REF_ASSERT_ISNT(i < 0);\n    X509_VERIFY_PARAM_free(a->param);\n    dane_ctx_final(&a->dane);\n    if (a->sessions != NULL)\n        SSL_CTX_flush_sessions(a, 0);\n    CRYPTO_free_ex_data(CRYPTO_EX_INDEX_SSL_CTX, a, &a->ex_data);\n    lh_SSL_SESSION_free(a->sessions);\n    X509_STORE_free(a->cert_store);\n#ifndef OPENSSL_NO_CT\n    CTLOG_STORE_free(a->ctlog_store);\n#endif\n    sk_SSL_CIPHER_free(a->cipher_list);\n    sk_SSL_CIPHER_free(a->cipher_list_by_id);\n    sk_SSL_CIPHER_free(a->tls13_ciphersuites);\n    ssl_cert_free(a->cert);\n    sk_X509_NAME_pop_free(a->ca_names, X509_NAME_free);\n    sk_X509_NAME_pop_free(a->client_ca_names, X509_NAME_free);\n    sk_X509_pop_free(a->extra_certs, X509_free);\n    a->comp_methods = NULL;\n#ifndef OPENSSL_NO_SRTP\n    sk_SRTP_PROTECTION_PROFILE_free(a->srtp_profiles);\n#endif\n#ifndef OPENSSL_NO_SRP\n    SSL_CTX_SRP_CTX_free(a);\n#endif\n#ifndef OPENSSL_NO_ENGINE\n    ENGINE_finish(a->client_cert_engine);\n#endif\n#ifndef OPENSSL_NO_EC\n    OPENSSL_free(a->ext.ecpointformats);\n    OPENSSL_free(a->ext.supportedgroups);\n#endif\n    OPENSSL_free(a->ext.alpn);\n    OPENSSL_secure_free(a->ext.secure);\n    CRYPTO_THREAD_lock_free(a->lock);\n    OPENSSL_free(a);\n}', 'static inline int CRYPTO_DOWN_REF(_Atomic int *val, int *ret, void *lock)\n{\n    *ret = atomic_fetch_sub_explicit(val, 1, memory_order_relaxed) - 1;\n    if (*ret == 0)\n        atomic_thread_fence(memory_order_acquire);\n    return 1;\n}']