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


ssl/s3_clnt.c:175:1: Parameter `s->ctx->sessions->num_items`
173.   
174.   
175. > int ssl3_connect(SSL *s)
176.   {
177.       BUF_MEM *buf = NULL;

ssl/s3_clnt.c:372:19: Call
370.           case SSL3_ST_CR_CERT_REQ_A:
371.           case SSL3_ST_CR_CERT_REQ_B:
372.               ret = ssl3_get_certificate_request(s);
                         ^
373.               if (ret <= 0)
374.                   goto end;

ssl/s3_clnt.c:2008:1: Parameter `s->ctx->sessions->num_items`
  2006.   }
  2007.   
  2008. > int ssl3_get_certificate_request(SSL *s)
  2009.   {
  2010.       int ok, ret = 0;

ssl/s3_clnt.c:2040:9: Call
  2038.   
  2039.       if (s->s3->tmp.message_type != SSL3_MT_CERTIFICATE_REQUEST) {
  2040.           ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_UNEXPECTED_MESSAGE);
                  ^
  2041.           SSLerr(SSL_F_SSL3_GET_CERTIFICATE_REQUEST, SSL_R_WRONG_MESSAGE_TYPE);
  2042.           goto err;

ssl/s3_msg.c:166:1: Parameter `s->ctx->sessions->num_items`
    164.   }
    165.   
    166. > int ssl3_send_alert(SSL *s, int level, int desc)
    167.   {
    168.       /* Map tls/ssl alert value to correct one */

ssl/s3_msg.c:177:9: Call
    175.       /* If a fatal one, remove from cache */
    176.       if ((level == SSL3_AL_FATAL) && (s->session != NULL))
    177.           SSL_CTX_remove_session(s->ctx, s->session);
                   ^
    178.   
    179.       s->s3->alert_dispatch = 1;

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->ctx->sessions->num_items)] - 1):unsigned64 by call to `ssl3_get_certificate_request` 
          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 ssl3_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    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_HEARTBEATS\n    if (s->tlsext_hb_pending) {\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 >> 8) != SSL3_VERSION_MAJOR\n                    && s->version != TLS_ANY_VERSION) {\n                SSLerr(SSL_F_SSL3_CONNECT, ERR_R_INTERNAL_ERROR);\n                s->state = SSL_ST_ERR;\n                ret = -1;\n                goto end;\n            }\n            if (s->version != TLS_ANY_VERSION &&\n                    !ssl_security(s, SSL_SECOP_VERSION, 0, s->version, NULL)) {\n                SSLerr(SSL_F_SSL3_CONNECT, SSL_R_VERSION_TOO_LOW);\n                return -1;\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                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            ssl3_init_finished_mac(s);\n            s->state = SSL3_ST_CW_CLNT_HELLO_A;\n            s->ctx->stats.sess_connect++;\n            s->init_num = 0;\n            s->s3->change_cipher_spec = 0;\n            break;\n        case SSL3_ST_CW_CLNT_HELLO_A:\n        case SSL3_ST_CW_CLNT_HELLO_B:\n            s->shutdown = 0;\n            ret = ssl3_client_hello(s);\n            if (ret <= 0)\n                goto end;\n            s->state = SSL3_ST_CR_SRVR_HELLO_A;\n            s->init_num = 0;\n            if (s->bbio != s->wbio)\n                s->wbio = BIO_push(s->bbio, s->wbio);\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            if (s->hit) {\n                s->state = SSL3_ST_CR_CHANGE_A;\n                if (s->tlsext_ticket_expected) {\n                    s->state = SSL3_ST_CR_SESSION_TICKET_A;\n                }\n            } else {\n                s->state = SSL3_ST_CR_CERT_A;\n            }\n            s->init_num = 0;\n            break;\n        case SSL3_ST_CR_CERT_A:\n        case SSL3_ST_CR_CERT_B:\n            ret = ssl3_check_change(s);\n            if (ret < 0)\n                goto end;\n            if (ret == 1) {\n                s->hit = 1;\n                s->state = SSL3_ST_CR_CHANGE_A;\n                s->init_num = 0;\n                break;\n            }\n            if (!(s->s3->tmp.new_cipher->algorithm_auth &\n                    (SSL_aNULL | SSL_aSRP | SSL_aPSK))) {\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#ifndef OPENSSL_NO_SRP\n            if (s->s3->tmp.new_cipher->algorithm_mkey & SSL_kSRP) {\n                if ((ret = SRP_Calc_A_param(s)) <= 0) {\n                    SSLerr(SSL_F_SSL3_CONNECT, SSL_R_SRP_A_CALC);\n                    ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_INTERNAL_ERROR);\n                    s->state = SSL_ST_ERR;\n                    goto end;\n                }\n            }\n#endif\n            if (s->s3->tmp.cert_req)\n                s->state = SSL3_ST_CW_CERT_A;\n            else\n                s->state = SSL3_ST_CW_KEY_EXCH_A;\n            s->init_num = 0;\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            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            ret = ssl3_send_client_key_exchange(s);\n            if (ret <= 0)\n                goto end;\n            if (s->s3->tmp.cert_req == 1) {\n                s->state = SSL3_ST_CW_CERT_VRFY_A;\n            } else {\n                s->state = SSL3_ST_CW_CHANGE_A;\n            }\n            if (s->s3->flags & TLS1_FLAGS_SKIP_CERT_VERIFY) {\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            ret = ssl3_send_client_verify(s);\n            if (ret <= 0)\n                goto end;\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            ret = ssl3_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#if defined(OPENSSL_NO_NEXTPROTONEG)\n            s->state = SSL3_ST_CW_FINISHED_A;\n#else\n            if (s->s3->next_proto_neg_seen)\n                s->state = SSL3_ST_CW_NEXT_PROTO_A;\n            else\n                s->state = SSL3_ST_CW_FINISHED_A;\n#endif\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            break;\n#if !defined(OPENSSL_NO_NEXTPROTONEG)\n        case SSL3_ST_CW_NEXT_PROTO_A:\n        case SSL3_ST_CW_NEXT_PROTO_B:\n            ret = ssl3_send_next_proto(s);\n            if (ret <= 0)\n                goto end;\n            s->state = SSL3_ST_CW_FINISHED_A;\n            break;\n#endif\n        case SSL3_ST_CW_FINISHED_A:\n        case SSL3_ST_CW_FINISHED_B:\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            } else {\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            if (s->hit)\n                s->state = SSL3_ST_CW_CHANGE_A;\n            else\n                s->state = SSL_ST_OK;\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                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            BUF_MEM_free(s->init_buf);\n            s->init_buf = NULL;\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 = ssl3_connect;\n            s->ctx->stats.sess_connect_good++;\n            if (cb != NULL)\n                cb(s, SSL_CB_HANDSHAKE_DONE, 1);\n            goto end;\n        case SSL_ST_ERR:\n        default:\n            SSLerr(SSL_F_SSL3_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    BUF_MEM_free(buf);\n    if (cb != NULL)\n        cb(s, SSL_CB_CONNECT_EXIT, ret);\n    return (ret);\n}', 'int ssl3_get_certificate_request(SSL *s)\n{\n    int ok, ret = 0;\n    unsigned long n, nc, l;\n    unsigned int llen, ctype_num, i;\n    X509_NAME *xn = NULL;\n    const unsigned char *p, *q;\n    unsigned char *d;\n    STACK_OF(X509_NAME) *ca_sk = NULL;\n    n = s->method->ssl_get_message(s,\n                                   SSL3_ST_CR_CERT_REQ_A,\n                                   SSL3_ST_CR_CERT_REQ_B,\n                                   -1, s->max_cert_list, &ok);\n    if (!ok)\n        return ((int)n);\n    s->s3->tmp.cert_req = 0;\n    if (s->s3->tmp.message_type == SSL3_MT_SERVER_DONE) {\n        s->s3->tmp.reuse_message = 1;\n        if (!ssl3_digest_cached_records(s, 0))\n            goto err;\n        return (1);\n    }\n    if (s->s3->tmp.message_type != SSL3_MT_CERTIFICATE_REQUEST) {\n        ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_UNEXPECTED_MESSAGE);\n        SSLerr(SSL_F_SSL3_GET_CERTIFICATE_REQUEST, SSL_R_WRONG_MESSAGE_TYPE);\n        goto err;\n    }\n    if (s->version > SSL3_VERSION) {\n        if (s->s3->tmp.new_cipher->algorithm_auth & SSL_aNULL) {\n            ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_UNEXPECTED_MESSAGE);\n            SSLerr(SSL_F_SSL3_GET_CERTIFICATE_REQUEST,\n                   SSL_R_TLS_CLIENT_CERT_REQ_WITH_ANON_CIPHER);\n            goto err;\n        }\n    }\n    p = d = (unsigned char *)s->init_msg;\n    if ((ca_sk = sk_X509_NAME_new(ca_dn_cmp)) == NULL) {\n        SSLerr(SSL_F_SSL3_GET_CERTIFICATE_REQUEST, ERR_R_MALLOC_FAILURE);\n        goto err;\n    }\n    ctype_num = *(p++);\n    OPENSSL_free(s->cert->ctypes);\n    s->cert->ctypes = NULL;\n    if (ctype_num > SSL3_CT_NUMBER) {\n        s->cert->ctypes = OPENSSL_malloc(ctype_num);\n        if (s->cert->ctypes == NULL) {\n            SSLerr(SSL_F_SSL3_GET_CERTIFICATE_REQUEST, ERR_R_MALLOC_FAILURE);\n            goto err;\n        }\n        memcpy(s->cert->ctypes, p, ctype_num);\n        s->cert->ctype_num = (size_t)ctype_num;\n        ctype_num = SSL3_CT_NUMBER;\n    }\n    for (i = 0; i < ctype_num; i++)\n        s->s3->tmp.ctype[i] = p[i];\n    p += p[-1];\n    if (SSL_USE_SIGALGS(s)) {\n        n2s(p, llen);\n        if ((unsigned long)(p - d + llen + 2) > n) {\n            ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_DECODE_ERROR);\n            SSLerr(SSL_F_SSL3_GET_CERTIFICATE_REQUEST,\n                   SSL_R_DATA_LENGTH_TOO_LONG);\n            goto err;\n        }\n        for (i = 0; i < SSL_PKEY_NUM; i++) {\n            s->s3->tmp.md[i] = NULL;\n            s->s3->tmp.valid_flags[i] = 0;\n        }\n        if ((llen & 1) || !tls1_save_sigalgs(s, p, llen)) {\n            ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_DECODE_ERROR);\n            SSLerr(SSL_F_SSL3_GET_CERTIFICATE_REQUEST,\n                   SSL_R_SIGNATURE_ALGORITHMS_ERROR);\n            goto err;\n        }\n        if (!tls1_process_sigalgs(s)) {\n            ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_INTERNAL_ERROR);\n            SSLerr(SSL_F_SSL3_GET_CERTIFICATE_REQUEST, ERR_R_MALLOC_FAILURE);\n            goto err;\n        }\n        p += llen;\n    }\n    n2s(p, llen);\n    if ((unsigned long)(p - d + llen) != n) {\n        ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_DECODE_ERROR);\n        SSLerr(SSL_F_SSL3_GET_CERTIFICATE_REQUEST, SSL_R_LENGTH_MISMATCH);\n        goto err;\n    }\n    for (nc = 0; nc < llen;) {\n        n2s(p, l);\n        if ((l + nc + 2) > llen) {\n            ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_DECODE_ERROR);\n            SSLerr(SSL_F_SSL3_GET_CERTIFICATE_REQUEST, SSL_R_CA_DN_TOO_LONG);\n            goto err;\n        }\n        q = p;\n        if ((xn = d2i_X509_NAME(NULL, &q, l)) == NULL) {\n            ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_DECODE_ERROR);\n            SSLerr(SSL_F_SSL3_GET_CERTIFICATE_REQUEST, ERR_R_ASN1_LIB);\n            goto err;\n        }\n        if (q != (p + l)) {\n            ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_DECODE_ERROR);\n            SSLerr(SSL_F_SSL3_GET_CERTIFICATE_REQUEST,\n                   SSL_R_CA_DN_LENGTH_MISMATCH);\n            goto err;\n        }\n        if (!sk_X509_NAME_push(ca_sk, xn)) {\n            SSLerr(SSL_F_SSL3_GET_CERTIFICATE_REQUEST, ERR_R_MALLOC_FAILURE);\n            goto err;\n        }\n        p += l;\n        nc += l + 2;\n    }\n    s->s3->tmp.cert_req = 1;\n    s->s3->tmp.ctype_num = ctype_num;\n    sk_X509_NAME_pop_free(s->s3->tmp.ca_names, X509_NAME_free);\n    s->s3->tmp.ca_names = ca_sk;\n    ca_sk = NULL;\n    ret = 1;\n    goto done;\n err:\n    s->state = SSL_ST_ERR;\n done:\n    sk_X509_NAME_pop_free(ca_sk, X509_NAME_free);\n    return (ret);\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 (!RECORD_LAYER_write_pending(&s->rlayer)) {\n        return s->method->ssl_dispatch_alert(s);\n    }\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}']