crypto/rsa/rsa_sp800_56b_gen.c:130: error: INTEGER_OVERFLOW_L2
  ([0, +oo] - 1):unsigned32 by call to `BN_CTX_end`.
Showing all 7 steps of the trace


crypto/rsa/rsa_sp800_56b_gen.c:51:1: Parameter `ctx->stack.depth`
49.    *     (Required for CAVS testing).
50.    */
51. > int rsa_fips186_4_gen_prob_primes(RSA *rsa, BIGNUM *p1, BIGNUM *p2,
52.                                     BIGNUM *Xpout, const BIGNUM *Xp,
53.                                     const BIGNUM *Xp1, const BIGNUM *Xp2,

crypto/rsa/rsa_sp800_56b_gen.c:130:5: Call
128.       BN_clear(tmp);
129.   
130.       BN_CTX_end(ctx);
           ^
131.       return ret;
132.   }

crypto/bn/bn_ctx.c:185:1: Parameter `ctx->stack.depth`
  183.   }
  184.   
  185. > void BN_CTX_end(BN_CTX *ctx)
  186.   {
  187.       if (ctx == NULL)

crypto/bn/bn_ctx.c:193:27: Call
  191.           ctx->err_stack--;
  192.       else {
  193.           unsigned int fp = BN_STACK_pop(&ctx->stack);
                                   ^
  194.           /* Does this stack frame have anything to release? */
  195.           if (fp < ctx->used)

crypto/bn/bn_ctx.c:268:1: <LHS trace>
266.   }
267.   
268. > static unsigned int BN_STACK_pop(BN_STACK *st)
269.   {
270.       return st->indexes[--(st->depth)];

crypto/bn/bn_ctx.c:268:1: Parameter `st->depth`
    266.   }
    267.   
    268. > static unsigned int BN_STACK_pop(BN_STACK *st)
    269.   {
    270.       return st->indexes[--(st->depth)];

crypto/bn/bn_ctx.c:270:12: Binary operation: ([0, +oo] - 1):unsigned32 by call to `BN_CTX_end` 
    268.   static unsigned int BN_STACK_pop(BN_STACK *st)
    269.   {
    270.       return st->indexes[--(st->depth)];
                      ^
    271.   }
    272.   

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        goto err;\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_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}']