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_key_exchange(SSL *s, PACKET *pkt)\n{\n    int al = -1, ispss = 0;\n    long alg_k;\n    EVP_PKEY *pkey = NULL;\n    EVP_MD_CTX *md_ctx = NULL;\n    EVP_PKEY_CTX *pctx = NULL;\n    PACKET save_param_start, signature;\n    alg_k = s->s3->tmp.new_cipher->algorithm_mkey;\n    save_param_start = *pkt;\n#if !defined(OPENSSL_NO_EC) || !defined(OPENSSL_NO_DH)\n    EVP_PKEY_free(s->s3->peer_tmp);\n    s->s3->peer_tmp = NULL;\n#endif\n    if (alg_k & SSL_PSK) {\n        if (!tls_process_ske_psk_preamble(s, pkt, &al))\n            goto err;\n    }\n    if (alg_k & (SSL_kPSK | SSL_kRSAPSK)) {\n    } else if (alg_k & SSL_kSRP) {\n        if (!tls_process_ske_srp(s, pkt, &pkey, &al))\n            goto err;\n    } else if (alg_k & (SSL_kDHE | SSL_kDHEPSK)) {\n        if (!tls_process_ske_dhe(s, pkt, &pkey, &al))\n            goto err;\n    } else if (alg_k & (SSL_kECDHE | SSL_kECDHEPSK)) {\n        if (!tls_process_ske_ecdhe(s, pkt, &pkey, &al))\n            goto err;\n    } else if (alg_k) {\n        al = SSL_AD_UNEXPECTED_MESSAGE;\n        SSLerr(SSL_F_TLS_PROCESS_KEY_EXCHANGE, SSL_R_UNEXPECTED_MESSAGE);\n        goto err;\n    }\n    if (pkey != NULL) {\n        PACKET params;\n        int maxsig;\n        const EVP_MD *md = NULL;\n        if (!PACKET_get_sub_packet(&save_param_start, &params,\n                                   PACKET_remaining(&save_param_start) -\n                                   PACKET_remaining(pkt))) {\n            al = SSL_AD_INTERNAL_ERROR;\n            SSLerr(SSL_F_TLS_PROCESS_KEY_EXCHANGE, ERR_R_INTERNAL_ERROR);\n            goto err;\n        }\n        if (SSL_USE_SIGALGS(s)) {\n            unsigned int sigalg;\n            int rv;\n            if (!PACKET_get_net_2(pkt, &sigalg)) {\n                al = SSL_AD_DECODE_ERROR;\n                SSLerr(SSL_F_TLS_PROCESS_KEY_EXCHANGE, SSL_R_LENGTH_TOO_SHORT);\n                goto err;\n            }\n            rv = tls12_check_peer_sigalg(&md, s, sigalg, pkey);\n            if (rv == -1) {\n                al = SSL_AD_INTERNAL_ERROR;\n                goto err;\n            } else if (rv == 0) {\n                al = SSL_AD_DECODE_ERROR;\n                goto err;\n            }\n            ispss = SIGID_IS_PSS(sigalg);\n#ifdef SSL_DEBUG\n            fprintf(stderr, "USING TLSv1.2 HASH %s\\n", EVP_MD_name(md));\n#endif\n        } else if (EVP_PKEY_id(pkey) == EVP_PKEY_RSA) {\n            md = EVP_md5_sha1();\n        } else {\n            md = EVP_sha1();\n        }\n        if (!PACKET_get_length_prefixed_2(pkt, &signature)\n            || PACKET_remaining(pkt) != 0) {\n            al = SSL_AD_DECODE_ERROR;\n            SSLerr(SSL_F_TLS_PROCESS_KEY_EXCHANGE, SSL_R_LENGTH_MISMATCH);\n            goto err;\n        }\n        maxsig = EVP_PKEY_size(pkey);\n        if (maxsig < 0) {\n            al = SSL_AD_INTERNAL_ERROR;\n            SSLerr(SSL_F_TLS_PROCESS_KEY_EXCHANGE, ERR_R_INTERNAL_ERROR);\n            goto err;\n        }\n        if (PACKET_remaining(&signature) > (size_t)maxsig) {\n            al = SSL_AD_DECODE_ERROR;\n            SSLerr(SSL_F_TLS_PROCESS_KEY_EXCHANGE,\n                   SSL_R_WRONG_SIGNATURE_LENGTH);\n            goto err;\n        }\n        md_ctx = EVP_MD_CTX_new();\n        if (md_ctx == NULL) {\n            al = SSL_AD_INTERNAL_ERROR;\n            SSLerr(SSL_F_TLS_PROCESS_KEY_EXCHANGE, ERR_R_MALLOC_FAILURE);\n            goto err;\n        }\n        if (EVP_DigestVerifyInit(md_ctx, &pctx, md, NULL, pkey) <= 0) {\n            al = SSL_AD_INTERNAL_ERROR;\n            SSLerr(SSL_F_TLS_PROCESS_KEY_EXCHANGE, ERR_R_EVP_LIB);\n            goto err;\n        }\n        if (ispss) {\n            if (EVP_PKEY_CTX_set_rsa_padding(pctx, RSA_PKCS1_PSS_PADDING) <= 0\n                    || EVP_PKEY_CTX_set_rsa_pss_saltlen(pctx, -1) <= 0) {\n                al = SSL_AD_INTERNAL_ERROR;\n                SSLerr(SSL_F_TLS_PROCESS_KEY_EXCHANGE, ERR_R_EVP_LIB);\n                goto err;\n            }\n        }\n        if (EVP_DigestVerifyUpdate(md_ctx, &(s->s3->client_random[0]),\n                                   SSL3_RANDOM_SIZE) <= 0\n                || EVP_DigestVerifyUpdate(md_ctx, &(s->s3->server_random[0]),\n                                          SSL3_RANDOM_SIZE) <= 0\n                || EVP_DigestVerifyUpdate(md_ctx, PACKET_data(&params),\n                                          PACKET_remaining(&params)) <= 0) {\n            al = SSL_AD_INTERNAL_ERROR;\n            SSLerr(SSL_F_TLS_PROCESS_KEY_EXCHANGE, ERR_R_EVP_LIB);\n            goto err;\n        }\n        if (EVP_DigestVerifyFinal(md_ctx, PACKET_data(&signature),\n                                  PACKET_remaining(&signature)) <= 0) {\n            al = SSL_AD_DECRYPT_ERROR;\n            SSLerr(SSL_F_TLS_PROCESS_KEY_EXCHANGE, SSL_R_BAD_SIGNATURE);\n            goto err;\n        }\n        EVP_MD_CTX_free(md_ctx);\n        md_ctx = NULL;\n    } else {\n        if (!(s->s3->tmp.new_cipher->algorithm_auth & (SSL_aNULL | SSL_aSRP))\n            && !(alg_k & SSL_PSK)) {\n            if (ssl3_check_cert_and_algorithm(s)) {\n                al = SSL_AD_INTERNAL_ERROR;\n                SSLerr(SSL_F_TLS_PROCESS_KEY_EXCHANGE, ERR_R_INTERNAL_ERROR);\n            } else {\n                al = SSL_AD_DECODE_ERROR;\n            }\n            goto err;\n        }\n        if (PACKET_remaining(pkt) != 0) {\n            al = SSL_AD_DECODE_ERROR;\n            SSLerr(SSL_F_TLS_PROCESS_KEY_EXCHANGE, SSL_R_EXTRA_DATA_IN_MESSAGE);\n            goto err;\n        }\n    }\n    return MSG_PROCESS_CONTINUE_READING;\n err:\n    if (al != -1)\n        ssl3_send_alert(s, SSL3_AL_FATAL, al);\n    ossl_statem_set_error(s);\n    EVP_MD_CTX_free(md_ctx);\n    return MSG_PROCESS_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        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}']