test/handshake_helper.c:930: error: INTEGER_OVERFLOW_L2
  ([0, +oo] - 1):unsigned64 by call to `SSL_set_session`.
Showing all 23 steps of the trace


test/handshake_helper.c:921:5: Call
919.       /* Setup SSL and buffers; additional configuration happens below. */
920.       create_peer(&server, server_ctx);
921.       create_peer(&client, client_ctx);
           ^
922.   
923.       server.bytes_to_write = client.bytes_to_read = test_ctx->app_data_size;

test/handshake_helper.c:484:17: Call
  482.       static const int peer_buffer_size = 64 * 1024;
  483.   
  484.       peer->ssl = SSL_new(ctx);
                         ^
  485.       TEST_check(peer->ssl != NULL);
  486.       peer->write_buf = OPENSSL_zalloc(peer_buffer_size);

ssl/ssl_lib.c:519:1: Parameter `ctx->sessions->num_items`
    517.   }
    518.   
    519. > SSL *SSL_new(SSL_CTX *ctx)
    520.   {
    521.       SSL *s;

test/handshake_helper.c:929:9: Call
927.       if (session_in != NULL) {
928.           /* In case we're testing resumption without tickets. */
929.           TEST_check(SSL_CTX_add_session(server_ctx, session_in));
               ^
930.           TEST_check(SSL_set_session(client.ssl, session_in));
931.       }

ssl/ssl_sess.c:648:1: Parameter `ctx->sessions->num_items`
  646.   }
  647.   
  648. > int SSL_CTX_add_session(SSL_CTX *ctx, SSL_SESSION *c)
  649.   {
  650.       int ret = 0;

ssl/ssl_sess.c:664:9: Call
  662.   
  663.       CRYPTO_THREAD_write_lock(ctx->lock);
  664.       s = lh_SSL_SESSION_insert(ctx->sessions, c);
                 ^
  665.   
  666.       /*

ssl/ssl_locl.h:626:1: Parameter `lh->num_items`
    624.   };
    625.   
    626. > DEFINE_LHASH_OF(SSL_SESSION);
    627.   /* Needed in ssl_cert.c */
    628.   DEFINE_LHASH_OF(X509_NAME);

ssl/ssl_locl.h:626:1: Call
    624.   };
    625.   
    626. > DEFINE_LHASH_OF(SSL_SESSION);
    627.   /* Needed in ssl_cert.c */
    628.   DEFINE_LHASH_OF(X509_NAME);

crypto/lhash/lhash.c:70:1: Parameter `lh->num_items`
      68.   }
      69.   
      70. > void *OPENSSL_LH_insert(OPENSSL_LHASH *lh, void *data)
      71.   {
      72.       unsigned long hash;

test/handshake_helper.c:930:9: Call
928.           /* In case we're testing resumption without tickets. */
929.           TEST_check(SSL_CTX_add_session(server_ctx, session_in));
930.           TEST_check(SSL_set_session(client.ssl, session_in));
               ^
931.       }
932.   

ssl/ssl_sess.c:811:1: Parameter `s->session_ctx->sessions->num_items`
  809.   }
  810.   
  811. > int SSL_set_session(SSL *s, SSL_SESSION *session)
  812.   {
  813.       ssl_clear_bad_session(s);

ssl/ssl_sess.c:813:5: Call
  811.   int SSL_set_session(SSL *s, SSL_SESSION *session)
  812.   {
  813.       ssl_clear_bad_session(s);
             ^
  814.       if (s->ctx->method != s->method) {
  815.           if (!SSL_set_ssl_method(s, s->ctx->method))

ssl/ssl_sess.c:1031:1: Parameter `s->session_ctx->sessions->num_items`
    1029.   }
    1030.   
    1031. > int ssl_clear_bad_session(SSL *s)
    1032.   {
    1033.       if ((s->session != NULL) &&

ssl/ssl_sess.c:1036:9: Call
    1034.           !(s->shutdown & SSL_SENT_SHUTDOWN) &&
    1035.           !(SSL_in_init(s) || SSL_in_before(s))) {
    1036.           SSL_CTX_remove_session(s->session_ctx, s->session);
                    ^
    1037.           return (1);
    1038.       } else

ssl/ssl_sess.c:725:1: Parameter `ctx->sessions->num_items`
      723.   }
      724.   
      725. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c)
      726.   {
      727.       return remove_session_lock(ctx, c, 1);

ssl/ssl_sess.c:727:12: Call
      725.   int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c)
      726.   {
      727.       return remove_session_lock(ctx, c, 1);
                        ^
      728.   }
      729.   

ssl/ssl_sess.c:730:1: Parameter `ctx->sessions->num_items`
        728.   }
        729.   
        730. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck)
        731.   {
        732.       SSL_SESSION *r;

ssl/ssl_sess.c:740:17: Call
        738.           if ((r = lh_SSL_SESSION_retrieve(ctx->sessions, c)) == c) {
        739.               ret = 1;
        740.               r = lh_SSL_SESSION_delete(ctx->sessions, c);
                               ^
        741.               SSL_SESSION_list_remove(ctx, c);
        742.           }

ssl/ssl_locl.h:626:1: Parameter `lh->num_items`
          624.   };
          625.   
          626. > DEFINE_LHASH_OF(SSL_SESSION);
          627.   /* Needed in ssl_cert.c */
          628.   DEFINE_LHASH_OF(X509_NAME);

ssl/ssl_locl.h:626:1: Call
          624.   };
          625.   
          626. > DEFINE_LHASH_OF(SSL_SESSION);
          627.   /* Needed in ssl_cert.c */
          628.   DEFINE_LHASH_OF(X509_NAME);

crypto/lhash/lhash.c:103:1: <LHS trace>
101.   }
102.   
103. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data)
104.   {
105.       unsigned long hash;

crypto/lhash/lhash.c:103:1: Parameter `lh->num_items`
            101.   }
            102.   
            103. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data)
            104.   {
            105.       unsigned long hash;

crypto/lhash/lhash.c:123:5: Binary operation: ([0, +oo] - 1):unsigned64 by call to `SSL_set_session` 
            121.       }
            122.   
            123.       lh->num_items--;
                       ^
            124.       if ((lh->num_nodes > MIN_NODES) &&
            125.           (lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)))

void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data)
{
    unsigned long hash;
    OPENSSL_LH_NODE *nn, **rn;
    void *ret;
    lh->error = 0;
    rn = getrn(lh, data, &hash);
    if (*rn == NULL) {
        lh->num_no_delete++;
        return (NULL);
    } else {
        nn = *rn;
        *rn = nn->next;
        ret = nn->data;
        OPENSSL_free(nn);
        lh->num_delete++;
    }
    lh->num_items--;
    if ((lh->num_nodes > MIN_NODES) &&
        (lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)))
        contract(lh);
    return (ret);
}
['static HANDSHAKE_RESULT *do_handshake_internal(\n    SSL_CTX *server_ctx, SSL_CTX *server2_ctx, SSL_CTX *client_ctx,\n    const SSL_TEST_CTX *test_ctx, const SSL_TEST_EXTRA_CONF *extra,\n    SSL_SESSION *session_in, SSL_SESSION **session_out)\n{\n    PEER server, client;\n    BIO *client_to_server, *server_to_client;\n    HANDSHAKE_EX_DATA server_ex_data, client_ex_data;\n    CTX_DATA client_ctx_data, server_ctx_data, server2_ctx_data;\n    HANDSHAKE_RESULT *ret = HANDSHAKE_RESULT_new();\n    int client_turn = 1, client_turn_count = 0;\n    connect_phase_t phase = HANDSHAKE;\n    handshake_status_t status = HANDSHAKE_RETRY;\n    const unsigned char* tick = NULL;\n    size_t tick_len = 0;\n    SSL_SESSION* sess = NULL;\n    const unsigned char *proto = NULL;\n    unsigned int proto_len = 0;\n    EVP_PKEY *tmp_key;\n    memset(&server_ctx_data, 0, sizeof(server_ctx_data));\n    memset(&server2_ctx_data, 0, sizeof(server2_ctx_data));\n    memset(&client_ctx_data, 0, sizeof(client_ctx_data));\n    memset(&server, 0, sizeof(server));\n    memset(&client, 0, sizeof(client));\n    configure_handshake_ctx(server_ctx, server2_ctx, client_ctx, test_ctx, extra,\n                            &server_ctx_data, &server2_ctx_data, &client_ctx_data);\n    create_peer(&server, server_ctx);\n    create_peer(&client, client_ctx);\n    server.bytes_to_write = client.bytes_to_read = test_ctx->app_data_size;\n    client.bytes_to_write = server.bytes_to_read = test_ctx->app_data_size;\n    configure_handshake_ssl(server.ssl, client.ssl, extra);\n    if (session_in != NULL) {\n        TEST_check(SSL_CTX_add_session(server_ctx, session_in));\n        TEST_check(SSL_set_session(client.ssl, session_in));\n    }\n    memset(&server_ex_data, 0, sizeof(server_ex_data));\n    memset(&client_ex_data, 0, sizeof(client_ex_data));\n    ret->result = SSL_TEST_INTERNAL_ERROR;\n    client_to_server = BIO_new(BIO_s_mem());\n    server_to_client = BIO_new(BIO_s_mem());\n    TEST_check(client_to_server != NULL);\n    TEST_check(server_to_client != NULL);\n    BIO_set_nbio(client_to_server, 1);\n    BIO_set_nbio(server_to_client, 1);\n    SSL_set_connect_state(client.ssl);\n    SSL_set_accept_state(server.ssl);\n    SSL_set_bio(client.ssl, server_to_client, client_to_server);\n    TEST_check(BIO_up_ref(server_to_client) > 0);\n    TEST_check(BIO_up_ref(client_to_server) > 0);\n    SSL_set_bio(server.ssl, client_to_server, server_to_client);\n    ex_data_idx = SSL_get_ex_new_index(0, "ex data", NULL, NULL, NULL);\n    TEST_check(ex_data_idx >= 0);\n    TEST_check(SSL_set_ex_data(server.ssl, ex_data_idx, &server_ex_data) == 1);\n    TEST_check(SSL_set_ex_data(client.ssl, ex_data_idx, &client_ex_data) == 1);\n    SSL_set_info_callback(server.ssl, &info_cb);\n    SSL_set_info_callback(client.ssl, &info_cb);\n    client.status = server.status = PEER_RETRY;\n    for(;;) {\n        if (client_turn) {\n            do_connect_step(test_ctx, &client, phase);\n            status = handshake_status(client.status, server.status,\n                                      1  );\n        } else {\n            do_connect_step(test_ctx, &server, phase);\n            status = handshake_status(server.status, client.status,\n                                      0  );\n        }\n        switch (status) {\n        case HANDSHAKE_SUCCESS:\n            client_turn_count = 0;\n            phase = next_phase(test_ctx, phase);\n            if (phase == CONNECTION_DONE) {\n                ret->result = SSL_TEST_SUCCESS;\n                goto err;\n            } else {\n                client.status = server.status = PEER_RETRY;\n                client_turn = 1;\n                break;\n            }\n        case CLIENT_ERROR:\n            ret->result = SSL_TEST_CLIENT_FAIL;\n            goto err;\n        case SERVER_ERROR:\n            ret->result = SSL_TEST_SERVER_FAIL;\n            goto err;\n        case INTERNAL_ERROR:\n            ret->result = SSL_TEST_INTERNAL_ERROR;\n            goto err;\n        case HANDSHAKE_RETRY:\n            if (client_turn_count++ >= 2000) {\n                ret->result = SSL_TEST_INTERNAL_ERROR;\n                goto err;\n            }\n            client_turn ^= 1;\n            break;\n        }\n    }\n err:\n    ret->server_alert_sent = server_ex_data.alert_sent;\n    ret->server_num_fatal_alerts_sent = server_ex_data.num_fatal_alerts_sent;\n    ret->server_alert_received = client_ex_data.alert_received;\n    ret->client_alert_sent = client_ex_data.alert_sent;\n    ret->client_num_fatal_alerts_sent = client_ex_data.num_fatal_alerts_sent;\n    ret->client_alert_received = server_ex_data.alert_received;\n    ret->server_protocol = SSL_version(server.ssl);\n    ret->client_protocol = SSL_version(client.ssl);\n    ret->servername = server_ex_data.servername;\n    if ((sess = SSL_get0_session(client.ssl)) != NULL)\n        SSL_SESSION_get0_ticket(sess, &tick, &tick_len);\n    if (tick == NULL || tick_len == 0)\n        ret->session_ticket = SSL_TEST_SESSION_TICKET_NO;\n    else\n        ret->session_ticket = SSL_TEST_SESSION_TICKET_YES;\n    ret->session_ticket_do_not_call = server_ex_data.session_ticket_do_not_call;\n#ifndef OPENSSL_NO_NEXTPROTONEG\n    SSL_get0_next_proto_negotiated(client.ssl, &proto, &proto_len);\n    ret->client_npn_negotiated = dup_str(proto, proto_len);\n    SSL_get0_next_proto_negotiated(server.ssl, &proto, &proto_len);\n    ret->server_npn_negotiated = dup_str(proto, proto_len);\n#endif\n    SSL_get0_alpn_selected(client.ssl, &proto, &proto_len);\n    ret->client_alpn_negotiated = dup_str(proto, proto_len);\n    SSL_get0_alpn_selected(server.ssl, &proto, &proto_len);\n    ret->server_alpn_negotiated = dup_str(proto, proto_len);\n    ret->client_resumed = SSL_session_reused(client.ssl);\n    ret->server_resumed = SSL_session_reused(server.ssl);\n    if (session_out != NULL)\n        *session_out = SSL_get1_session(client.ssl);\n    if (SSL_get_server_tmp_key(client.ssl, &tmp_key)) {\n        ret->tmp_key_type = pkey_type(tmp_key);\n        EVP_PKEY_free(tmp_key);\n    }\n    SSL_get_peer_signature_nid(client.ssl, &ret->server_sign_hash);\n    SSL_get_peer_signature_nid(server.ssl, &ret->client_sign_hash);\n    SSL_get_peer_signature_type_nid(client.ssl, &ret->server_sign_type);\n    SSL_get_peer_signature_type_nid(server.ssl, &ret->client_sign_type);\n    ret->server_cert_type = peer_pkey_type(client.ssl);\n    ret->client_cert_type = peer_pkey_type(server.ssl);\n    ctx_data_free_data(&server_ctx_data);\n    ctx_data_free_data(&server2_ctx_data);\n    ctx_data_free_data(&client_ctx_data);\n    peer_free_data(&server);\n    peer_free_data(&client);\n    return ret;\n}', 'static void create_peer(PEER *peer, SSL_CTX *ctx)\n{\n    static const int peer_buffer_size = 64 * 1024;\n    peer->ssl = SSL_new(ctx);\n    TEST_check(peer->ssl != NULL);\n    peer->write_buf = OPENSSL_zalloc(peer_buffer_size);\n    TEST_check(peer->write_buf != NULL);\n    peer->read_buf = OPENSSL_zalloc(peer_buffer_size);\n    TEST_check(peer->read_buf != NULL);\n    peer->write_buf_len = peer->read_buf_len = peer_buffer_size;\n}', 'SSL *SSL_new(SSL_CTX *ctx)\n{\n    SSL *s;\n    if (ctx == NULL) {\n        SSLerr(SSL_F_SSL_NEW, SSL_R_NULL_SSL_CTX);\n        return (NULL);\n    }\n    if (ctx->method == NULL) {\n        SSLerr(SSL_F_SSL_NEW, SSL_R_SSL_CTX_HAS_NO_DEFAULT_SSL_VERSION);\n        return (NULL);\n    }\n    s = OPENSSL_zalloc(sizeof(*s));\n    if (s == NULL)\n        goto err;\n    s->lock = CRYPTO_THREAD_lock_new();\n    if (s->lock == NULL) {\n        SSLerr(SSL_F_SSL_NEW, ERR_R_MALLOC_FAILURE);\n        OPENSSL_free(s);\n        return NULL;\n    }\n    RECORD_LAYER_init(&s->rlayer, s);\n    s->options = ctx->options;\n    s->dane.flags = ctx->dane.flags;\n    s->min_proto_version = ctx->min_proto_version;\n    s->max_proto_version = ctx->max_proto_version;\n    s->mode = ctx->mode;\n    s->max_cert_list = ctx->max_cert_list;\n    s->references = 1;\n    s->cert = ssl_cert_dup(ctx->cert);\n    if (s->cert == NULL)\n        goto err;\n    RECORD_LAYER_set_read_ahead(&s->rlayer, ctx->read_ahead);\n    s->msg_callback = ctx->msg_callback;\n    s->msg_callback_arg = ctx->msg_callback_arg;\n    s->verify_mode = ctx->verify_mode;\n    s->not_resumable_session_cb = ctx->not_resumable_session_cb;\n    s->sid_ctx_length = ctx->sid_ctx_length;\n    OPENSSL_assert(s->sid_ctx_length <= sizeof s->sid_ctx);\n    memcpy(&s->sid_ctx, &ctx->sid_ctx, sizeof(s->sid_ctx));\n    s->verify_callback = ctx->default_verify_callback;\n    s->generate_session_id = ctx->generate_session_id;\n    s->param = X509_VERIFY_PARAM_new();\n    if (s->param == NULL)\n        goto err;\n    X509_VERIFY_PARAM_inherit(s->param, ctx->param);\n    s->quiet_shutdown = ctx->quiet_shutdown;\n    s->max_send_fragment = ctx->max_send_fragment;\n    s->split_send_fragment = ctx->split_send_fragment;\n    s->max_pipelines = ctx->max_pipelines;\n    if (s->max_pipelines > 1)\n        RECORD_LAYER_set_read_ahead(&s->rlayer, 1);\n    if (ctx->default_read_buf_len > 0)\n        SSL_set_default_read_buffer_len(s, ctx->default_read_buf_len);\n    SSL_CTX_up_ref(ctx);\n    s->ctx = ctx;\n    s->ext.debug_cb = 0;\n    s->ext.debug_arg = NULL;\n    s->ext.ticket_expected = 0;\n    s->ext.status_type = ctx->ext.status_type;\n    s->ext.status_expected = 0;\n    s->ext.ocsp.ids = NULL;\n    s->ext.ocsp.exts = NULL;\n    s->ext.ocsp.resp = NULL;\n    s->ext.ocsp.resp_len = 0;\n    SSL_CTX_up_ref(ctx);\n    s->session_ctx = ctx;\n#ifndef OPENSSL_NO_EC\n    if (ctx->ext.ecpointformats) {\n        s->ext.ecpointformats =\n            OPENSSL_memdup(ctx->ext.ecpointformats,\n                           ctx->ext.ecpointformats_len);\n        if (!s->ext.ecpointformats)\n            goto err;\n        s->ext.ecpointformats_len =\n            ctx->ext.ecpointformats_len;\n    }\n    if (ctx->ext.supportedgroups) {\n        s->ext.supportedgroups =\n            OPENSSL_memdup(ctx->ext.supportedgroups,\n                           ctx->ext.supportedgroups_len);\n        if (!s->ext.supportedgroups)\n            goto err;\n        s->ext.supportedgroups_len = ctx->ext.supportedgroups_len;\n    }\n#endif\n#ifndef OPENSSL_NO_NEXTPROTONEG\n    s->ext.npn = NULL;\n#endif\n    if (s->ctx->ext.alpn) {\n        s->ext.alpn = OPENSSL_malloc(s->ctx->ext.alpn_len);\n        if (s->ext.alpn == NULL)\n            goto err;\n        memcpy(s->ext.alpn, s->ctx->ext.alpn, s->ctx->ext.alpn_len);\n        s->ext.alpn_len = s->ctx->ext.alpn_len;\n    }\n    s->verified_chain = NULL;\n    s->verify_result = X509_V_OK;\n    s->default_passwd_callback = ctx->default_passwd_callback;\n    s->default_passwd_callback_userdata = ctx->default_passwd_callback_userdata;\n    s->method = ctx->method;\n    if (!s->method->ssl_new(s))\n        goto err;\n    s->server = (ctx->method->ssl_accept == ssl_undefined_function) ? 0 : 1;\n    if (!SSL_clear(s))\n        goto err;\n    if (!CRYPTO_new_ex_data(CRYPTO_EX_INDEX_SSL, s, &s->ex_data))\n        goto err;\n#ifndef OPENSSL_NO_PSK\n    s->psk_client_callback = ctx->psk_client_callback;\n    s->psk_server_callback = ctx->psk_server_callback;\n#endif\n    s->job = NULL;\n#ifndef OPENSSL_NO_CT\n    if (!SSL_set_ct_validation_callback(s, ctx->ct_validation_callback,\n                                        ctx->ct_validation_callback_arg))\n        goto err;\n#endif\n    return s;\n err:\n    SSL_free(s);\n    SSLerr(SSL_F_SSL_NEW, ERR_R_MALLOC_FAILURE);\n    return NULL;\n}', 'int SSL_CTX_add_session(SSL_CTX *ctx, SSL_SESSION *c)\n{\n    int ret = 0;\n    SSL_SESSION *s;\n    SSL_SESSION_up_ref(c);\n    CRYPTO_THREAD_write_lock(ctx->lock);\n    s = lh_SSL_SESSION_insert(ctx->sessions, c);\n    if (s != NULL && s != c) {\n        SSL_SESSION_list_remove(ctx, s);\n        SSL_SESSION_free(s);\n        s = NULL;\n    } else if (s == NULL &&\n               lh_SSL_SESSION_retrieve(ctx->sessions, c) == NULL) {\n        s = c;\n    }\n    if (s == NULL)\n        SSL_SESSION_list_add(ctx, c);\n    if (s != NULL) {\n        SSL_SESSION_free(s);\n        ret = 0;\n    } else {\n        ret = 1;\n        if (SSL_CTX_sess_get_cache_size(ctx) > 0) {\n            while (SSL_CTX_sess_number(ctx) > SSL_CTX_sess_get_cache_size(ctx)) {\n                if (!remove_session_lock(ctx, ctx->session_cache_tail, 0))\n                    break;\n                else\n                    ctx->stats.sess_cache_full++;\n            }\n        }\n    }\n    CRYPTO_THREAD_unlock(ctx->lock);\n    return ret;\n}', 'DEFINE_LHASH_OF(SSL_SESSION)', 'void *OPENSSL_LH_insert(OPENSSL_LHASH *lh, void *data)\n{\n    unsigned long hash;\n    OPENSSL_LH_NODE *nn, **rn;\n    void *ret;\n    lh->error = 0;\n    if ((lh->up_load <= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)) && !expand(lh))\n        return NULL;\n    rn = getrn(lh, data, &hash);\n    if (*rn == NULL) {\n        if ((nn = OPENSSL_malloc(sizeof(*nn))) == NULL) {\n            lh->error++;\n            return (NULL);\n        }\n        nn->data = data;\n        nn->next = NULL;\n        nn->hash = hash;\n        *rn = nn;\n        ret = NULL;\n        lh->num_insert++;\n        lh->num_items++;\n    } else {\n        ret = (*rn)->data;\n        (*rn)->data = data;\n        lh->num_replace++;\n    }\n    return (ret);\n}', 'int SSL_set_session(SSL *s, SSL_SESSION *session)\n{\n    ssl_clear_bad_session(s);\n    if (s->ctx->method != s->method) {\n        if (!SSL_set_ssl_method(s, s->ctx->method))\n            return 0;\n    }\n    if (session != NULL) {\n        SSL_SESSION_up_ref(session);\n        s->verify_result = session->verify_result;\n    }\n    SSL_SESSION_free(s->session);\n    s->session = session;\n    return 1;\n}', 'int ssl_clear_bad_session(SSL *s)\n{\n    if ((s->session != NULL) &&\n        !(s->shutdown & SSL_SENT_SHUTDOWN) &&\n        !(SSL_in_init(s) || SSL_in_before(s))) {\n        SSL_CTX_remove_session(s->session_ctx, s->session);\n        return (1);\n    } else\n        return (0);\n}', 'int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c)\n{\n    return remove_session_lock(ctx, c, 1);\n}', 'static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck)\n{\n    SSL_SESSION *r;\n    int ret = 0;\n    if ((c != NULL) && (c->session_id_length != 0)) {\n        if (lck)\n            CRYPTO_THREAD_write_lock(ctx->lock);\n        if ((r = lh_SSL_SESSION_retrieve(ctx->sessions, c)) == c) {\n            ret = 1;\n            r = lh_SSL_SESSION_delete(ctx->sessions, c);\n            SSL_SESSION_list_remove(ctx, c);\n        }\n        c->not_resumable = 1;\n        if (lck)\n            CRYPTO_THREAD_unlock(ctx->lock);\n        if (ret)\n            SSL_SESSION_free(r);\n        if (ctx->remove_session_cb != NULL)\n            ctx->remove_session_cb(ctx, c);\n    } else\n        ret = 0;\n    return (ret);\n}', 'void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data)\n{\n    unsigned long hash;\n    OPENSSL_LH_NODE *nn, **rn;\n    void *ret;\n    lh->error = 0;\n    rn = getrn(lh, data, &hash);\n    if (*rn == NULL) {\n        lh->num_no_delete++;\n        return (NULL);\n    } else {\n        nn = *rn;\n        *rn = nn->next;\n        ret = nn->data;\n        OPENSSL_free(nn);\n        lh->num_delete++;\n    }\n    lh->num_items--;\n    if ((lh->num_nodes > MIN_NODES) &&\n        (lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)))\n        contract(lh);\n    return (ret);\n}']