static unsigned int BN_STACK_pop(BN_STACK *st)
{
    return st->indexes[--(st->depth)];
}
['int rsa_fips186_4_gen_prob_primes(RSA *rsa, BIGNUM *p1, BIGNUM *p2,\n                                  BIGNUM *Xpout, const BIGNUM *Xp,\n                                  const BIGNUM *Xp1, const BIGNUM *Xp2,\n                                  BIGNUM *q1, BIGNUM *q2, BIGNUM *Xqout,\n                                  const BIGNUM *Xq, const BIGNUM *Xq1,\n                                  const BIGNUM *Xq2, int nbits,\n                                  const BIGNUM *e, BN_CTX *ctx, BN_GENCB *cb)\n{\n    int ret = 0, ok;\n    BIGNUM *Xpo = NULL, *Xqo = NULL, *tmp = NULL;\n    if (nbits < RSA_FIPS1864_MIN_KEYGEN_KEYSIZE) {\n        RSAerr(RSA_F_RSA_FIPS186_4_GEN_PROB_PRIMES, RSA_R_INVALID_KEY_LENGTH);\n        return 0;\n    }\n    if (!rsa_check_public_exponent(e)) {\n        RSAerr(RSA_F_RSA_FIPS186_4_GEN_PROB_PRIMES,\n               RSA_R_PUB_EXPONENT_OUT_OF_RANGE);\n        return 0;\n    }\n    BN_CTX_start(ctx);\n    tmp = BN_CTX_get(ctx);\n    Xpo = (Xpout != NULL) ? Xpout : BN_CTX_get(ctx);\n    Xqo = (Xqout != NULL) ? Xqout : BN_CTX_get(ctx);\n    if (tmp == NULL || Xpo == NULL || Xqo == NULL)\n        goto err;\n    if (rsa->p == NULL)\n        rsa->p = BN_secure_new();\n    if (rsa->q == NULL)\n        rsa->q = BN_secure_new();\n    if (rsa->p == NULL || rsa->q == NULL)\n        goto err;\n    if (!bn_rsa_fips186_4_gen_prob_primes(rsa->p, Xpo, p1, p2, Xp, Xp1, Xp2,\n                                          nbits, e, ctx, cb))\n        goto err;\n    for(;;) {\n        if (!bn_rsa_fips186_4_gen_prob_primes(rsa->q, Xqo, q1, q2, Xq, Xq1,\n                                              Xq2, nbits, e, ctx, cb))\n            goto err;\n        ok = rsa_check_pminusq_diff(tmp, Xpo, Xqo, nbits);\n        if (ok < 0)\n            goto err;\n        if (ok == 0)\n            continue;\n        ok = rsa_check_pminusq_diff(tmp, rsa->p, rsa->q, nbits);\n        if (ok < 0)\n            goto err;\n        if (ok == 0)\n            continue;\n        break;\n    }\n    ret = 1;\nerr:\n    if (Xpo != Xpout)\n        BN_clear(Xpo);\n    if (Xqo != Xqout)\n        BN_clear(Xqo);\n    BN_clear(tmp);\n    BN_CTX_end(ctx);\n    return ret;\n}', 'void BN_CTX_start(BN_CTX *ctx)\n{\n    CTXDBG("ENTER BN_CTX_start()", ctx);\n    if (ctx->err_stack || ctx->too_many)\n        ctx->err_stack++;\n    else if (!BN_STACK_push(&ctx->stack, ctx->used)) {\n        BNerr(BN_F_BN_CTX_START, BN_R_TOO_MANY_TEMPORARY_VARIABLES);\n        ctx->err_stack++;\n    }\n    CTXDBG("LEAVE BN_CTX_start()", ctx);\n}', 'void BN_CTX_end(BN_CTX *ctx)\n{\n    if (ctx == NULL)\n        return;\n    CTXDBG("ENTER BN_CTX_end()", ctx);\n    if (ctx->err_stack)\n        ctx->err_stack--;\n    else {\n        unsigned int fp = BN_STACK_pop(&ctx->stack);\n        if (fp < ctx->used)\n            BN_POOL_release(&ctx->pool, ctx->used - fp);\n        ctx->used = fp;\n        ctx->too_many = 0;\n    }\n    CTXDBG("LEAVE BN_CTX_end()", ctx);\n}', 'static unsigned int BN_STACK_pop(BN_STACK *st)\n{\n    return st->indexes[--(st->depth)];\n}']