ssl/d1_clnt.c:637: error: INTEGER_OVERFLOW_L2
  ([0, max(0, `s->initial_ctx->sessions->num_items`)] - 1):unsigned64 by call to `ssl3_get_new_session_ticket`.
Showing all 11 steps of the trace


ssl/d1_clnt.c:159:1: Parameter `s->initial_ctx->sessions->num_items`
157.                             dtls1_get_client_method, DTLSv1_2_enc_data)
158.   
159. > int dtls1_connect(SSL *s)
160.   {
161.       BUF_MEM *buf = NULL;

ssl/d1_clnt.c:637:19: Call
635.           case SSL3_ST_CR_SESSION_TICKET_A:
636.           case SSL3_ST_CR_SESSION_TICKET_B:
637.               ret = ssl3_get_new_session_ticket(s);
                         ^
638.               if (ret <= 0)
639.                   goto end;

ssl/s3_clnt.c:2172:1: Parameter `s->initial_ctx->sessions->num_items`
  2170.   }
  2171.   
  2172. > int ssl3_get_new_session_ticket(SSL *s)
  2173.   {
  2174.       int ok, al, ret = 0, ticklen;

ssl/s3_clnt.c:2213:17: Call
  2211.               } else {
  2212.                   /* We carry on if this fails */
  2213.                   SSL_CTX_remove_session(s->session_ctx, s->session);
                          ^
  2214.               }
  2215.           }

ssl/ssl_sess.c:787:1: Parameter `ctx->sessions->num_items`
    785.   }
    786.   
    787. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c)
    788.   {
    789.       return remove_session_lock(ctx, c, 1);

ssl/ssl_sess.c:789:12: Call
    787.   int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c)
    788.   {
    789.       return remove_session_lock(ctx, c, 1);
                      ^
    790.   }
    791.   

ssl/ssl_sess.c:792:1: Parameter `ctx->sessions->num_items`
      790.   }
      791.   
      792. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck)
      793.   {
      794.       SSL_SESSION *r;

ssl/ssl_sess.c:802:17: Call
      800.           if ((r = lh_SSL_SESSION_retrieve(ctx->sessions, c)) == c) {
      801.               ret = 1;
      802.               r = lh_SSL_SESSION_delete(ctx->sessions, c);
                             ^
      803.               SSL_SESSION_list_remove(ctx, c);
      804.           }

crypto/lhash/lhash.c:209:1: <LHS trace>
207.   }
208.   
209. > void *lh_delete(_LHASH *lh, const void *data)
210.   {
211.       unsigned long hash;

crypto/lhash/lhash.c:209:1: Parameter `lh->num_items`
        207.   }
        208.   
        209. > void *lh_delete(_LHASH *lh, const void *data)
        210.   {
        211.       unsigned long hash;

crypto/lhash/lhash.c:229:5: Binary operation: ([0, max(0, s->initial_ctx->sessions->num_items)] - 1):unsigned64 by call to `ssl3_get_new_session_ticket` 
        227.       }
        228.   
        229.       lh->num_items--;
                   ^
        230.       if ((lh->num_nodes > MIN_NODES) &&
        231.           (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 dtls1_connect(SSL *s)\n{\n    BUF_MEM *buf = NULL;\n    unsigned long Time = (unsigned long)time(NULL);\n    void (*cb) (const SSL *ssl, int type, int val) = NULL;\n    int ret = -1;\n    int new_state, state, skip = 0;\n#ifndef OPENSSL_NO_SCTP\n    unsigned char sctpauthkey[64];\n    char labelbuffer[sizeof(DTLS1_SCTP_AUTH_LABEL)];\n#endif\n    RAND_add(&Time, sizeof(Time), 0);\n    ERR_clear_error();\n    clear_sys_error();\n    if (s->info_callback != NULL)\n        cb = s->info_callback;\n    else if (s->ctx->info_callback != NULL)\n        cb = s->ctx->info_callback;\n    s->in_handshake++;\n    if (!SSL_in_init(s) || SSL_in_before(s)) {\n        if (!SSL_clear(s))\n            return -1;\n    }\n#ifndef OPENSSL_NO_SCTP\n    BIO_ctrl(SSL_get_wbio(s), BIO_CTRL_DGRAM_SCTP_SET_IN_HANDSHAKE,\n             s->in_handshake, NULL);\n#endif\n#ifndef OPENSSL_NO_HEARTBEATS\n    if (s->tlsext_hb_pending) {\n        dtls1_stop_timer(s);\n        s->tlsext_hb_pending = 0;\n        s->tlsext_hb_seq++;\n    }\n#endif\n    for (;;) {\n        state = s->state;\n        switch (s->state) {\n        case SSL_ST_RENEGOTIATE:\n            s->renegotiate = 1;\n            s->state = SSL_ST_CONNECT;\n            s->ctx->stats.sess_connect_renegotiate++;\n        case SSL_ST_BEFORE:\n        case SSL_ST_CONNECT:\n        case SSL_ST_BEFORE | SSL_ST_CONNECT:\n        case SSL_ST_OK | SSL_ST_CONNECT:\n            s->server = 0;\n            if (cb != NULL)\n                cb(s, SSL_CB_HANDSHAKE_START, 1);\n            if ((s->version & 0xff00) != (DTLS1_VERSION & 0xff00) &&\n                (s->version & 0xff00) != (DTLS1_BAD_VER & 0xff00)) {\n                SSLerr(SSL_F_DTLS1_CONNECT, ERR_R_INTERNAL_ERROR);\n                ret = -1;\n                s->state = SSL_ST_ERR;\n                goto end;\n            }\n            s->type = SSL_ST_CONNECT;\n            if (s->init_buf == NULL) {\n                if ((buf = BUF_MEM_new()) == NULL) {\n                    ret = -1;\n                    s->state = SSL_ST_ERR;\n                    goto end;\n                }\n                if (!BUF_MEM_grow(buf, SSL3_RT_MAX_PLAIN_LENGTH)) {\n                    ret = -1;\n                    s->state = SSL_ST_ERR;\n                    goto end;\n                }\n                s->init_buf = buf;\n                buf = NULL;\n            }\n            if (!ssl3_setup_buffers(s)) {\n                ret = -1;\n                s->state = SSL_ST_ERR;\n                goto end;\n            }\n            if (!ssl_init_wbio_buffer(s, 0)) {\n                ret = -1;\n                s->state = SSL_ST_ERR;\n                goto end;\n            }\n            s->state = SSL3_ST_CW_CLNT_HELLO_A;\n            s->ctx->stats.sess_connect++;\n            s->init_num = 0;\n            memset(s->s3->client_random, 0, sizeof(s->s3->client_random));\n            s->d1->send_cookie = 0;\n            s->hit = 0;\n            s->s3->change_cipher_spec = 0;\n            break;\n#ifndef OPENSSL_NO_SCTP\n        case DTLS1_SCTP_ST_CR_READ_SOCK:\n            if (BIO_dgram_sctp_msg_waiting(SSL_get_rbio(s))) {\n                s->s3->in_read_app_data = 2;\n                s->rwstate = SSL_READING;\n                BIO_clear_retry_flags(SSL_get_rbio(s));\n                BIO_set_retry_read(SSL_get_rbio(s));\n                ret = -1;\n                goto end;\n            }\n            s->state = s->s3->tmp.next_state;\n            break;\n        case DTLS1_SCTP_ST_CW_WRITE_SOCK:\n            ret = BIO_dgram_sctp_wait_for_dry(SSL_get_wbio(s));\n            if (ret < 0)\n                goto end;\n            if (ret == 0) {\n                s->s3->in_read_app_data = 2;\n                s->rwstate = SSL_READING;\n                BIO_clear_retry_flags(SSL_get_rbio(s));\n                BIO_set_retry_read(SSL_get_rbio(s));\n                ret = -1;\n                goto end;\n            }\n            s->state = s->d1->next_state;\n            break;\n#endif\n        case SSL3_ST_CW_CLNT_HELLO_A:\n        case SSL3_ST_CW_CLNT_HELLO_B:\n            s->shutdown = 0;\n            ssl3_init_finished_mac(s);\n            dtls1_start_timer(s);\n            ret = ssl3_client_hello(s);\n            if (ret <= 0)\n                goto end;\n            if (s->d1->send_cookie) {\n                s->state = SSL3_ST_CW_FLUSH;\n                s->s3->tmp.next_state = SSL3_ST_CR_SRVR_HELLO_A;\n            } else\n                s->state = SSL3_ST_CR_SRVR_HELLO_A;\n            s->init_num = 0;\n#ifndef OPENSSL_NO_SCTP\n            if (!BIO_dgram_is_sctp(SSL_get_wbio(s))) {\n#endif\n                if (s->bbio != s->wbio)\n                    s->wbio = BIO_push(s->bbio, s->wbio);\n#ifndef OPENSSL_NO_SCTP\n            }\n#endif\n            break;\n        case SSL3_ST_CR_SRVR_HELLO_A:\n        case SSL3_ST_CR_SRVR_HELLO_B:\n            ret = ssl3_get_server_hello(s);\n            if (ret <= 0)\n                goto end;\n            else {\n                if (s->hit) {\n#ifndef OPENSSL_NO_SCTP\n                    snprintf((char *)labelbuffer,\n                             sizeof(DTLS1_SCTP_AUTH_LABEL),\n                             DTLS1_SCTP_AUTH_LABEL);\n                    SSL_export_keying_material(s, sctpauthkey,\n                                               sizeof(sctpauthkey),\n                                               labelbuffer,\n                                               sizeof(labelbuffer), NULL, 0,\n                                               0);\n                    BIO_ctrl(SSL_get_wbio(s),\n                             BIO_CTRL_DGRAM_SCTP_ADD_AUTH_KEY,\n                             sizeof(sctpauthkey), sctpauthkey);\n#endif\n                    s->state = SSL3_ST_CR_CHANGE_A;\n                } else\n                    s->state = DTLS1_ST_CR_HELLO_VERIFY_REQUEST_A;\n            }\n            s->init_num = 0;\n            break;\n        case DTLS1_ST_CR_HELLO_VERIFY_REQUEST_A:\n        case DTLS1_ST_CR_HELLO_VERIFY_REQUEST_B:\n            ret = dtls1_get_hello_verify(s);\n            if (ret <= 0)\n                goto end;\n            dtls1_stop_timer(s);\n            if (s->d1->send_cookie)\n                s->state = SSL3_ST_CW_CLNT_HELLO_A;\n            else\n                s->state = SSL3_ST_CR_CERT_A;\n            s->init_num = 0;\n            break;\n        case SSL3_ST_CR_CERT_A:\n        case SSL3_ST_CR_CERT_B:\n            if (!(s->s3->tmp.new_cipher->algorithm_auth & SSL_aNULL) &&\n                !(s->s3->tmp.new_cipher->algorithm_mkey & SSL_kPSK)) {\n                ret = ssl3_get_server_certificate(s);\n                if (ret <= 0)\n                    goto end;\n                if (s->tlsext_status_expected)\n                    s->state = SSL3_ST_CR_CERT_STATUS_A;\n                else\n                    s->state = SSL3_ST_CR_KEY_EXCH_A;\n            } else {\n                skip = 1;\n                s->state = SSL3_ST_CR_KEY_EXCH_A;\n            }\n            s->init_num = 0;\n            break;\n        case SSL3_ST_CR_KEY_EXCH_A:\n        case SSL3_ST_CR_KEY_EXCH_B:\n            ret = ssl3_get_key_exchange(s);\n            if (ret <= 0)\n                goto end;\n            s->state = SSL3_ST_CR_CERT_REQ_A;\n            s->init_num = 0;\n            if (!ssl3_check_cert_and_algorithm(s)) {\n                ret = -1;\n                s->state = SSL_ST_ERR;\n                goto end;\n            }\n            break;\n        case SSL3_ST_CR_CERT_REQ_A:\n        case SSL3_ST_CR_CERT_REQ_B:\n            ret = ssl3_get_certificate_request(s);\n            if (ret <= 0)\n                goto end;\n            s->state = SSL3_ST_CR_SRVR_DONE_A;\n            s->init_num = 0;\n            break;\n        case SSL3_ST_CR_SRVR_DONE_A:\n        case SSL3_ST_CR_SRVR_DONE_B:\n            ret = ssl3_get_server_done(s);\n            if (ret <= 0)\n                goto end;\n            dtls1_stop_timer(s);\n            if (s->s3->tmp.cert_req)\n                s->s3->tmp.next_state = SSL3_ST_CW_CERT_A;\n            else\n                s->s3->tmp.next_state = SSL3_ST_CW_KEY_EXCH_A;\n            s->init_num = 0;\n#ifndef OPENSSL_NO_SCTP\n            if (BIO_dgram_is_sctp(SSL_get_wbio(s)) &&\n                state == SSL_ST_RENEGOTIATE)\n                s->state = DTLS1_SCTP_ST_CR_READ_SOCK;\n            else\n#endif\n                s->state = s->s3->tmp.next_state;\n            break;\n        case SSL3_ST_CW_CERT_A:\n        case SSL3_ST_CW_CERT_B:\n        case SSL3_ST_CW_CERT_C:\n        case SSL3_ST_CW_CERT_D:\n            dtls1_start_timer(s);\n            ret = ssl3_send_client_certificate(s);\n            if (ret <= 0)\n                goto end;\n            s->state = SSL3_ST_CW_KEY_EXCH_A;\n            s->init_num = 0;\n            break;\n        case SSL3_ST_CW_KEY_EXCH_A:\n        case SSL3_ST_CW_KEY_EXCH_B:\n            dtls1_start_timer(s);\n            ret = ssl3_send_client_key_exchange(s);\n            if (ret <= 0)\n                goto end;\n#ifndef OPENSSL_NO_SCTP\n            snprintf((char *)labelbuffer, sizeof(DTLS1_SCTP_AUTH_LABEL),\n                     DTLS1_SCTP_AUTH_LABEL);\n            SSL_export_keying_material(s, sctpauthkey,\n                                       sizeof(sctpauthkey), labelbuffer,\n                                       sizeof(labelbuffer), NULL, 0, 0);\n            BIO_ctrl(SSL_get_wbio(s), BIO_CTRL_DGRAM_SCTP_ADD_AUTH_KEY,\n                     sizeof(sctpauthkey), sctpauthkey);\n#endif\n            if (s->s3->tmp.cert_req == 1) {\n                s->state = SSL3_ST_CW_CERT_VRFY_A;\n            } else {\n#ifndef OPENSSL_NO_SCTP\n                if (BIO_dgram_is_sctp(SSL_get_wbio(s))) {\n                    s->d1->next_state = SSL3_ST_CW_CHANGE_A;\n                    s->state = DTLS1_SCTP_ST_CW_WRITE_SOCK;\n                } else\n#endif\n                    s->state = SSL3_ST_CW_CHANGE_A;\n            }\n            s->init_num = 0;\n            break;\n        case SSL3_ST_CW_CERT_VRFY_A:\n        case SSL3_ST_CW_CERT_VRFY_B:\n            dtls1_start_timer(s);\n            ret = ssl3_send_client_verify(s);\n            if (ret <= 0)\n                goto end;\n#ifndef OPENSSL_NO_SCTP\n            if (BIO_dgram_is_sctp(SSL_get_wbio(s))) {\n                s->d1->next_state = SSL3_ST_CW_CHANGE_A;\n                s->state = DTLS1_SCTP_ST_CW_WRITE_SOCK;\n            } else\n#endif\n                s->state = SSL3_ST_CW_CHANGE_A;\n            s->init_num = 0;\n            break;\n        case SSL3_ST_CW_CHANGE_A:\n        case SSL3_ST_CW_CHANGE_B:\n            if (!s->hit)\n                dtls1_start_timer(s);\n            ret = dtls1_send_change_cipher_spec(s,\n                                                SSL3_ST_CW_CHANGE_A,\n                                                SSL3_ST_CW_CHANGE_B);\n            if (ret <= 0)\n                goto end;\n            s->state = SSL3_ST_CW_FINISHED_A;\n            s->init_num = 0;\n            s->session->cipher = s->s3->tmp.new_cipher;\n#ifdef OPENSSL_NO_COMP\n            s->session->compress_meth = 0;\n#else\n            if (s->s3->tmp.new_compression == NULL)\n                s->session->compress_meth = 0;\n            else\n                s->session->compress_meth = s->s3->tmp.new_compression->id;\n#endif\n            if (!s->method->ssl3_enc->setup_key_block(s)) {\n                ret = -1;\n                s->state = SSL_ST_ERR;\n                goto end;\n            }\n            if (!s->method->ssl3_enc->change_cipher_state(s,\n                                                          SSL3_CHANGE_CIPHER_CLIENT_WRITE))\n            {\n                ret = -1;\n                s->state = SSL_ST_ERR;\n                goto end;\n            }\n#ifndef OPENSSL_NO_SCTP\n            if (s->hit) {\n                BIO_ctrl(SSL_get_wbio(s), BIO_CTRL_DGRAM_SCTP_NEXT_AUTH_KEY,\n                         0, NULL);\n            }\n#endif\n            dtls1_reset_seq_numbers(s, SSL3_CC_WRITE);\n            break;\n        case SSL3_ST_CW_FINISHED_A:\n        case SSL3_ST_CW_FINISHED_B:\n            if (!s->hit)\n                dtls1_start_timer(s);\n            ret = ssl3_send_finished(s,\n                                     SSL3_ST_CW_FINISHED_A,\n                                     SSL3_ST_CW_FINISHED_B,\n                                     s->method->\n                                     ssl3_enc->client_finished_label,\n                                     s->method->\n                                     ssl3_enc->client_finished_label_len);\n            if (ret <= 0)\n                goto end;\n            s->state = SSL3_ST_CW_FLUSH;\n            if (s->hit) {\n                s->s3->tmp.next_state = SSL_ST_OK;\n#ifndef OPENSSL_NO_SCTP\n                if (BIO_dgram_is_sctp(SSL_get_wbio(s))) {\n                    s->d1->next_state = s->s3->tmp.next_state;\n                    s->s3->tmp.next_state = DTLS1_SCTP_ST_CW_WRITE_SOCK;\n                }\n#endif\n            } else {\n#ifndef OPENSSL_NO_SCTP\n                BIO_ctrl(SSL_get_wbio(s), BIO_CTRL_DGRAM_SCTP_NEXT_AUTH_KEY,\n                         0, NULL);\n#endif\n                if (s->tlsext_ticket_expected)\n                    s->s3->tmp.next_state = SSL3_ST_CR_SESSION_TICKET_A;\n                else\n                    s->s3->tmp.next_state = SSL3_ST_CR_CHANGE_A;\n            }\n            s->init_num = 0;\n            break;\n        case SSL3_ST_CR_SESSION_TICKET_A:\n        case SSL3_ST_CR_SESSION_TICKET_B:\n            ret = ssl3_get_new_session_ticket(s);\n            if (ret <= 0)\n                goto end;\n            s->state = SSL3_ST_CR_CHANGE_A;\n            s->init_num = 0;\n            break;\n        case SSL3_ST_CR_CERT_STATUS_A:\n        case SSL3_ST_CR_CERT_STATUS_B:\n            ret = ssl3_get_cert_status(s);\n            if (ret <= 0)\n                goto end;\n            s->state = SSL3_ST_CR_KEY_EXCH_A;\n            s->init_num = 0;\n            break;\n        case SSL3_ST_CR_CHANGE_A:\n        case SSL3_ST_CR_CHANGE_B:\n            ret = ssl3_get_change_cipher_spec(s, SSL3_ST_CR_CHANGE_A,\n                                              SSL3_ST_CR_CHANGE_B);\n            if (ret <= 0)\n                goto end;\n            s->state = SSL3_ST_CR_FINISHED_A;\n            s->init_num = 0;\n            break;\n        case SSL3_ST_CR_FINISHED_A:\n        case SSL3_ST_CR_FINISHED_B:\n            ret = ssl3_get_finished(s, SSL3_ST_CR_FINISHED_A,\n                                    SSL3_ST_CR_FINISHED_B);\n            if (ret <= 0)\n                goto end;\n            dtls1_stop_timer(s);\n            if (s->hit)\n                s->state = SSL3_ST_CW_CHANGE_A;\n            else\n                s->state = SSL_ST_OK;\n#ifndef OPENSSL_NO_SCTP\n            if (BIO_dgram_is_sctp(SSL_get_wbio(s)) &&\n                state == SSL_ST_RENEGOTIATE) {\n                s->d1->next_state = s->state;\n                s->state = DTLS1_SCTP_ST_CW_WRITE_SOCK;\n            }\n#endif\n            s->init_num = 0;\n            break;\n        case SSL3_ST_CW_FLUSH:\n            s->rwstate = SSL_WRITING;\n            if (BIO_flush(s->wbio) <= 0) {\n                if (!BIO_should_retry(s->wbio)) {\n                    s->rwstate = SSL_NOTHING;\n                    s->state = s->s3->tmp.next_state;\n                }\n                ret = -1;\n                goto end;\n            }\n            s->rwstate = SSL_NOTHING;\n            s->state = s->s3->tmp.next_state;\n            break;\n        case SSL_ST_OK:\n            ssl3_cleanup_key_block(s);\n            ssl_free_wbio_buffer(s);\n            s->init_num = 0;\n            s->renegotiate = 0;\n            s->new_session = 0;\n            ssl_update_cache(s, SSL_SESS_CACHE_CLIENT);\n            if (s->hit)\n                s->ctx->stats.sess_hit++;\n            ret = 1;\n            s->handshake_func = dtls1_connect;\n            s->ctx->stats.sess_connect_good++;\n            if (cb != NULL)\n                cb(s, SSL_CB_HANDSHAKE_DONE, 1);\n            s->d1->handshake_read_seq = 0;\n            s->d1->next_handshake_write_seq = 0;\n            goto end;\n        case SSL_ST_ERR:\n        default:\n            SSLerr(SSL_F_DTLS1_CONNECT, SSL_R_UNKNOWN_STATE);\n            ret = -1;\n            goto end;\n        }\n        if (!s->s3->tmp.reuse_message && !skip) {\n            if (s->debug) {\n                if ((ret = BIO_flush(s->wbio)) <= 0)\n                    goto end;\n            }\n            if ((cb != NULL) && (s->state != state)) {\n                new_state = s->state;\n                s->state = state;\n                cb(s, SSL_CB_CONNECT_LOOP, 1);\n                s->state = new_state;\n            }\n        }\n        skip = 0;\n    }\n end:\n    s->in_handshake--;\n#ifndef OPENSSL_NO_SCTP\n    BIO_ctrl(SSL_get_wbio(s), BIO_CTRL_DGRAM_SCTP_SET_IN_HANDSHAKE,\n             s->in_handshake, NULL);\n#endif\n    BUF_MEM_free(buf);\n    if (cb != NULL)\n        cb(s, SSL_CB_CONNECT_EXIT, ret);\n    return (ret);\n}', 'int ssl3_get_new_session_ticket(SSL *s)\n{\n    int ok, al, ret = 0, ticklen;\n    long n;\n    const unsigned char *p;\n    unsigned char *d;\n    n = s->method->ssl_get_message(s,\n                                   SSL3_ST_CR_SESSION_TICKET_A,\n                                   SSL3_ST_CR_SESSION_TICKET_B,\n                                   SSL3_MT_NEWSESSION_TICKET, 16384, &ok);\n    if (!ok)\n        return ((int)n);\n    if (n < 6) {\n        al = SSL_AD_DECODE_ERROR;\n        SSLerr(SSL_F_SSL3_GET_NEW_SESSION_TICKET, SSL_R_LENGTH_MISMATCH);\n        goto f_err;\n    }\n    p = d = (unsigned char *)s->init_msg;\n    if (s->session->session_id_length > 0) {\n        int i = s->session_ctx->session_cache_mode;\n        SSL_SESSION *new_sess;\n        if (i & SSL_SESS_CACHE_CLIENT) {\n            if (i & SSL_SESS_CACHE_NO_INTERNAL_STORE) {\n                if (s->session_ctx->remove_session_cb != NULL)\n                    s->session_ctx->remove_session_cb(s->session_ctx,\n                                                      s->session);\n            } else {\n                SSL_CTX_remove_session(s->session_ctx, s->session);\n            }\n        }\n        if ((new_sess = ssl_session_dup(s->session, 0)) == 0) {\n            al = SSL_AD_INTERNAL_ERROR;\n            SSLerr(SSL_F_SSL3_GET_NEW_SESSION_TICKET, ERR_R_MALLOC_FAILURE);\n            goto f_err;\n        }\n        SSL_SESSION_free(s->session);\n        s->session = new_sess;\n    }\n    n2l(p, s->session->tlsext_tick_lifetime_hint);\n    n2s(p, ticklen);\n    if (ticklen + 6 != n) {\n        al = SSL_AD_DECODE_ERROR;\n        SSLerr(SSL_F_SSL3_GET_NEW_SESSION_TICKET, SSL_R_LENGTH_MISMATCH);\n        goto f_err;\n    }\n    OPENSSL_free(s->session->tlsext_tick);\n    s->session->tlsext_ticklen = 0;\n    s->session->tlsext_tick = OPENSSL_malloc(ticklen);\n    if (!s->session->tlsext_tick) {\n        SSLerr(SSL_F_SSL3_GET_NEW_SESSION_TICKET, ERR_R_MALLOC_FAILURE);\n        goto err;\n    }\n    memcpy(s->session->tlsext_tick, p, ticklen);\n    s->session->tlsext_ticklen = ticklen;\n    EVP_Digest(p, ticklen,\n               s->session->session_id, &s->session->session_id_length,\n               EVP_sha256(), NULL);\n    ret = 1;\n    return (ret);\n f_err:\n    ssl3_send_alert(s, SSL3_AL_FATAL, al);\n err:\n    s->state = SSL_ST_ERR;\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}']