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);
}
['WORK_STATE tls_post_process_client_hello(SSL *s, WORK_STATE wst)\n{\n    int al = SSL_AD_HANDSHAKE_FAILURE;\n    const SSL_CIPHER *cipher;\n    if (wst == WORK_MORE_A) {\n        if (!s->hit) {\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_TLS_POST_PROCESS_CLIENT_HELLO, SSL_R_CERT_CB_ERROR);\n                    goto f_err;\n                }\n                if (rv < 0) {\n                    s->rwstate = SSL_X509_LOOKUP;\n                    return WORK_MORE_A;\n                }\n                s->rwstate = SSL_NOTHING;\n            }\n            cipher = ssl3_choose_cipher(s, s->session->ciphers, SSL_get_ciphers(s));\n            if (cipher == NULL) {\n                SSLerr(SSL_F_TLS_POST_PROCESS_CLIENT_HELLO, SSL_R_NO_SHARED_CIPHER);\n                goto f_err;\n            }\n            s->s3->tmp.new_cipher = cipher;\n            if (s->not_resumable_session_cb != NULL)\n                s->session->not_resumable = s->not_resumable_session_cb(s,\n                    ((cipher->algorithm_mkey & (SSL_kDHE | SSL_kECDHE)) != 0));\n            if (s->session->not_resumable)\n                s->tlsext_ticket_expected = 0;\n        } else {\n            s->s3->tmp.new_cipher = s->session->cipher;\n        }\n        if (!(s->verify_mode & SSL_VERIFY_PEER)) {\n            if (!ssl3_digest_cached_records(s, 0)) {\n                al = SSL_AD_INTERNAL_ERROR;\n                goto f_err;\n            }\n        }\n        if (s->version >= SSL3_VERSION) {\n            if (ssl_check_clienthello_tlsext_late(s) <= 0) {\n                SSLerr(SSL_F_TLS_POST_PROCESS_CLIENT_HELLO,\n                       SSL_R_CLIENTHELLO_TLSEXT);\n                goto f_err;\n            }\n        }\n        wst = WORK_MORE_B;\n    }\n#ifndef OPENSSL_NO_SRP\n    if (wst == WORK_MORE_B) {\n        int ret;\n        if ((ret = ssl_check_srp_ext_ClientHello(s, &al)) < 0) {\n            s->rwstate = SSL_X509_LOOKUP;\n            return WORK_MORE_B;\n        }\n        if (ret != SSL_ERROR_NONE) {\n            if (al != TLS1_AD_UNKNOWN_PSK_IDENTITY)\n                SSLerr(SSL_F_TLS_POST_PROCESS_CLIENT_HELLO,\n                           SSL_R_CLIENTHELLO_TLSEXT);\n            goto f_err;\n        }\n    }\n#endif\n    s->renegotiate = 2;\n    return WORK_FINISHED_STOP;\n f_err:\n    ssl3_send_alert(s, SSL3_AL_FATAL, al);\n    ossl_statem_set_error(s);\n    return WORK_ERROR;\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}']