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


crypto/rsa/rsa_sp800_56b_check.c:57:14: Call
55.             && (BN_cmp(rsa->iqmp, rsa->p) < 0)
56.             /* (d) 1 = (dP . e) mod (p - 1)*/
57.             && BN_mod_mul(r, rsa->dmp1, rsa->e, p1, ctx)
                   ^
58.             && BN_is_one(r)
59.             /* (e) 1 = (dQ . e) mod (q - 1) */

crypto/bn/bn_mod.c:218:5: Call
  216.       ret = 1;
  217.    err:
  218.       BN_CTX_end(ctx);
             ^
  219.       return ret;
  220.   }

crypto/bn/bn_ctx.c:185:1: Parameter `ctx->pool.used`
    183.   }
    184.   
    185. > void BN_CTX_end(BN_CTX *ctx)
    186.   {
    187.       CTXDBG("ENTER BN_CTX_end()", ctx);

crypto/rsa/rsa_sp800_56b_check.c:67:5: Call
65.       BN_clear(p1);
66.       BN_clear(q1);
67.       BN_CTX_end(ctx);
          ^
68.       return ret;
69.   }

crypto/bn/bn_ctx.c:185:1: Parameter `ctx->pool.used`
  183.   }
  184.   
  185. > void BN_CTX_end(BN_CTX *ctx)
  186.   {
  187.       CTXDBG("ENTER BN_CTX_end()", ctx);

crypto/bn/bn_ctx.c:194:13: Call
  192.           /* Does this stack frame have anything to release? */
  193.           if (fp < ctx->used)
  194.               BN_POOL_release(&ctx->pool, ctx->used - fp);
                     ^
  195.           ctx->used = fp;
  196.           /* Unjam "too_many" in case "get" had failed */

crypto/bn/bn_ctx.c:338:1: <LHS trace>
336.   }
337.   
338. > static void BN_POOL_release(BN_POOL *p, unsigned int num)
339.   {
340.       unsigned int offset = (p->used - 1) % BN_CTX_POOL_SIZE;

crypto/bn/bn_ctx.c:338:1: Parameter `p->used`
    336.   }
    337.   
    338. > static void BN_POOL_release(BN_POOL *p, unsigned int num)
    339.   {
    340.       unsigned int offset = (p->used - 1) % BN_CTX_POOL_SIZE;

crypto/bn/bn_ctx.c:340:5: Binary operation: ([0, +oo] - 1):unsigned32 by call to `BN_CTX_end` 
    338.   static void BN_POOL_release(BN_POOL *p, unsigned int num)
    339.   {
    340.       unsigned int offset = (p->used - 1) % BN_CTX_POOL_SIZE;
               ^
    341.   
    342.       p->used -= num;

static void BN_POOL_release(BN_POOL *p, unsigned int num)
{
    unsigned int offset = (p->used - 1) % BN_CTX_POOL_SIZE;
    p->used -= num;
    while (num--) {
        bn_check_top(p->current->vals + offset);
        if (offset == 0) {
            offset = BN_CTX_POOL_SIZE - 1;
            p->current = p->current->prev;
        } else
            offset--;
    }
}
['int rsa_check_crt_components(const RSA *rsa, BN_CTX *ctx)\n{\n    int ret = 0;\n    BIGNUM *r = NULL, *p1 = NULL, *q1 = NULL;\n    if (rsa->dmp1 == NULL || rsa->dmq1 == NULL || rsa->iqmp == NULL) {\n        if (rsa->dmp1 != NULL || rsa->dmq1 != NULL || rsa->iqmp != NULL)\n            return 0;\n        return 1;\n    }\n    BN_CTX_start(ctx);\n    r = BN_CTX_get(ctx);\n    p1 = BN_CTX_get(ctx);\n    q1 = BN_CTX_get(ctx);\n    ret = (q1 != NULL)\n          && (BN_copy(p1, rsa->p) != NULL)\n          && BN_sub_word(p1, 1)\n          && (BN_copy(q1, rsa->q) != NULL)\n          && BN_sub_word(q1, 1)\n          && (BN_cmp(rsa->dmp1, BN_value_one()) > 0)\n          && (BN_cmp(rsa->dmp1, p1) < 0)\n          && (BN_cmp(rsa->dmq1, BN_value_one()) > 0)\n          && (BN_cmp(rsa->dmq1, q1) < 0)\n          && (BN_cmp(rsa->iqmp, BN_value_one()) > 0)\n          && (BN_cmp(rsa->iqmp, rsa->p) < 0)\n          && BN_mod_mul(r, rsa->dmp1, rsa->e, p1, ctx)\n          && BN_is_one(r)\n          && BN_mod_mul(r, rsa->dmq1, rsa->e, q1, ctx)\n          && BN_is_one(r)\n          && BN_mod_mul(r, rsa->iqmp, rsa->q, rsa->p, ctx)\n          && BN_is_one(r);\n    BN_clear(p1);\n    BN_clear(q1);\n    BN_CTX_end(ctx);\n    return ret;\n}', 'int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m,\n               BN_CTX *ctx)\n{\n    BIGNUM *t;\n    int ret = 0;\n    bn_check_top(a);\n    bn_check_top(b);\n    bn_check_top(m);\n    BN_CTX_start(ctx);\n    if ((t = BN_CTX_get(ctx)) == NULL)\n        goto err;\n    if (a == b) {\n        if (!BN_sqr(t, a, ctx))\n            goto err;\n    } else {\n        if (!BN_mul(t, a, b, ctx))\n            goto err;\n    }\n    if (!BN_nnmod(r, t, m, ctx))\n        goto err;\n    bn_check_top(r);\n    ret = 1;\n err:\n    BN_CTX_end(ctx);\n    return ret;\n}', 'void BN_CTX_end(BN_CTX *ctx)\n{\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 void BN_POOL_release(BN_POOL *p, unsigned int num)\n{\n    unsigned int offset = (p->used - 1) % BN_CTX_POOL_SIZE;\n    p->used -= num;\n    while (num--) {\n        bn_check_top(p->current->vals + offset);\n        if (offset == 0) {\n            offset = BN_CTX_POOL_SIZE - 1;\n            p->current = p->current->prev;\n        } else\n            offset--;\n    }\n}']