void RAND_DRBG_free(DRBG_CTX *dctx)
{
    if (dctx == NULL)
        return;

    ctr_uninstantiate(dctx);
    CRYPTO_free_ex_data(CRYPTO_EX_INDEX_DRBG, dctx, &dctx->ex_data);

    /* Don't free up default DRBG */
    if (dctx == RAND_DRBG_get_default()) {
        memset(dctx, 0, sizeof(DRBG_CTX));
        dctx->nid = 0;
        dctx->status = DRBG_STATUS_UNINITIALISED;
    } else {
        OPENSSL_cleanse(&dctx->ctr, sizeof(dctx->ctr));
        OPENSSL_free(dctx);
    }
}