test/handshake_helper.c:200: error: NULL_DEREFERENCE
  pointer `ex_data` last assigned on line 155 could be null and is dereferenced at line 200, column 9.
Showing all 71 steps of the trace


test/handshake_helper.c:150:1: start of procedure client_hello_select_server_ctx()
148.   }
149.   
150. > static int client_hello_select_server_ctx(SSL *s, void *arg, int ignore)
151.   {
152.       const char *servername;

test/handshake_helper.c:155:5: 
153.       const unsigned char *p;
154.       size_t len, remaining;
155. >     HANDSHAKE_EX_DATA *ex_data =
156.           (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx));
157.   

ssl/ssl_lib.c:4291:1: start of procedure SSL_get_ex_data()
  4289.   }
  4290.   
  4291. > void *SSL_get_ex_data(const SSL *s, int idx)
  4292.   {
  4293.       return CRYPTO_get_ex_data(&s->ex_data, idx);

ssl/ssl_lib.c:4293:5: 
  4291.   void *SSL_get_ex_data(const SSL *s, int idx)
  4292.   {
  4293. >     return CRYPTO_get_ex_data(&s->ex_data, idx);
  4294.   }
  4295.   

crypto/ex_data.c:458:1: start of procedure CRYPTO_get_ex_data()
    456.    * particular index in the class used by this variable
    457.    */
    458. > void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx)
    459.   {
    460.       if (ad->sk == NULL || idx >= sk_void_num(ad->sk))

crypto/ex_data.c:460:9: Taking true branch
    458.   void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx)
    459.   {
    460.       if (ad->sk == NULL || idx >= sk_void_num(ad->sk))
                   ^
    461.           return NULL;
    462.       return sk_void_value(ad->sk, idx);

crypto/ex_data.c:461:9: 
    459.   {
    460.       if (ad->sk == NULL || idx >= sk_void_num(ad->sk))
    461. >         return NULL;
    462.       return sk_void_value(ad->sk, idx);
    463.   }

crypto/ex_data.c:463:1: return from a call to CRYPTO_get_ex_data
    461.           return NULL;
    462.       return sk_void_value(ad->sk, idx);
    463. > }
    464.   
    465.   OPENSSL_CTX *crypto_ex_data_get_openssl_ctx(const CRYPTO_EX_DATA *ad)

ssl/ssl_lib.c:4294:1: return from a call to SSL_get_ex_data
  4292.   {
  4293.       return CRYPTO_get_ex_data(&s->ex_data, idx);
  4294. > }
  4295.   
  4296.   int SSL_CTX_set_ex_data(SSL_CTX *s, int idx, void *arg)

test/handshake_helper.c:162:10: Taking false branch
160.        * was written, so parsing the normal case is a bit complex.
161.        */
162.       if (!SSL_client_hello_get0_ext(s, TLSEXT_TYPE_server_name, &p,
                ^
163.                                      &remaining) ||
164.           remaining <= 2)

test/handshake_helper.c:164:9: Taking false branch
162.       if (!SSL_client_hello_get0_ext(s, TLSEXT_TYPE_server_name, &p,
163.                                      &remaining) ||
164.           remaining <= 2)
               ^
165.           return 0;
166.       /* Extract the length of the supplied list of names. */

test/handshake_helper.c:167:5: 
165.           return 0;
166.       /* Extract the length of the supplied list of names. */
167. >     len = (*(p++) << 8);
168.       len += *(p++);
169.       if (len + 2 != remaining)

test/handshake_helper.c:168:5: 
166.       /* Extract the length of the supplied list of names. */
167.       len = (*(p++) << 8);
168. >     len += *(p++);
169.       if (len + 2 != remaining)
170.           return 0;

test/handshake_helper.c:169:9: Taking false branch
167.       len = (*(p++) << 8);
168.       len += *(p++);
169.       if (len + 2 != remaining)
               ^
170.           return 0;
171.       remaining = len;

test/handshake_helper.c:171:5: 
169.       if (len + 2 != remaining)
170.           return 0;
171. >     remaining = len;
172.       /*
173.        * The list in practice only has a single element, so we only consider

test/handshake_helper.c:176:9: Taking false branch
174.        * the first one.
175.        */
176.       if (remaining == 0 || *p++ != TLSEXT_NAMETYPE_host_name)
               ^
177.           return 0;
178.       remaining--;

test/handshake_helper.c:176:27: Taking false branch
174.        * the first one.
175.        */
176.       if (remaining == 0 || *p++ != TLSEXT_NAMETYPE_host_name)
                                 ^
177.           return 0;
178.       remaining--;

test/handshake_helper.c:178:5: 
176.       if (remaining == 0 || *p++ != TLSEXT_NAMETYPE_host_name)
177.           return 0;
178. >     remaining--;
179.       /* Now we can finally pull out the byte array with the actual hostname. */
180.       if (remaining <= 2)

test/handshake_helper.c:180:9: Taking false branch
178.       remaining--;
179.       /* Now we can finally pull out the byte array with the actual hostname. */
180.       if (remaining <= 2)
               ^
181.           return 0;
182.       len = (*(p++) << 8);

test/handshake_helper.c:182:5: 
180.       if (remaining <= 2)
181.           return 0;
182. >     len = (*(p++) << 8);
183.       len += *(p++);
184.       if (len + 2 > remaining)

test/handshake_helper.c:183:5: 
181.           return 0;
182.       len = (*(p++) << 8);
183. >     len += *(p++);
184.       if (len + 2 > remaining)
185.           return 0;

test/handshake_helper.c:184:9: Taking false branch
182.       len = (*(p++) << 8);
183.       len += *(p++);
184.       if (len + 2 > remaining)
               ^
185.           return 0;
186.       remaining = len;

test/handshake_helper.c:186:5: 
184.       if (len + 2 > remaining)
185.           return 0;
186. >     remaining = len;
187.       servername = (const char *)p;
188.   

test/handshake_helper.c:187:5: 
185.           return 0;
186.       remaining = len;
187. >     servername = (const char *)p;
188.   
189.       if (len == strlen("server2") && strncmp(servername, "server2", len) == 0) {

test/handshake_helper.c:189:9: Taking true branch
187.       servername = (const char *)p;
188.   
189.       if (len == strlen("server2") && strncmp(servername, "server2", len) == 0) {
               ^
190.           SSL_CTX *new_ctx = arg;
191.           SSL_set_SSL_CTX(s, new_ctx);

test/handshake_helper.c:189:37: Taking true branch
187.       servername = (const char *)p;
188.   
189.       if (len == strlen("server2") && strncmp(servername, "server2", len) == 0) {
                                           ^
190.           SSL_CTX *new_ctx = arg;
191.           SSL_set_SSL_CTX(s, new_ctx);

test/handshake_helper.c:190:9: 
188.   
189.       if (len == strlen("server2") && strncmp(servername, "server2", len) == 0) {
190. >         SSL_CTX *new_ctx = arg;
191.           SSL_set_SSL_CTX(s, new_ctx);
192.           /*

test/handshake_helper.c:191:9: 
189.       if (len == strlen("server2") && strncmp(servername, "server2", len) == 0) {
190.           SSL_CTX *new_ctx = arg;
191. >         SSL_set_SSL_CTX(s, new_ctx);
192.           /*
193.            * Copy over all the SSL_CTX options - reasonable behavior

ssl/ssl_lib.c:4128:1: start of procedure SSL_set_SSL_CTX()
  4126.   }
  4127.   
  4128. > SSL_CTX *SSL_set_SSL_CTX(SSL *ssl, SSL_CTX *ctx)
  4129.   {
  4130.       CERT *new_cert;

ssl/ssl_lib.c:4131:9: Taking false branch
  4129.   {
  4130.       CERT *new_cert;
  4131.       if (ssl->ctx == ctx)
                  ^
  4132.           return ssl->ctx;
  4133.       if (ctx == NULL)

ssl/ssl_lib.c:4133:9: Taking false branch
  4131.       if (ssl->ctx == ctx)
  4132.           return ssl->ctx;
  4133.       if (ctx == NULL)
                  ^
  4134.           ctx = ssl->session_ctx;
  4135.       new_cert = ssl_cert_dup(ctx->cert);

ssl/ssl_lib.c:4135:5: Skipping ssl_cert_dup(): empty list of specs
  4133.       if (ctx == NULL)
  4134.           ctx = ssl->session_ctx;
  4135.       new_cert = ssl_cert_dup(ctx->cert);
              ^
  4136.       if (new_cert == NULL) {
  4137.           return NULL;

ssl/ssl_lib.c:4136:9: Taking false branch
  4134.           ctx = ssl->session_ctx;
  4135.       new_cert = ssl_cert_dup(ctx->cert);
  4136.       if (new_cert == NULL) {
                  ^
  4137.           return NULL;
  4138.       }

ssl/ssl_lib.c:4140:10: Taking false branch
  4138.       }
  4139.   
  4140.       if (!custom_exts_copy_flags(&new_cert->custext, &ssl->cert->custext)) {
                   ^
  4141.           ssl_cert_free(new_cert);
  4142.           return NULL;

ssl/ssl_lib.c:4145:5: 
  4143.       }
  4144.   
  4145. >     ssl_cert_free(ssl->cert);
  4146.       ssl->cert = new_cert;
  4147.   

ssl/ssl_cert.c:222:1: start of procedure ssl_cert_free()
    220.   }
    221.   
    222. > void ssl_cert_free(CERT *c)
    223.   {
    224.       int i;

ssl/ssl_cert.c:226:9: Taking true branch
    224.       int i;
    225.   
    226.       if (c == NULL)
                   ^
    227.           return;
    228.       CRYPTO_DOWN_REF(&c->references, &i, c->lock);

ssl/ssl_cert.c:227:9: 
    225.   
    226.       if (c == NULL)
    227. >         return;
    228.       CRYPTO_DOWN_REF(&c->references, &i, c->lock);
    229.       REF_PRINT_COUNT("CERT", c);

ssl/ssl_cert.c:250:1: return from a call to ssl_cert_free
    248.       CRYPTO_THREAD_lock_free(c->lock);
    249.       OPENSSL_free(c);
    250. > }
    251.   
    252.   int ssl_cert_set0_chain(SSL *s, SSL_CTX *ctx, STACK_OF(X509) *chain)

ssl/ssl_lib.c:4146:5: 
  4144.   
  4145.       ssl_cert_free(ssl->cert);
  4146. >     ssl->cert = new_cert;
  4147.   
  4148.       /*

ssl/ssl_lib.c:4152:10: Condition is true
  4150.        * so setter APIs must prevent invalid lengths from entering the system.
  4151.        */
  4152.       if (!ossl_assert(ssl->sid_ctx_length <= sizeof(ssl->sid_ctx)))
                   ^
  4153.           return NULL;
  4154.   

ssl/ssl_lib.c:4152:10: Taking false branch
  4150.        * so setter APIs must prevent invalid lengths from entering the system.
  4151.        */
  4152.       if (!ossl_assert(ssl->sid_ctx_length <= sizeof(ssl->sid_ctx)))
                   ^
  4153.           return NULL;
  4154.   

ssl/ssl_lib.c:4161:10: Taking false branch
  4159.        * leave it unchanged.
  4160.        */
  4161.       if ((ssl->ctx != NULL) &&
                   ^
  4162.           (ssl->sid_ctx_length == ssl->ctx->sid_ctx_length) &&
  4163.           (memcmp(ssl->sid_ctx, ssl->ctx->sid_ctx, ssl->sid_ctx_length) == 0)) {

ssl/ssl_lib.c:4168:5: 
  4166.       }
  4167.   
  4168. >     SSL_CTX_up_ref(ctx);
  4169.       SSL_CTX_free(ssl->ctx);     /* decrement reference count */
  4170.       ssl->ctx = ctx;

ssl/ssl_lib.c:3227:1: start of procedure SSL_CTX_up_ref()
    3225.   }
    3226.   
    3227. > int SSL_CTX_up_ref(SSL_CTX *ctx)
    3228.   {
    3229.       int i;

ssl/ssl_lib.c:3231:9: 
    3229.       int i;
    3230.   
    3231. >     if (CRYPTO_UP_REF(&ctx->references, &i, ctx->lock) <= 0)
    3232.           return 0;
    3233.   

include/internal/refcount.h:33:1: start of procedure CRYPTO_UP_REF()
      31.   typedef _Atomic int CRYPTO_REF_COUNT;
      32.   
      33. > static inline int CRYPTO_UP_REF(_Atomic int *val, int *ret, void *lock)
      34.   {
      35.       *ret = atomic_fetch_add_explicit(val, 1, memory_order_relaxed) + 1;

include/internal/refcount.h:35:5: 
      33.   static inline int CRYPTO_UP_REF(_Atomic int *val, int *ret, void *lock)
      34.   {
      35. >     *ret = atomic_fetch_add_explicit(val, 1, memory_order_relaxed) + 1;
      36.       return 1;
      37.   }

include/internal/refcount.h:36:5: 
      34.   {
      35.       *ret = atomic_fetch_add_explicit(val, 1, memory_order_relaxed) + 1;
      36. >     return 1;
      37.   }
      38.   

include/internal/refcount.h:37:1: return from a call to CRYPTO_UP_REF
      35.       *ret = atomic_fetch_add_explicit(val, 1, memory_order_relaxed) + 1;
      36.       return 1;
      37. > }
      38.   
      39.   /*

ssl/ssl_lib.c:3231:9: Taking false branch
    3229.       int i;
    3230.   
    3231.       if (CRYPTO_UP_REF(&ctx->references, &i, ctx->lock) <= 0)
                    ^
    3232.           return 0;
    3233.   

ssl/ssl_lib.c:3236:14: Condition is false
    3234.       REF_PRINT_COUNT("SSL_CTX", ctx);
    3235.       REF_ASSERT_ISNT(i < 2);
    3236.       return ((i > 1) ? 1 : 0);
                         ^
    3237.   }
    3238.   

ssl/ssl_lib.c:3236:13: 
    3234.       REF_PRINT_COUNT("SSL_CTX", ctx);
    3235.       REF_ASSERT_ISNT(i < 2);
    3236. >     return ((i > 1) ? 1 : 0);
    3237.   }
    3238.   

ssl/ssl_lib.c:3236:5: 
    3234.       REF_PRINT_COUNT("SSL_CTX", ctx);
    3235.       REF_ASSERT_ISNT(i < 2);
    3236. >     return ((i > 1) ? 1 : 0);
    3237.   }
    3238.   

ssl/ssl_lib.c:3237:1: return from a call to SSL_CTX_up_ref
    3235.       REF_ASSERT_ISNT(i < 2);
    3236.       return ((i > 1) ? 1 : 0);
    3237. > }
    3238.   
    3239.   void SSL_CTX_free(SSL_CTX *a)

ssl/ssl_lib.c:4169:5: Skipping SSL_CTX_free(): empty list of specs
  4167.   
  4168.       SSL_CTX_up_ref(ctx);
  4169.       SSL_CTX_free(ssl->ctx);     /* decrement reference count */
              ^
  4170.       ssl->ctx = ctx;
  4171.   

ssl/ssl_lib.c:4170:5: 
  4168.       SSL_CTX_up_ref(ctx);
  4169.       SSL_CTX_free(ssl->ctx);     /* decrement reference count */
  4170. >     ssl->ctx = ctx;
  4171.   
  4172.       return ssl->ctx;

ssl/ssl_lib.c:4172:5: 
  4170.       ssl->ctx = ctx;
  4171.   
  4172. >     return ssl->ctx;
  4173.   }
  4174.   

ssl/ssl_lib.c:4173:1: return from a call to SSL_set_SSL_CTX
  4171.   
  4172.       return ssl->ctx;
  4173. > }
  4174.   
  4175.   int SSL_CTX_set_default_verify_paths(SSL_CTX *ctx)

test/handshake_helper.c:197:9: 
195.            * contexts differ/conflict
196.            */
197. >         SSL_clear_options(s, 0xFFFFFFFFL);
198.           SSL_set_options(s, SSL_CTX_get_options(new_ctx));
199.   

ssl/ssl_lib.c:4739:1: start of procedure SSL_clear_options()
  4737.   }
  4738.   
  4739. > unsigned long SSL_clear_options(SSL *s, unsigned long op)
  4740.   {
  4741.       return s->options &= ~op;

ssl/ssl_lib.c:4741:5: 
  4739.   unsigned long SSL_clear_options(SSL *s, unsigned long op)
  4740.   {
  4741. >     return s->options &= ~op;
  4742.   }
  4743.   

ssl/ssl_lib.c:4742:1: return from a call to SSL_clear_options
  4740.   {
  4741.       return s->options &= ~op;
  4742. > }
  4743.   
  4744.   STACK_OF(X509) *SSL_get0_verified_chain(const SSL *s)

test/handshake_helper.c:198:9: 
196.            */
197.           SSL_clear_options(s, 0xFFFFFFFFL);
198. >         SSL_set_options(s, SSL_CTX_get_options(new_ctx));
199.   
200.           ex_data->servername = SSL_TEST_SERVERNAME_SERVER2;

ssl/ssl_lib.c:4714:1: start of procedure SSL_CTX_get_options()
  4712.    * control interface.
  4713.    */
  4714. > unsigned long SSL_CTX_get_options(const SSL_CTX *ctx)
  4715.   {
  4716.       return ctx->options;

ssl/ssl_lib.c:4716:5: 
  4714.   unsigned long SSL_CTX_get_options(const SSL_CTX *ctx)
  4715.   {
  4716. >     return ctx->options;
  4717.   }
  4718.   

ssl/ssl_lib.c:4717:1: return from a call to SSL_CTX_get_options
  4715.   {
  4716.       return ctx->options;
  4717. > }
  4718.   
  4719.   unsigned long SSL_get_options(const SSL *s)

ssl/ssl_lib.c:4729:1: start of procedure SSL_set_options()
  4727.   }
  4728.   
  4729. > unsigned long SSL_set_options(SSL *s, unsigned long op)
  4730.   {
  4731.       return s->options |= op;

ssl/ssl_lib.c:4731:5: 
  4729.   unsigned long SSL_set_options(SSL *s, unsigned long op)
  4730.   {
  4731. >     return s->options |= op;
  4732.   }
  4733.   

ssl/ssl_lib.c:4732:1: return from a call to SSL_set_options
  4730.   {
  4731.       return s->options |= op;
  4732. > }
  4733.   
  4734.   unsigned long SSL_CTX_clear_options(SSL_CTX *ctx, unsigned long op)

test/handshake_helper.c:200:9: 
198.           SSL_set_options(s, SSL_CTX_get_options(new_ctx));
199.   
200. >         ex_data->servername = SSL_TEST_SERVERNAME_SERVER2;
201.           return 1;
202.       } else if (len == strlen("server1") &&

static int client_hello_select_server_ctx(SSL *s, void *arg, int ignore)
{
    const char *servername;
    const unsigned char *p;
    size_t len, remaining;
    HANDSHAKE_EX_DATA *ex_data =
        (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx));
    if (!SSL_client_hello_get0_ext(s, TLSEXT_TYPE_server_name, &p,
                                   &remaining) ||
        remaining <= 2)
        return 0;
    len = (*(p++) << 8);
    len += *(p++);
    if (len + 2 != remaining)
        return 0;
    remaining = len;
    if (remaining == 0 || *p++ != TLSEXT_NAMETYPE_host_name)
        return 0;
    remaining--;
    if (remaining <= 2)
        return 0;
    len = (*(p++) << 8);
    len += *(p++);
    if (len + 2 > remaining)
        return 0;
    remaining = len;
    servername = (const char *)p;
    if (len == strlen("server2") && strncmp(servername, "server2", len) == 0) {
        SSL_CTX *new_ctx = arg;
        SSL_set_SSL_CTX(s, new_ctx);
        SSL_clear_options(s, 0xFFFFFFFFL);
        SSL_set_options(s, SSL_CTX_get_options(new_ctx));
        ex_data->servername = SSL_TEST_SERVERNAME_SERVER2;
        return 1;
    } else if (len == strlen("server1") &&
               strncmp(servername, "server1", len) == 0) {
        ex_data->servername = SSL_TEST_SERVERNAME_SERVER1;
        return 1;
    } else if (ignore) {
        ex_data->servername = SSL_TEST_SERVERNAME_SERVER1;
        return 1;
    }
    return 0;
}
['static int client_hello_select_server_ctx(SSL *s, void *arg, int ignore)\n{\n    const char *servername;\n    const unsigned char *p;\n    size_t len, remaining;\n    HANDSHAKE_EX_DATA *ex_data =\n        (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx));\n    if (!SSL_client_hello_get0_ext(s, TLSEXT_TYPE_server_name, &p,\n                                   &remaining) ||\n        remaining <= 2)\n        return 0;\n    len = (*(p++) << 8);\n    len += *(p++);\n    if (len + 2 != remaining)\n        return 0;\n    remaining = len;\n    if (remaining == 0 || *p++ != TLSEXT_NAMETYPE_host_name)\n        return 0;\n    remaining--;\n    if (remaining <= 2)\n        return 0;\n    len = (*(p++) << 8);\n    len += *(p++);\n    if (len + 2 > remaining)\n        return 0;\n    remaining = len;\n    servername = (const char *)p;\n    if (len == strlen("server2") && strncmp(servername, "server2", len) == 0) {\n        SSL_CTX *new_ctx = arg;\n        SSL_set_SSL_CTX(s, new_ctx);\n        SSL_clear_options(s, 0xFFFFFFFFL);\n        SSL_set_options(s, SSL_CTX_get_options(new_ctx));\n        ex_data->servername = SSL_TEST_SERVERNAME_SERVER2;\n        return 1;\n    } else if (len == strlen("server1") &&\n               strncmp(servername, "server1", len) == 0) {\n        ex_data->servername = SSL_TEST_SERVERNAME_SERVER1;\n        return 1;\n    } else if (ignore) {\n        ex_data->servername = SSL_TEST_SERVERNAME_SERVER1;\n        return 1;\n    }\n    return 0;\n}', 'void *SSL_get_ex_data(const SSL *s, int idx)\n{\n    return CRYPTO_get_ex_data(&s->ex_data, idx);\n}', 'void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx)\n{\n    if (ad->sk == NULL || idx >= sk_void_num(ad->sk))\n        return NULL;\n    return sk_void_value(ad->sk, idx);\n}', 'SSL_CTX *SSL_set_SSL_CTX(SSL *ssl, SSL_CTX *ctx)\n{\n    CERT *new_cert;\n    if (ssl->ctx == ctx)\n        return ssl->ctx;\n    if (ctx == NULL)\n        ctx = ssl->session_ctx;\n    new_cert = ssl_cert_dup(ctx->cert);\n    if (new_cert == NULL) {\n        return NULL;\n    }\n    if (!custom_exts_copy_flags(&new_cert->custext, &ssl->cert->custext)) {\n        ssl_cert_free(new_cert);\n        return NULL;\n    }\n    ssl_cert_free(ssl->cert);\n    ssl->cert = new_cert;\n    if (!ossl_assert(ssl->sid_ctx_length <= sizeof(ssl->sid_ctx)))\n        return NULL;\n    if ((ssl->ctx != NULL) &&\n        (ssl->sid_ctx_length == ssl->ctx->sid_ctx_length) &&\n        (memcmp(ssl->sid_ctx, ssl->ctx->sid_ctx, ssl->sid_ctx_length) == 0)) {\n        ssl->sid_ctx_length = ctx->sid_ctx_length;\n        memcpy(&ssl->sid_ctx, &ctx->sid_ctx, sizeof(ssl->sid_ctx));\n    }\n    SSL_CTX_up_ref(ctx);\n    SSL_CTX_free(ssl->ctx);\n    ssl->ctx = ctx;\n    return ssl->ctx;\n}', 'void ssl_cert_free(CERT *c)\n{\n    int i;\n    if (c == NULL)\n        return;\n    CRYPTO_DOWN_REF(&c->references, &i, c->lock);\n    REF_PRINT_COUNT("CERT", c);\n    if (i > 0)\n        return;\n    REF_ASSERT_ISNT(i < 0);\n#ifndef OPENSSL_NO_DH\n    EVP_PKEY_free(c->dh_tmp);\n#endif\n    ssl_cert_clear_certs(c);\n    OPENSSL_free(c->conf_sigalgs);\n    OPENSSL_free(c->client_sigalgs);\n    OPENSSL_free(c->ctype);\n    X509_STORE_free(c->verify_store);\n    X509_STORE_free(c->chain_store);\n    custom_exts_free(&c->custext);\n#ifndef OPENSSL_NO_PSK\n    OPENSSL_free(c->psk_identity_hint);\n#endif\n    CRYPTO_THREAD_lock_free(c->lock);\n    OPENSSL_free(c);\n}', 'int SSL_CTX_up_ref(SSL_CTX *ctx)\n{\n    int i;\n    if (CRYPTO_UP_REF(&ctx->references, &i, ctx->lock) <= 0)\n        return 0;\n    REF_PRINT_COUNT("SSL_CTX", ctx);\n    REF_ASSERT_ISNT(i < 2);\n    return ((i > 1) ? 1 : 0);\n}', 'static inline int CRYPTO_UP_REF(_Atomic int *val, int *ret, void *lock)\n{\n    *ret = atomic_fetch_add_explicit(val, 1, memory_order_relaxed) + 1;\n    return 1;\n}', 'unsigned long SSL_clear_options(SSL *s, unsigned long op)\n{\n    return s->options &= ~op;\n}', 'unsigned long SSL_CTX_get_options(const SSL_CTX *ctx)\n{\n    return ctx->options;\n}', 'unsigned long SSL_set_options(SSL *s, unsigned long op)\n{\n    return s->options |= op;\n}']