apps/s_server.c:2605: error: INTEGER_OVERFLOW_L2
  ([0, +oo] - 1):unsigned64 by call to `SSL_accept`.
Showing all 22 steps of the trace


apps/s_server.c:2588:13: Call
2586.               return 0;
2587.           }
2588.           i = DTLSv1_listen(con, client);
                    ^
2589.           if (i > 0) {
2590.               BIO *wbio;

ssl/d1_lib.c:414:1: Parameter `s->session_ctx->sessions->num_items`
  412.   
  413.   #ifndef OPENSSL_NO_SOCK
  414. > int DTLSv1_listen(SSL *s, BIO_ADDR *client)
  415.   {
  416.       int next, n, ret = 0, clearpkt = 0;

ssl/d1_lib.c:434:10: Call
  432.   
  433.       /* Ensure there is no state left over from a previous invocation */
  434.       if (!SSL_clear(s))
                  ^
  435.           return -1;
  436.   

ssl/ssl_lib.c:444:1: Parameter `s->session_ctx->sessions->num_items`
    442.   }
    443.   
    444. > int SSL_clear(SSL *s)
    445.   {
    446.       if (s->method == NULL) {

apps/s_server.c:2605:17: Call
2603.               BIO_ADDR_free(client);
2604.               dtlslisten = 0;
2605.               i = SSL_accept(con);
                        ^
2606.           } else {
2607.               BIO_ADDR_free(client);

ssl/ssl_lib.c:1459:1: Parameter `s->session_ctx->sessions->num_items`
  1457.   }
  1458.   
  1459. > int SSL_accept(SSL *s)
  1460.   {
  1461.       if (s->handshake_func == NULL) {

ssl/ssl_lib.c:1466:12: Call
  1464.       }
  1465.   
  1466.       return SSL_do_handshake(s);
                     ^
  1467.   }
  1468.   

ssl/ssl_lib.c:3245:1: Parameter `s->session_ctx->sessions->num_items`
    3243.   }
    3244.   
    3245. > int SSL_do_handshake(SSL *s)
    3246.   {
    3247.       int ret = 1;

ssl/ssl_lib.c:3257:17: Call
    3255.           int edfin;
    3256.   
    3257.           edfin = ssl_write_early_finish(s);
                            ^
    3258.           if (edfin <= 0)
    3259.               return edfin;

ssl/ssl_lib.c:1865:1: Parameter `s->session_ctx->sessions->num_items`
      1863.   }
      1864.   
      1865. > static int ssl_write_early_finish(SSL *s)
      1866.   {
      1867.       int ret;

ssl/ssl_lib.c:1875:11: Call
      1873.   
      1874.       s->early_data_state = SSL_EARLY_DATA_WRITING;
      1875.       ret = ssl3_send_alert(s, SSL3_AL_WARNING, SSL_AD_END_OF_EARLY_DATA);
                        ^
      1876.       if (ret <= 0) {
      1877.           s->early_data_state = SSL_EARLY_DATA_WRITE_RETRY;

ssl/s3_msg.c:63:1: Parameter `s->session_ctx->sessions->num_items`
        61.   }
        62.   
        63. > int ssl3_send_alert(SSL *s, int level, int desc)
        64.   {
        65.       /* Map tls/ssl alert value to correct one */

ssl/s3_msg.c:77:9: Call
        75.       /* If a fatal one, remove from cache */
        76.       if ((level == SSL3_AL_FATAL) && (s->session != NULL))
        77.           SSL_CTX_remove_session(s->session_ctx, s->session);
                      ^
        78.   
        79.       s->s3->alert_dispatch = 1;

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

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

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

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

ssl/ssl_locl.h:688:1: Parameter `lh->num_items`
              686.   } CLIENTHELLO_MSG;
              687.   
              688. > DEFINE_LHASH_OF(SSL_SESSION);
              689.   /* Needed in ssl_cert.c */
              690.   DEFINE_LHASH_OF(X509_NAME);

ssl/ssl_locl.h:688:1: Call
              686.   } CLIENTHELLO_MSG;
              687.   
              688. > DEFINE_LHASH_OF(SSL_SESSION);
              689.   /* Needed in ssl_cert.c */
              690.   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_accept` 
                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 int init_ssl_connection(SSL *con)\n{\n    int i;\n    long verify_err;\n    int retry = 0;\n#ifndef OPENSSL_NO_DTLS\n    if (dtlslisten) {\n        BIO_ADDR *client = NULL;\n        if ((client = BIO_ADDR_new()) == NULL) {\n            BIO_printf(bio_err, "ERROR - memory\\n");\n            return 0;\n        }\n        i = DTLSv1_listen(con, client);\n        if (i > 0) {\n            BIO *wbio;\n            int fd = -1;\n            wbio = SSL_get_wbio(con);\n            if (wbio) {\n                BIO_get_fd(wbio, &fd);\n            }\n            if (!wbio || BIO_connect(fd, client, 0) == 0) {\n                BIO_printf(bio_err, "ERROR - unable to connect\\n");\n                BIO_ADDR_free(client);\n                return 0;\n            }\n            BIO_ADDR_free(client);\n            dtlslisten = 0;\n            i = SSL_accept(con);\n        } else {\n            BIO_ADDR_free(client);\n        }\n    } else\n#endif\n    do {\n        i = SSL_accept(con);\n        if (i <= 0)\n            retry = BIO_sock_should_retry(i);\n#ifdef CERT_CB_TEST_RETRY\n        {\n            while (i <= 0\n                    && SSL_get_error(con, i) == SSL_ERROR_WANT_X509_LOOKUP\n                    && SSL_get_state(con) == TLS_ST_SR_CLNT_HELLO) {\n                BIO_printf(bio_err,\n                           "LOOKUP from certificate callback during accept\\n");\n                i = SSL_accept(con);\n                if (i <= 0)\n                    retry = BIO_sock_should_retry(i);\n            }\n        }\n#endif\n#ifndef OPENSSL_NO_SRP\n        while (i <= 0\n               && SSL_get_error(con, i) == SSL_ERROR_WANT_X509_LOOKUP) {\n            BIO_printf(bio_s_out, "LOOKUP during accept %s\\n",\n                       srp_callback_parm.login);\n            SRP_user_pwd_free(srp_callback_parm.user);\n            srp_callback_parm.user =\n                SRP_VBASE_get1_by_user(srp_callback_parm.vb,\n                                       srp_callback_parm.login);\n            if (srp_callback_parm.user)\n                BIO_printf(bio_s_out, "LOOKUP done %s\\n",\n                           srp_callback_parm.user->info);\n            else\n                BIO_printf(bio_s_out, "LOOKUP not successful\\n");\n            i = SSL_accept(con);\n            if (i <= 0)\n                retry = BIO_sock_should_retry(i);\n        }\n#endif\n    } while (i < 0 && SSL_waiting_for_async(con));\n    if (i <= 0) {\n        if ((dtlslisten && i == 0)\n                || (!dtlslisten && retry)) {\n            BIO_printf(bio_s_out, "DELAY\\n");\n            return (1);\n        }\n        BIO_printf(bio_err, "ERROR\\n");\n        verify_err = SSL_get_verify_result(con);\n        if (verify_err != X509_V_OK) {\n            BIO_printf(bio_err, "verify error:%s\\n",\n                       X509_verify_cert_error_string(verify_err));\n        }\n        ERR_print_errors(bio_err);\n        return (0);\n    }\n    print_connection_info(con);\n    return 1;\n}', 'int DTLSv1_listen(SSL *s, BIO_ADDR *client)\n{\n    int next, n, ret = 0, clearpkt = 0;\n    unsigned char cookie[DTLS1_COOKIE_LENGTH];\n    unsigned char seq[SEQ_NUM_SIZE];\n    const unsigned char *data;\n    unsigned char *buf;\n    size_t fragoff, fraglen, msglen;\n    unsigned int rectype, versmajor, msgseq, msgtype, clientvers, cookielen;\n    BIO *rbio, *wbio;\n    BUF_MEM *bufm;\n    BIO_ADDR *tmpclient = NULL;\n    PACKET pkt, msgpkt, msgpayload, session, cookiepkt;\n    if (s->handshake_func == NULL) {\n        SSL_set_accept_state(s);\n    }\n    if (!SSL_clear(s))\n        return -1;\n    ERR_clear_error();\n    rbio = SSL_get_rbio(s);\n    wbio = SSL_get_wbio(s);\n    if (!rbio || !wbio) {\n        SSLerr(SSL_F_DTLSV1_LISTEN, SSL_R_BIO_NOT_SET);\n        return -1;\n    }\n    BIO_ctrl(SSL_get_rbio(s), BIO_CTRL_DGRAM_SET_PEEK_MODE, 1, NULL);\n    if ((s->version & 0xff00) != (DTLS1_VERSION & 0xff00)) {\n        SSLerr(SSL_F_DTLSV1_LISTEN, SSL_R_UNSUPPORTED_SSL_VERSION);\n        return -1;\n    }\n    if (s->init_buf == NULL) {\n        if ((bufm = BUF_MEM_new()) == NULL) {\n            SSLerr(SSL_F_DTLSV1_LISTEN, ERR_R_MALLOC_FAILURE);\n            return -1;\n        }\n        if (!BUF_MEM_grow(bufm, SSL3_RT_MAX_PLAIN_LENGTH)) {\n            BUF_MEM_free(bufm);\n            SSLerr(SSL_F_DTLSV1_LISTEN, ERR_R_MALLOC_FAILURE);\n            return -1;\n        }\n        s->init_buf = bufm;\n    }\n    buf = (unsigned char *)s->init_buf->data;\n    do {\n        clear_sys_error();\n        n = BIO_read(rbio, buf, SSL3_RT_MAX_PLAIN_LENGTH);\n        if (n <= 0) {\n            if (BIO_should_retry(rbio)) {\n                goto end;\n            }\n            return -1;\n        }\n        clearpkt = 1;\n        if (!PACKET_buf_init(&pkt, buf, n)) {\n            SSLerr(SSL_F_DTLSV1_LISTEN, ERR_R_INTERNAL_ERROR);\n            return -1;\n        }\n        if (n < DTLS1_RT_HEADER_LENGTH) {\n            SSLerr(SSL_F_DTLSV1_LISTEN, SSL_R_RECORD_TOO_SMALL);\n            goto end;\n        }\n        if (s->msg_callback)\n            s->msg_callback(0, 0, SSL3_RT_HEADER, buf,\n                            DTLS1_RT_HEADER_LENGTH, s, s->msg_callback_arg);\n        if (!PACKET_get_1(&pkt, &rectype)\n            || !PACKET_get_1(&pkt, &versmajor)) {\n            SSLerr(SSL_F_DTLSV1_LISTEN, SSL_R_LENGTH_MISMATCH);\n            goto end;\n        }\n        if (rectype != SSL3_RT_HANDSHAKE) {\n            SSLerr(SSL_F_DTLSV1_LISTEN, SSL_R_UNEXPECTED_MESSAGE);\n            goto end;\n        }\n        if (versmajor != DTLS1_VERSION_MAJOR) {\n            SSLerr(SSL_F_DTLSV1_LISTEN, SSL_R_BAD_PROTOCOL_VERSION_NUMBER);\n            goto end;\n        }\n        if (!PACKET_forward(&pkt, 1)\n            || !PACKET_copy_bytes(&pkt, seq, SEQ_NUM_SIZE)\n            || !PACKET_get_length_prefixed_2(&pkt, &msgpkt)) {\n            SSLerr(SSL_F_DTLSV1_LISTEN, SSL_R_LENGTH_MISMATCH);\n            goto end;\n        }\n        if (seq[0] != 0 || seq[1] != 0) {\n            SSLerr(SSL_F_DTLSV1_LISTEN, SSL_R_UNEXPECTED_MESSAGE);\n            goto end;\n        }\n        data = PACKET_data(&msgpkt);\n        if (!PACKET_get_1(&msgpkt, &msgtype)\n            || !PACKET_get_net_3_len(&msgpkt, &msglen)\n            || !PACKET_get_net_2(&msgpkt, &msgseq)\n            || !PACKET_get_net_3_len(&msgpkt, &fragoff)\n            || !PACKET_get_net_3_len(&msgpkt, &fraglen)\n            || !PACKET_get_sub_packet(&msgpkt, &msgpayload, fraglen)\n            || PACKET_remaining(&msgpkt) != 0) {\n            SSLerr(SSL_F_DTLSV1_LISTEN, SSL_R_LENGTH_MISMATCH);\n            goto end;\n        }\n        if (msgtype != SSL3_MT_CLIENT_HELLO) {\n            SSLerr(SSL_F_DTLSV1_LISTEN, SSL_R_UNEXPECTED_MESSAGE);\n            goto end;\n        }\n        if (msgseq > 2) {\n            SSLerr(SSL_F_DTLSV1_LISTEN, SSL_R_INVALID_SEQUENCE_NUMBER);\n            goto end;\n        }\n        if (fragoff != 0 || fraglen > msglen) {\n            SSLerr(SSL_F_DTLSV1_LISTEN, SSL_R_FRAGMENTED_CLIENT_HELLO);\n            goto end;\n        }\n        if (s->msg_callback)\n            s->msg_callback(0, s->version, SSL3_RT_HANDSHAKE, data,\n                            fraglen + DTLS1_HM_HEADER_LENGTH, s,\n                            s->msg_callback_arg);\n        if (!PACKET_get_net_2(&msgpayload, &clientvers)) {\n            SSLerr(SSL_F_DTLSV1_LISTEN, SSL_R_LENGTH_MISMATCH);\n            goto end;\n        }\n        if (DTLS_VERSION_LT(clientvers, (unsigned int)s->method->version) &&\n            s->method->version != DTLS_ANY_VERSION) {\n            SSLerr(SSL_F_DTLSV1_LISTEN, SSL_R_WRONG_VERSION_NUMBER);\n            goto end;\n        }\n        if (!PACKET_forward(&msgpayload, SSL3_RANDOM_SIZE)\n            || !PACKET_get_length_prefixed_1(&msgpayload, &session)\n            || !PACKET_get_length_prefixed_1(&msgpayload, &cookiepkt)) {\n            SSLerr(SSL_F_DTLSV1_LISTEN, SSL_R_LENGTH_MISMATCH);\n            goto end;\n        }\n        if (PACKET_remaining(&cookiepkt) == 0) {\n            next = LISTEN_SEND_VERIFY_REQUEST;\n        } else {\n            if (s->ctx->app_verify_cookie_cb == NULL) {\n                SSLerr(SSL_F_DTLSV1_LISTEN, SSL_R_NO_VERIFY_COOKIE_CALLBACK);\n                return -1;\n            }\n            if (s->ctx->app_verify_cookie_cb(s, PACKET_data(&cookiepkt),\n                    (unsigned int)PACKET_remaining(&cookiepkt)) == 0) {\n                next = LISTEN_SEND_VERIFY_REQUEST;\n            } else {\n                next = LISTEN_SUCCESS;\n            }\n        }\n        if (next == LISTEN_SEND_VERIFY_REQUEST) {\n            WPACKET wpkt;\n            unsigned int version;\n            size_t wreclen;\n            BIO_ctrl(SSL_get_rbio(s), BIO_CTRL_DGRAM_SET_PEEK_MODE, 0, NULL);\n            BIO_read(rbio, buf, SSL3_RT_MAX_PLAIN_LENGTH);\n            BIO_ctrl(SSL_get_rbio(s), BIO_CTRL_DGRAM_SET_PEEK_MODE, 1, NULL);\n            if (s->ctx->app_gen_cookie_cb == NULL ||\n                s->ctx->app_gen_cookie_cb(s, cookie, &cookielen) == 0 ||\n                cookielen > 255) {\n                SSLerr(SSL_F_DTLSV1_LISTEN, SSL_R_COOKIE_GEN_CALLBACK_FAILURE);\n                return -1;\n            }\n            version = (s->method->version == DTLS_ANY_VERSION) ? DTLS1_VERSION\n                                                               : s->version;\n            if (!WPACKET_init(&wpkt, s->init_buf)\n                    || !WPACKET_put_bytes_u8(&wpkt, SSL3_RT_HANDSHAKE)\n                    || !WPACKET_put_bytes_u16(&wpkt, version)\n                    || !WPACKET_memcpy(&wpkt, seq, SEQ_NUM_SIZE)\n                    || !WPACKET_start_sub_packet_u16(&wpkt)\n                    || !WPACKET_put_bytes_u8(&wpkt,\n                                             DTLS1_MT_HELLO_VERIFY_REQUEST)\n                    || !WPACKET_put_bytes_u24(&wpkt, 0)\n                    || !WPACKET_put_bytes_u16(&wpkt, 0)\n                    || !WPACKET_put_bytes_u24(&wpkt, 0)\n                    || !WPACKET_start_sub_packet_u24(&wpkt)\n                    || !dtls_raw_hello_verify_request(&wpkt, cookie, cookielen)\n                    || !WPACKET_close(&wpkt)\n                    || !WPACKET_close(&wpkt)\n                    || !WPACKET_get_total_written(&wpkt, &wreclen)\n                    || !WPACKET_finish(&wpkt)) {\n                SSLerr(SSL_F_DTLSV1_LISTEN, ERR_R_INTERNAL_ERROR);\n                WPACKET_cleanup(&wpkt);\n                return -1;\n            }\n            memcpy(&buf[DTLS1_RT_HEADER_LENGTH + 1],\n                   &buf[DTLS1_RT_HEADER_LENGTH + DTLS1_HM_HEADER_LENGTH - 3],\n                   3);\n            if (s->msg_callback)\n                s->msg_callback(1, 0, SSL3_RT_HEADER, buf,\n                                DTLS1_RT_HEADER_LENGTH, s, s->msg_callback_arg);\n            if ((tmpclient = BIO_ADDR_new()) == NULL) {\n                SSLerr(SSL_F_DTLSV1_LISTEN, ERR_R_MALLOC_FAILURE);\n                goto end;\n            }\n            if (BIO_dgram_get_peer(rbio, tmpclient) > 0) {\n                (void)BIO_dgram_set_peer(wbio, tmpclient);\n            }\n            BIO_ADDR_free(tmpclient);\n            tmpclient = NULL;\n            if (BIO_write(wbio, buf, wreclen) < (int)wreclen) {\n                if (BIO_should_retry(wbio)) {\n                    goto end;\n                }\n                return -1;\n            }\n            if (BIO_flush(wbio) <= 0) {\n                if (BIO_should_retry(wbio)) {\n                    goto end;\n                }\n                return -1;\n            }\n        }\n    } while (next != LISTEN_SUCCESS);\n    s->d1->handshake_read_seq = 1;\n    s->d1->handshake_write_seq = 1;\n    s->d1->next_handshake_write_seq = 1;\n    DTLS_RECORD_LAYER_set_write_sequence(&s->rlayer, seq);\n    SSL_set_options(s, SSL_OP_COOKIE_EXCHANGE);\n    ossl_statem_set_hello_verify_done(s);\n    if (BIO_dgram_get_peer(rbio, client) <= 0)\n        BIO_ADDR_clear(client);\n    ret = 1;\n    clearpkt = 0;\n end:\n    BIO_ADDR_free(tmpclient);\n    BIO_ctrl(SSL_get_rbio(s), BIO_CTRL_DGRAM_SET_PEEK_MODE, 0, NULL);\n    if (clearpkt) {\n        BIO_read(rbio, buf, SSL3_RT_MAX_PLAIN_LENGTH);\n    }\n    return ret;\n}', 'int SSL_clear(SSL *s)\n{\n    if (s->method == NULL) {\n        SSLerr(SSL_F_SSL_CLEAR, SSL_R_NO_METHOD_SPECIFIED);\n        return (0);\n    }\n    if (ssl_clear_bad_session(s)) {\n        SSL_SESSION_free(s->session);\n        s->session = NULL;\n    }\n    s->error = 0;\n    s->hit = 0;\n    s->shutdown = 0;\n    if (s->renegotiate) {\n        SSLerr(SSL_F_SSL_CLEAR, ERR_R_INTERNAL_ERROR);\n        return 0;\n    }\n    ossl_statem_clear(s);\n    s->version = s->method->version;\n    s->client_version = s->version;\n    s->rwstate = SSL_NOTHING;\n    BUF_MEM_free(s->init_buf);\n    s->init_buf = NULL;\n    clear_ciphers(s);\n    s->first_packet = 0;\n    s->key_update = SSL_KEY_UPDATE_NONE;\n    s->dane.mdpth = -1;\n    s->dane.pdpth = -1;\n    X509_free(s->dane.mcert);\n    s->dane.mcert = NULL;\n    s->dane.mtlsa = NULL;\n    X509_VERIFY_PARAM_move_peername(s->param, NULL);\n    if (!ossl_statem_get_in_handshake(s) && (s->session == NULL)\n        && (s->method != s->ctx->method)) {\n        s->method->ssl_free(s);\n        s->method = s->ctx->method;\n        if (!s->method->ssl_new(s))\n            return (0);\n    } else\n        s->method->ssl_clear(s);\n    RECORD_LAYER_clear(&s->rlayer);\n    return (1);\n}', 'int SSL_accept(SSL *s)\n{\n    if (s->handshake_func == NULL) {\n        SSL_set_accept_state(s);\n    }\n    return SSL_do_handshake(s);\n}', 'int SSL_do_handshake(SSL *s)\n{\n    int ret = 1;\n    if (s->handshake_func == NULL) {\n        SSLerr(SSL_F_SSL_DO_HANDSHAKE, SSL_R_CONNECTION_TYPE_NOT_SET);\n        return -1;\n    }\n    if (s->early_data_state == SSL_EARLY_DATA_WRITE_RETRY) {\n        int edfin;\n        edfin = ssl_write_early_finish(s);\n        if (edfin <= 0)\n            return edfin;\n    }\n    ossl_statem_check_finish_init(s, -1);\n    s->method->ssl_renegotiate_check(s, 0);\n    if (SSL_in_init(s) || SSL_in_before(s)) {\n        if ((s->mode & SSL_MODE_ASYNC) && ASYNC_get_current_job() == NULL) {\n            struct ssl_async_args args;\n            args.s = s;\n            ret = ssl_start_async_job(s, &args, ssl_do_handshake_intern);\n        } else {\n            ret = s->handshake_func(s);\n        }\n    }\n    return ret;\n}', 'static int ssl_write_early_finish(SSL *s)\n{\n    int ret;\n    if (s->early_data_state != SSL_EARLY_DATA_WRITE_RETRY) {\n        SSLerr(SSL_F_SSL_WRITE_EARLY_FINISH, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);\n        return 0;\n    }\n    s->early_data_state = SSL_EARLY_DATA_WRITING;\n    ret = ssl3_send_alert(s, SSL3_AL_WARNING, SSL_AD_END_OF_EARLY_DATA);\n    if (ret <= 0) {\n        s->early_data_state = SSL_EARLY_DATA_WRITE_RETRY;\n        return 0;\n    }\n    s->early_data_state = SSL_EARLY_DATA_FINISHED_WRITING;\n    EVP_CIPHER_CTX_free(s->enc_write_ctx);\n    s->enc_write_ctx = NULL;\n    ossl_statem_set_in_init(s, 1);\n    return 1;\n}', 'int ssl3_send_alert(SSL *s, int level, int desc)\n{\n    if (SSL_TREAT_AS_TLS13(s))\n        desc = tls13_alert_code(desc);\n    else\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->session_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_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}', 'DEFINE_LHASH_OF(SSL_SESSION)', '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}']