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);
}
['MSG_PROCESS_RETURN tls_process_server_done(SSL *s, PACKET *pkt)\n{\n    if (PACKET_remaining(pkt) > 0) {\n        ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_DECODE_ERROR);\n        SSLerr(SSL_F_TLS_PROCESS_SERVER_DONE, SSL_R_LENGTH_MISMATCH);\n        ossl_statem_set_error(s);\n        return MSG_PROCESS_ERROR;\n    }\n#ifndef OPENSSL_NO_SRP\n    if (s->s3->tmp.new_cipher->algorithm_mkey & SSL_kSRP) {\n        if (SRP_Calc_A_param(s) <= 0) {\n            SSLerr(SSL_F_TLS_PROCESS_SERVER_DONE, SSL_R_SRP_A_CALC);\n            ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_INTERNAL_ERROR);\n            ossl_statem_set_error(s);\n            return MSG_PROCESS_ERROR;\n        }\n    }\n#endif\n    if (!ssl3_check_cert_and_algorithm(s)) {\n        ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_HANDSHAKE_FAILURE);\n        ossl_statem_set_error(s);\n        return MSG_PROCESS_ERROR;\n    }\n    if (s->tlsext_status_type != -1 && s->ctx->tlsext_status_cb != NULL) {\n        int ret;\n        ret = s->ctx->tlsext_status_cb(s, s->ctx->tlsext_status_arg);\n        if (ret == 0) {\n            ssl3_send_alert(s, SSL3_AL_FATAL,\n                            SSL_AD_BAD_CERTIFICATE_STATUS_RESPONSE);\n            SSLerr(SSL_F_TLS_PROCESS_SERVER_DONE,\n                   SSL_R_INVALID_STATUS_RESPONSE);\n            return MSG_PROCESS_ERROR;\n        }\n        if (ret < 0) {\n            ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_INTERNAL_ERROR);\n            SSLerr(SSL_F_TLS_PROCESS_SERVER_DONE, ERR_R_MALLOC_FAILURE);\n            return MSG_PROCESS_ERROR;\n        }\n    }\n#ifndef OPENSSL_NO_CT\n    if (s->ct_validation_callback != NULL) {\n        if (!ssl_validate_ct(s) && (s->verify_mode & SSL_VERIFY_PEER)) {\n            ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_HANDSHAKE_FAILURE);\n            return MSG_PROCESS_ERROR;\n        }\n    }\n#endif\n#ifndef OPENSSL_NO_SCTP\n    if (SSL_IS_DTLS(s) && BIO_dgram_is_sctp(SSL_get_wbio(s))\n            && s->renegotiate != 0)\n        return MSG_PROCESS_CONTINUE_PROCESSING;\n    else\n#endif\n        return MSG_PROCESS_FINISHED_READING;\n}', 'int ssl3_check_cert_and_algorithm(SSL *s)\n{\n    int i;\n#ifndef OPENSSL_NO_EC\n    int idx;\n#endif\n    long alg_k, alg_a;\n    EVP_PKEY *pkey = NULL;\n    int al = SSL_AD_HANDSHAKE_FAILURE;\n    alg_k = s->s3->tmp.new_cipher->algorithm_mkey;\n    alg_a = s->s3->tmp.new_cipher->algorithm_auth;\n    if ((alg_a & SSL_aNULL) || (alg_k & SSL_kPSK))\n        return (1);\n#ifndef OPENSSL_NO_EC\n    idx = s->session->peer_type;\n    if (idx == SSL_PKEY_ECC) {\n        if (ssl_check_srvr_ecc_cert_and_alg(s->session->peer, s) == 0) {\n            SSLerr(SSL_F_SSL3_CHECK_CERT_AND_ALGORITHM, SSL_R_BAD_ECC_CERT);\n            goto f_err;\n        } else {\n            return 1;\n        }\n    } else if (alg_a & SSL_aECDSA) {\n        SSLerr(SSL_F_SSL3_CHECK_CERT_AND_ALGORITHM,\n               SSL_R_MISSING_ECDSA_SIGNING_CERT);\n        goto f_err;\n    }\n#endif\n    pkey = X509_get0_pubkey(s->session->peer);\n    i = X509_certificate_type(s->session->peer, pkey);\n    if ((alg_a & SSL_aRSA) && !has_bits(i, EVP_PK_RSA | EVP_PKT_SIGN)) {\n        SSLerr(SSL_F_SSL3_CHECK_CERT_AND_ALGORITHM,\n               SSL_R_MISSING_RSA_SIGNING_CERT);\n        goto f_err;\n    }\n#ifndef OPENSSL_NO_DSA\n    else if ((alg_a & SSL_aDSS) && !has_bits(i, EVP_PK_DSA | EVP_PKT_SIGN)) {\n        SSLerr(SSL_F_SSL3_CHECK_CERT_AND_ALGORITHM,\n               SSL_R_MISSING_DSA_SIGNING_CERT);\n        goto f_err;\n    }\n#endif\n#ifndef OPENSSL_NO_RSA\n    if (alg_k & (SSL_kRSA | SSL_kRSAPSK) &&\n        !has_bits(i, EVP_PK_RSA | EVP_PKT_ENC)) {\n        SSLerr(SSL_F_SSL3_CHECK_CERT_AND_ALGORITHM,\n               SSL_R_MISSING_RSA_ENCRYPTING_CERT);\n        goto f_err;\n    }\n#endif\n#ifndef OPENSSL_NO_DH\n    if ((alg_k & SSL_kDHE) && (s->s3->peer_tmp == NULL)) {\n        al = SSL_AD_INTERNAL_ERROR;\n        SSLerr(SSL_F_SSL3_CHECK_CERT_AND_ALGORITHM, ERR_R_INTERNAL_ERROR);\n        goto f_err;\n    }\n#endif\n    return (1);\n f_err:\n    ssl3_send_alert(s, SSL3_AL_FATAL, al);\n    return (0);\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->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        if (lck)\n            CRYPTO_THREAD_unlock(ctx->lock);\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}', '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}']