ssl/s3_srvr.c:1429: error: INTEGER_OVERFLOW_L2
  ([0, max(0, `s->ctx->sessions->num_items`)] - 1):unsigned64 by call to `ssl_check_clienthello_tlsext_late`.
Showing all 13 steps of the trace


ssl/s3_srvr.c:900:1: Parameter `s->ctx->sessions->num_items`
898.   }
899.   
900. > int ssl3_get_client_hello(SSL *s)
901.   {
902.       int i, j, ok, al = SSL_AD_INTERNAL_ERROR, ret = -1;

ssl/s3_srvr.c:1429:13: Call
1427.       /* Handles TLS extensions that we couldn't check earlier */
1428.       if (s->version >= SSL3_VERSION) {
1429.           if (ssl_check_clienthello_tlsext_late(s) <= 0) {
                    ^
1430.               SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO, SSL_R_CLIENTHELLO_TLSEXT);
1431.               goto err;

ssl/t1_lib.c:2952:1: Parameter `s->ctx->sessions->num_items`
  2950.   }
  2951.   
  2952. > int ssl_check_clienthello_tlsext_late(SSL *s)
  2953.   {
  2954.       int ret = SSL_TLSEXT_ERR_OK;

ssl/t1_lib.c:3002:9: Call
  3000.       switch (ret) {
  3001.       case SSL_TLSEXT_ERR_ALERT_FATAL:
  3002.           ssl3_send_alert(s, SSL3_AL_FATAL, al);
                  ^
  3003.           return -1;
  3004.   

ssl/s3_pkt.c:1760:1: Parameter `s->ctx->sessions->num_items`
    1758.   }
    1759.   
    1760. > int ssl3_send_alert(SSL *s, int level, int desc)
    1761.   {
    1762.       /* Map tls/ssl alert value to correct one */

ssl/s3_pkt.c:1771:9: Call
    1769.       /* If a fatal one, remove from cache */
    1770.       if ((level == SSL3_AL_FATAL) && (s->session != NULL))
    1771.           SSL_CTX_remove_session(s->ctx, s->session);
                    ^
    1772.   
    1773.       s->s3->alert_dispatch = 1;

ssl/ssl_sess.c:673:1: Parameter `ctx->sessions->num_items`
      671.   }
      672.   
      673. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c)
      674.   {
      675.       return remove_session_lock(ctx, c, 1);

ssl/ssl_sess.c:675:12: Call
      673.   int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c)
      674.   {
      675.       return remove_session_lock(ctx, c, 1);
                        ^
      676.   }
      677.   

ssl/ssl_sess.c:678:1: Parameter `ctx->sessions->num_items`
        676.   }
        677.   
        678. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck)
        679.   {
        680.       SSL_SESSION *r;

ssl/ssl_sess.c:688:17: Call
        686.           if ((r = lh_SSL_SESSION_retrieve(ctx->sessions, c)) == c) {
        687.               ret = 1;
        688.               r = lh_SSL_SESSION_delete(ctx->sessions, c);
                               ^
        689.               SSL_SESSION_list_remove(ctx, c);
        690.           }

crypto/lhash/lhash.c:213:1: <LHS trace>
211.   }
212.   
213. > void *lh_delete(_LHASH *lh, const void *data)
214.   {
215.       unsigned long hash;

crypto/lhash/lhash.c:213:1: Parameter `lh->num_items`
          211.   }
          212.   
          213. > void *lh_delete(_LHASH *lh, const void *data)
          214.   {
          215.       unsigned long hash;

crypto/lhash/lhash.c:233:5: Binary operation: ([0, max(0, s->ctx->sessions->num_items)] - 1):unsigned64 by call to `ssl_check_clienthello_tlsext_late` 
          231.       }
          232.   
          233.       lh->num_items--;
                     ^
          234.       if ((lh->num_nodes > MIN_NODES) &&
          235.           (lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)))

void *lh_delete(_LHASH *lh, const void *data)
{
    unsigned long hash;
    LHASH_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);
}
['int ssl3_get_client_hello(SSL *s)\n{\n    int i, j, ok, al = SSL_AD_INTERNAL_ERROR, ret = -1;\n    unsigned int cookie_len;\n    long n;\n    unsigned long id;\n    unsigned char *p, *d;\n    SSL_CIPHER *c;\n#ifndef OPENSSL_NO_COMP\n    unsigned char *q;\n    SSL_COMP *comp = NULL;\n#endif\n    STACK_OF(SSL_CIPHER) *ciphers = NULL;\n    if (s->state == SSL3_ST_SR_CLNT_HELLO_C && !s->first_packet)\n        goto retry_cert;\n    if (s->state == SSL3_ST_SR_CLNT_HELLO_A) {\n        s->state = SSL3_ST_SR_CLNT_HELLO_B;\n    }\n    s->first_packet = 1;\n    n = s->method->ssl_get_message(s,\n                                   SSL3_ST_SR_CLNT_HELLO_B,\n                                   SSL3_ST_SR_CLNT_HELLO_C,\n                                   SSL3_MT_CLIENT_HELLO,\n                                   SSL3_RT_MAX_PLAIN_LENGTH, &ok);\n    if (!ok)\n        return ((int)n);\n    s->first_packet = 0;\n    d = p = (unsigned char *)s->init_msg;\n    s->client_version = (((int)p[0]) << 8) | (int)p[1];\n    p += 2;\n    if (SSL_IS_DTLS(s) ? (s->client_version > s->version &&\n                          s->method->version != DTLS_ANY_VERSION)\n        : (s->client_version < s->version)) {\n        SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO, SSL_R_WRONG_VERSION_NUMBER);\n        if ((s->client_version >> 8) == SSL3_VERSION_MAJOR &&\n            !s->enc_write_ctx && !s->write_hash) {\n            s->version = s->client_version;\n        }\n        al = SSL_AD_PROTOCOL_VERSION;\n        goto f_err;\n    }\n    if (SSL_get_options(s) & SSL_OP_COOKIE_EXCHANGE) {\n        unsigned int session_length, cookie_length;\n        session_length = *(p + SSL3_RANDOM_SIZE);\n        cookie_length = *(p + SSL3_RANDOM_SIZE + session_length + 1);\n        if (cookie_length == 0)\n            return 1;\n    }\n    memcpy(s->s3->client_random, p, SSL3_RANDOM_SIZE);\n    p += SSL3_RANDOM_SIZE;\n    j = *(p++);\n    s->hit = 0;\n    if ((s->new_session\n         && (s->options & SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION))) {\n        if (!ssl_get_new_session(s, 1))\n            goto err;\n    } else {\n        i = ssl_get_prev_session(s, p, j, d + n);\n        if (i == 1 && s->version == s->session->ssl_version) {\n            s->hit = 1;\n        } else if (i == -1)\n            goto err;\n        else {\n            if (!ssl_get_new_session(s, 1))\n                goto err;\n        }\n    }\n    p += j;\n    if (SSL_IS_DTLS(s)) {\n        cookie_len = *(p++);\n        if (cookie_len > sizeof(s->d1->rcvd_cookie)) {\n            al = SSL_AD_DECODE_ERROR;\n            SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO, SSL_R_COOKIE_MISMATCH);\n            goto f_err;\n        }\n        if ((SSL_get_options(s) & SSL_OP_COOKIE_EXCHANGE) && cookie_len > 0) {\n            memcpy(s->d1->rcvd_cookie, p, cookie_len);\n            if (s->ctx->app_verify_cookie_cb != NULL) {\n                if (s->ctx->app_verify_cookie_cb(s, s->d1->rcvd_cookie,\n                                                 cookie_len) == 0) {\n                    al = SSL_AD_HANDSHAKE_FAILURE;\n                    SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO,\n                           SSL_R_COOKIE_MISMATCH);\n                    goto f_err;\n                }\n            }\n            else if (memcmp(s->d1->rcvd_cookie, s->d1->cookie,\n                            s->d1->cookie_len) != 0) {\n                al = SSL_AD_HANDSHAKE_FAILURE;\n                SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO, SSL_R_COOKIE_MISMATCH);\n                goto f_err;\n            }\n            ret = -2;\n        }\n        p += cookie_len;\n        if (s->method->version == DTLS_ANY_VERSION) {\n            if (s->client_version <= DTLS1_2_VERSION &&\n                !(s->options & SSL_OP_NO_DTLSv1_2)) {\n                s->version = DTLS1_2_VERSION;\n                s->method = DTLSv1_2_server_method();\n            } else if (tls1_suiteb(s)) {\n                SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO,\n                       SSL_R_ONLY_DTLS_1_2_ALLOWED_IN_SUITEB_MODE);\n                s->version = s->client_version;\n                al = SSL_AD_PROTOCOL_VERSION;\n                goto f_err;\n            } else if (s->client_version <= DTLS1_VERSION &&\n                       !(s->options & SSL_OP_NO_DTLSv1)) {\n                s->version = DTLS1_VERSION;\n                s->method = DTLSv1_server_method();\n            } else {\n                SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO,\n                       SSL_R_WRONG_VERSION_NUMBER);\n                s->version = s->client_version;\n                al = SSL_AD_PROTOCOL_VERSION;\n                goto f_err;\n            }\n            s->session->ssl_version = s->version;\n        }\n    }\n    n2s(p, i);\n    if ((i == 0) && (j != 0)) {\n        al = SSL_AD_ILLEGAL_PARAMETER;\n        SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO, SSL_R_NO_CIPHERS_SPECIFIED);\n        goto f_err;\n    }\n    if ((p + i) >= (d + n)) {\n        al = SSL_AD_DECODE_ERROR;\n        SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO, SSL_R_LENGTH_MISMATCH);\n        goto f_err;\n    }\n    if ((i > 0) && (ssl_bytes_to_cipher_list(s, p, i, &(ciphers))\n                    == NULL)) {\n        goto err;\n    }\n    p += i;\n    if ((s->hit) && (i > 0)) {\n        j = 0;\n        id = s->session->cipher->id;\n#ifdef CIPHER_DEBUG\n        fprintf(stderr, "client sent %d ciphers\\n",\n                sk_SSL_CIPHER_num(ciphers));\n#endif\n        for (i = 0; i < sk_SSL_CIPHER_num(ciphers); i++) {\n            c = sk_SSL_CIPHER_value(ciphers, i);\n#ifdef CIPHER_DEBUG\n            fprintf(stderr, "client [%2d of %2d]:%s\\n",\n                    i, sk_SSL_CIPHER_num(ciphers), SSL_CIPHER_get_name(c));\n#endif\n            if (c->id == id) {\n                j = 1;\n                break;\n            }\n        }\n#if 0\n        if (j == 0 && (s->options & SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG)\n            && (sk_SSL_CIPHER_num(ciphers) == 1)) {\n            c = sk_SSL_CIPHER_value(ciphers, 0);\n            if (sk_SSL_CIPHER_find(SSL_get_ciphers(s), c) >= 0) {\n                s->session->cipher = c;\n                j = 1;\n            }\n        }\n#endif\n        if (j == 0) {\n            al = SSL_AD_ILLEGAL_PARAMETER;\n            SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO,\n                   SSL_R_REQUIRED_CIPHER_MISSING);\n            goto f_err;\n        }\n    }\n    i = *(p++);\n    if ((p + i) > (d + n)) {\n        al = SSL_AD_DECODE_ERROR;\n        SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO, SSL_R_LENGTH_MISMATCH);\n        goto f_err;\n    }\n#ifndef OPENSSL_NO_COMP\n    q = p;\n#endif\n    for (j = 0; j < i; j++) {\n        if (p[j] == 0)\n            break;\n    }\n    p += i;\n    if (j >= i) {\n        al = SSL_AD_DECODE_ERROR;\n        SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO, SSL_R_NO_COMPRESSION_SPECIFIED);\n        goto f_err;\n    }\n#ifndef OPENSSL_NO_TLSEXT\n    if (s->version >= SSL3_VERSION) {\n        if (!ssl_parse_clienthello_tlsext(s, &p, d, n)) {\n            SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO, SSL_R_PARSE_TLSEXT);\n            goto err;\n        }\n    }\n    {\n        unsigned char *pos;\n        pos = s->s3->server_random;\n        if (ssl_fill_hello_random(s, 1, pos, SSL3_RANDOM_SIZE) <= 0) {\n            goto f_err;\n        }\n    }\n    if (!s->hit && s->version >= TLS1_VERSION && s->tls_session_secret_cb) {\n        SSL_CIPHER *pref_cipher = NULL;\n        s->session->master_key_length = sizeof(s->session->master_key);\n        if (s->tls_session_secret_cb(s, s->session->master_key,\n                                     &s->session->master_key_length, ciphers,\n                                     &pref_cipher,\n                                     s->tls_session_secret_cb_arg)) {\n            s->hit = 1;\n            s->session->ciphers = ciphers;\n            s->session->verify_result = X509_V_OK;\n            ciphers = NULL;\n            pref_cipher =\n                pref_cipher ? pref_cipher : ssl3_choose_cipher(s,\n                                                               s->\n                                                               session->ciphers,\n                                                               SSL_get_ciphers\n                                                               (s));\n            if (pref_cipher == NULL) {\n                al = SSL_AD_HANDSHAKE_FAILURE;\n                SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO, SSL_R_NO_SHARED_CIPHER);\n                goto f_err;\n            }\n            s->session->cipher = pref_cipher;\n            if (s->cipher_list)\n                sk_SSL_CIPHER_free(s->cipher_list);\n            if (s->cipher_list_by_id)\n                sk_SSL_CIPHER_free(s->cipher_list_by_id);\n            s->cipher_list = sk_SSL_CIPHER_dup(s->session->ciphers);\n            s->cipher_list_by_id = sk_SSL_CIPHER_dup(s->session->ciphers);\n        }\n    }\n#endif\n    s->s3->tmp.new_compression = NULL;\n#ifndef OPENSSL_NO_COMP\n    if (s->session->compress_meth != 0) {\n        int m, comp_id = s->session->compress_meth;\n        if (!ssl_allow_compression(s)) {\n            SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO,\n                   SSL_R_INCONSISTENT_COMPRESSION);\n            goto f_err;\n        }\n        for (m = 0; m < sk_SSL_COMP_num(s->ctx->comp_methods); m++) {\n            comp = sk_SSL_COMP_value(s->ctx->comp_methods, m);\n            if (comp_id == comp->id) {\n                s->s3->tmp.new_compression = comp;\n                break;\n            }\n        }\n        if (s->s3->tmp.new_compression == NULL) {\n            SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO,\n                   SSL_R_INVALID_COMPRESSION_ALGORITHM);\n            goto f_err;\n        }\n        for (m = 0; m < i; m++) {\n            if (q[m] == comp_id)\n                break;\n        }\n        if (m >= i) {\n            al = SSL_AD_ILLEGAL_PARAMETER;\n            SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO,\n                   SSL_R_REQUIRED_COMPRESSSION_ALGORITHM_MISSING);\n            goto f_err;\n        }\n    } else if (s->hit)\n        comp = NULL;\n    else if (ssl_allow_compression(s) && s->ctx->comp_methods) {\n        int m, nn, o, v, done = 0;\n        nn = sk_SSL_COMP_num(s->ctx->comp_methods);\n        for (m = 0; m < nn; m++) {\n            comp = sk_SSL_COMP_value(s->ctx->comp_methods, m);\n            v = comp->id;\n            for (o = 0; o < i; o++) {\n                if (v == q[o]) {\n                    done = 1;\n                    break;\n                }\n            }\n            if (done)\n                break;\n        }\n        if (done)\n            s->s3->tmp.new_compression = comp;\n        else\n            comp = NULL;\n    }\n#else\n    if (s->session->compress_meth != 0) {\n        SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO, SSL_R_INCONSISTENT_COMPRESSION);\n        goto f_err;\n    }\n#endif\n    if (!s->hit) {\n#ifdef OPENSSL_NO_COMP\n        s->session->compress_meth = 0;\n#else\n        s->session->compress_meth = (comp == NULL) ? 0 : comp->id;\n#endif\n        if (s->session->ciphers != NULL)\n            sk_SSL_CIPHER_free(s->session->ciphers);\n        s->session->ciphers = ciphers;\n        if (ciphers == NULL) {\n            al = SSL_AD_ILLEGAL_PARAMETER;\n            SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO, SSL_R_NO_CIPHERS_PASSED);\n            goto f_err;\n        }\n        ciphers = NULL;\n        if (!tls1_set_server_sigalgs(s)) {\n            SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO, SSL_R_CLIENTHELLO_TLSEXT);\n            goto err;\n        }\n retry_cert:\n        if (s->cert->cert_cb) {\n            int rv = s->cert->cert_cb(s, s->cert->cert_cb_arg);\n            if (rv == 0) {\n                al = SSL_AD_INTERNAL_ERROR;\n                SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO, SSL_R_CERT_CB_ERROR);\n                goto f_err;\n            }\n            if (rv < 0) {\n                s->rwstate = SSL_X509_LOOKUP;\n                return -1;\n            }\n            s->rwstate = SSL_NOTHING;\n        }\n        c = ssl3_choose_cipher(s, s->session->ciphers, SSL_get_ciphers(s));\n        if (c == NULL) {\n            al = SSL_AD_HANDSHAKE_FAILURE;\n            SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO, SSL_R_NO_SHARED_CIPHER);\n            goto f_err;\n        }\n        s->s3->tmp.new_cipher = c;\n        if (s->not_resumable_session_cb != NULL)\n            s->session->not_resumable = s->not_resumable_session_cb(s,\n                                                                    ((c->algorithm_mkey & (SSL_kDHE | SSL_kECDHE))\n                                                                     != 0));\n        if (s->session->not_resumable)\n            s->tlsext_ticket_expected = 0;\n    } else {\n#ifdef REUSE_CIPHER_BUG\n        STACK_OF(SSL_CIPHER) *sk;\n        SSL_CIPHER *nc = NULL;\n        SSL_CIPHER *ec = NULL;\n        if (s->options & SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG) {\n            sk = s->session->ciphers;\n            for (i = 0; i < sk_SSL_CIPHER_num(sk); i++) {\n                c = sk_SSL_CIPHER_value(sk, i);\n                if (c->algorithm_enc & SSL_eNULL)\n                    nc = c;\n                if (SSL_C_IS_EXPORT(c))\n                    ec = c;\n            }\n            if (nc != NULL)\n                s->s3->tmp.new_cipher = nc;\n            else if (ec != NULL)\n                s->s3->tmp.new_cipher = ec;\n            else\n                s->s3->tmp.new_cipher = s->session->cipher;\n        } else\n#endif\n            s->s3->tmp.new_cipher = s->session->cipher;\n    }\n    if (!SSL_USE_SIGALGS(s) || !(s->verify_mode & SSL_VERIFY_PEER)) {\n        if (!ssl3_digest_cached_records(s))\n            goto f_err;\n    }\n    if (s->version >= SSL3_VERSION) {\n        if (ssl_check_clienthello_tlsext_late(s) <= 0) {\n            SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO, SSL_R_CLIENTHELLO_TLSEXT);\n            goto err;\n        }\n    }\n    if (ret < 0)\n        ret = -ret;\n    if (0) {\n f_err:\n        ssl3_send_alert(s, SSL3_AL_FATAL, al);\n    }\n err:\n    if (ciphers != NULL)\n        sk_SSL_CIPHER_free(ciphers);\n    return ret < 0 ? -1 : ret;\n}', 'int ssl_check_clienthello_tlsext_late(SSL *s)\n{\n    int ret = SSL_TLSEXT_ERR_OK;\n    int al;\n    if ((s->tlsext_status_type != -1) && s->ctx && s->ctx->tlsext_status_cb) {\n        int r;\n        CERT_PKEY *certpkey;\n        certpkey = ssl_get_server_send_pkey(s);\n        if (certpkey == NULL) {\n            s->tlsext_status_expected = 0;\n            return 1;\n        }\n        s->cert->key = certpkey;\n        r = s->ctx->tlsext_status_cb(s, s->ctx->tlsext_status_arg);\n        switch (r) {\n        case SSL_TLSEXT_ERR_NOACK:\n            s->tlsext_status_expected = 0;\n            break;\n        case SSL_TLSEXT_ERR_OK:\n            if (s->tlsext_ocsp_resp)\n                s->tlsext_status_expected = 1;\n            else\n                s->tlsext_status_expected = 0;\n            break;\n        case SSL_TLSEXT_ERR_ALERT_FATAL:\n            ret = SSL_TLSEXT_ERR_ALERT_FATAL;\n            al = SSL_AD_INTERNAL_ERROR;\n            goto err;\n        }\n    } else\n        s->tlsext_status_expected = 0;\n err:\n    switch (ret) {\n    case SSL_TLSEXT_ERR_ALERT_FATAL:\n        ssl3_send_alert(s, SSL3_AL_FATAL, al);\n        return -1;\n    case SSL_TLSEXT_ERR_ALERT_WARNING:\n        ssl3_send_alert(s, SSL3_AL_WARNING, al);\n        return 1;\n    default:\n        return 1;\n    }\n}', 'int ssl3_send_alert(SSL *s, int level, int desc)\n{\n    desc = s->method->ssl3_enc->alert_value(desc);\n    if (s->version == SSL3_VERSION && desc == SSL_AD_PROTOCOL_VERSION)\n        desc = SSL_AD_HANDSHAKE_FAILURE;\n    if (desc < 0)\n        return -1;\n    if ((level == SSL3_AL_FATAL) && (s->session != NULL))\n        SSL_CTX_remove_session(s->ctx, s->session);\n    s->s3->alert_dispatch = 1;\n    s->s3->send_alert[0] = level;\n    s->s3->send_alert[1] = desc;\n    if (s->s3->wbuf.left == 0)\n        return s->method->ssl_dispatch_alert(s);\n    return -1;\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_w_lock(CRYPTO_LOCK_SSL_CTX);\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        if (lck)\n            CRYPTO_w_unlock(CRYPTO_LOCK_SSL_CTX);\n        if (ret) {\n            r->not_resumable = 1;\n            if (ctx->remove_session_cb != NULL)\n                ctx->remove_session_cb(ctx, r);\n            SSL_SESSION_free(r);\n        }\n    } else\n        ret = 0;\n    return (ret);\n}', 'void *lh_delete(_LHASH *lh, const void *data)\n{\n    unsigned long hash;\n    LHASH_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}']