crypto/bn/bn_recp.c:182: error: INTEGER_OVERFLOW_L2
  ([0, +oo] - 1):unsigned32 by call to `BN_mul`.
Showing all 11 steps of the trace


crypto/bn/bn_recp.c:171:15: Call
169.   	/* Nr := round(2^i / N) */
170.   	if (i != recp->shift)
171.   		recp->shift=BN_reciprocal(&(recp->Nr),&(recp->N),i,ctx);
                     ^
172.   	/* BN_reciprocal could have returned -1 for an error */
173.   	if (recp->shift == -1) goto err;

crypto/bn/bn_recp.c:234:2: Call
  232.   err:
  233.   	bn_check_top(r);
  234.   	BN_CTX_end(ctx);
          ^
  235.   	return(ret);
  236.   	}

crypto/bn/bn_ctx.c:272:1: Parameter `ctx->pool.used`
    270.   	}
    271.   
    272. > void BN_CTX_end(BN_CTX *ctx)
    273.   	{
    274.   	CTXDBG_ENTRY("BN_CTX_end", ctx);

crypto/bn/bn_recp.c:182:7: Call
180.        */
181.   	if (!BN_rshift(a,m,recp->num_bits)) goto err;
182.   	if (!BN_mul(b,a,&(recp->Nr),ctx)) goto err;
             ^
183.   	if (!BN_rshift(d,b,i-recp->num_bits)) goto err;
184.   	d->neg=0;

crypto/bn/bn_mul.c:909:1: Parameter `ctx->pool.used`
  907.   #endif /* BN_RECURSION */
  908.   
  909. > int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
  910.   	{
  911.   	int ret=0;

crypto/bn/bn_mul.c:1062:2: Call
  1060.   err:
  1061.   	bn_check_top(r);
  1062.   	BN_CTX_end(ctx);
           ^
  1063.   	return(ret);
  1064.   	}

crypto/bn/bn_ctx.c:272:1: Parameter `ctx->pool.used`
    270.   	}
    271.   
    272. > void BN_CTX_end(BN_CTX *ctx)
    273.   	{
    274.   	CTXDBG_ENTRY("BN_CTX_end", ctx);

crypto/bn/bn_ctx.c:282:4: Call
    280.   		/* Does this stack frame have anything to release? */
    281.   		if(fp < ctx->used)
    282.   			BN_POOL_release(&ctx->pool, ctx->used - fp);
              ^
    283.   		ctx->used = fp;
    284.   		/* Unjam "too_many" in case "get" had failed */

crypto/bn/bn_ctx.c:440:1: <LHS trace>
438.   	}
439.   
440. > static void BN_POOL_release(BN_POOL *p, unsigned int num)
441.   	{
442.   	unsigned int offset = (p->used - 1) % BN_CTX_POOL_SIZE;

crypto/bn/bn_ctx.c:440:1: Parameter `p->used`
      438.   	}
      439.   
      440. > static void BN_POOL_release(BN_POOL *p, unsigned int num)
      441.   	{
      442.   	unsigned int offset = (p->used - 1) % BN_CTX_POOL_SIZE;

crypto/bn/bn_ctx.c:442:2: Binary operation: ([0, +oo] - 1):unsigned32 by call to `BN_mul` 
      440.   static void BN_POOL_release(BN_POOL *p, unsigned int num)
      441.   	{
      442.   	unsigned int offset = (p->used - 1) % BN_CTX_POOL_SIZE;
              ^
      443.   	p->used -= num;
      444.   	while(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)
			{
			offset = BN_CTX_POOL_SIZE - 1;
			p->current = p->current->prev;
			}
		else
			offset--;
		}
	}
['int BN_div_recp(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m,\n\tBN_RECP_CTX *recp, BN_CTX *ctx)\n\t{\n\tint i,j,ret=0;\n\tBIGNUM *a,*b,*d,*r;\n\tBN_CTX_start(ctx);\n\ta=BN_CTX_get(ctx);\n\tb=BN_CTX_get(ctx);\n\tif (dv != NULL)\n\t\td=dv;\n\telse\n\t\td=BN_CTX_get(ctx);\n\tif (rem != NULL)\n\t\tr=rem;\n\telse\n\t\tr=BN_CTX_get(ctx);\n\tif (a == NULL || b == NULL || d == NULL || r == NULL) goto err;\n\tif (BN_ucmp(m,&(recp->N)) < 0)\n\t\t{\n\t\tBN_zero(d);\n\t\tif (!BN_copy(r,m)) return 0;\n\t\tBN_CTX_end(ctx);\n\t\treturn(1);\n\t\t}\n\ti=BN_num_bits(m);\n\tj=recp->num_bits<<1;\n\tif (j>i) i=j;\n\tif (i != recp->shift)\n\t\trecp->shift=BN_reciprocal(&(recp->Nr),&(recp->N),i,ctx);\n\tif (recp->shift == -1) goto err;\n\tif (!BN_rshift(a,m,recp->num_bits)) goto err;\n\tif (!BN_mul(b,a,&(recp->Nr),ctx)) goto err;\n\tif (!BN_rshift(d,b,i-recp->num_bits)) goto err;\n\td->neg=0;\n\tif (!BN_mul(b,&(recp->N),d,ctx)) goto err;\n\tif (!BN_usub(r,m,b)) goto err;\n\tr->neg=0;\n#if 1\n\tj=0;\n\twhile (BN_ucmp(r,&(recp->N)) >= 0)\n\t\t{\n\t\tif (j++ > 2)\n\t\t\t{\n\t\t\tBNerr(BN_F_BN_DIV_RECP,BN_R_BAD_RECIPROCAL);\n\t\t\tgoto err;\n\t\t\t}\n\t\tif (!BN_usub(r,r,&(recp->N))) goto err;\n\t\tif (!BN_add_word(d,1)) goto err;\n\t\t}\n#endif\n\tr->neg=BN_is_zero(r)?0:m->neg;\n\td->neg=m->neg^recp->N.neg;\n\tret=1;\nerr:\n\tBN_CTX_end(ctx);\n\tbn_check_top(dv);\n\tbn_check_top(rem);\n\treturn(ret);\n\t}', 'int BN_reciprocal(BIGNUM *r, const BIGNUM *m, int len, BN_CTX *ctx)\n\t{\n\tint ret= -1;\n\tBIGNUM *t;\n\tBN_CTX_start(ctx);\n\tif((t = BN_CTX_get(ctx)) == NULL) goto err;\n\tif (!BN_set_bit(t,len)) goto err;\n\tif (!BN_div(r,NULL,t,m,ctx)) goto err;\n\tret=len;\nerr:\n\tbn_check_top(r);\n\tBN_CTX_end(ctx);\n\treturn(ret);\n\t}', 'void BN_CTX_end(BN_CTX *ctx)\n\t{\n\tCTXDBG_ENTRY("BN_CTX_end", ctx);\n\tif(ctx->err_stack)\n\t\tctx->err_stack--;\n\telse\n\t\t{\n\t\tunsigned int fp = BN_STACK_pop(&ctx->stack);\n\t\tif(fp < ctx->used)\n\t\t\tBN_POOL_release(&ctx->pool, ctx->used - fp);\n\t\tctx->used = fp;\n\t\tctx->too_many = 0;\n\t\t}\n\tCTXDBG_EXIT(ctx);\n\t}', 'int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)\n\t{\n\tint ret=0;\n\tint top,al,bl;\n\tBIGNUM *rr;\n#if defined(BN_MUL_COMBA) || defined(BN_RECURSION)\n\tint i;\n#endif\n#ifdef BN_RECURSION\n\tBIGNUM *t=NULL;\n\tint j=0,k;\n#endif\n\tbn_check_top(a);\n\tbn_check_top(b);\n\tbn_check_top(r);\n\tal=a->top;\n\tbl=b->top;\n\tif ((al == 0) || (bl == 0))\n\t\t{\n\t\tBN_zero(r);\n\t\treturn(1);\n\t\t}\n\ttop=al+bl;\n\tBN_CTX_start(ctx);\n\tif ((r == a) || (r == b))\n\t\t{\n\t\tif ((rr = BN_CTX_get(ctx)) == NULL) goto err;\n\t\t}\n\telse\n\t\trr = r;\n\trr->neg=a->neg^b->neg;\n#if defined(BN_MUL_COMBA) || defined(BN_RECURSION)\n\ti = al-bl;\n#endif\n#ifdef BN_MUL_COMBA\n\tif (i == 0)\n\t\t{\n# if 0\n\t\tif (al == 4)\n\t\t\t{\n\t\t\tif (bn_wexpand(rr,8) == NULL) goto err;\n\t\t\trr->top=8;\n\t\t\tbn_mul_comba4(rr->d,a->d,b->d);\n\t\t\tgoto end;\n\t\t\t}\n# endif\n\t\tif (al == 8)\n\t\t\t{\n\t\t\tif (bn_wexpand(rr,16) == NULL) goto err;\n\t\t\trr->top=16;\n\t\t\tbn_mul_comba8(rr->d,a->d,b->d);\n\t\t\tgoto end;\n\t\t\t}\n\t\t}\n#endif\n#ifdef BN_RECURSION\n\tif ((al >= BN_MULL_SIZE_NORMAL) && (bl >= BN_MULL_SIZE_NORMAL))\n\t\t{\n\t\tif (i >= -1 && i <= 1)\n\t\t\t{\n\t\t\tif (i >= 0)\n\t\t\t\t{\n\t\t\t\tj = BN_num_bits_word((BN_ULONG)al);\n\t\t\t\t}\n\t\t\tif (i == -1)\n\t\t\t\t{\n\t\t\t\tj = BN_num_bits_word((BN_ULONG)bl);\n\t\t\t\t}\n\t\t\tj = 1<<(j-1);\n\t\t\tassert(j <= al || j <= bl);\n\t\t\tk = j+j;\n\t\t\tt = BN_CTX_get(ctx);\n\t\t\tif (t == NULL)\n\t\t\t\tgoto err;\n\t\t\tif (al > j || bl > j)\n\t\t\t\t{\n\t\t\t\tif (bn_wexpand(t,k*4) == NULL) goto err;\n\t\t\t\tif (bn_wexpand(rr,k*4) == NULL) goto err;\n\t\t\t\tbn_mul_part_recursive(rr->d,a->d,b->d,\n\t\t\t\t\tj,al-j,bl-j,t->d);\n\t\t\t\t}\n\t\t\telse\n\t\t\t\t{\n\t\t\t\tif (bn_wexpand(t,k*2) == NULL) goto err;\n\t\t\t\tif (bn_wexpand(rr,k*2) == NULL) goto err;\n\t\t\t\tbn_mul_recursive(rr->d,a->d,b->d,\n\t\t\t\t\tj,al-j,bl-j,t->d);\n\t\t\t\t}\n\t\t\trr->top=top;\n\t\t\tgoto end;\n\t\t\t}\n#if 0\n\t\tif (i == 1 && !BN_get_flags(b,BN_FLG_STATIC_DATA))\n\t\t\t{\n\t\t\tBIGNUM *tmp_bn = (BIGNUM *)b;\n\t\t\tif (bn_wexpand(tmp_bn,al) == NULL) goto err;\n\t\t\ttmp_bn->d[bl]=0;\n\t\t\tbl++;\n\t\t\ti--;\n\t\t\t}\n\t\telse if (i == -1 && !BN_get_flags(a,BN_FLG_STATIC_DATA))\n\t\t\t{\n\t\t\tBIGNUM *tmp_bn = (BIGNUM *)a;\n\t\t\tif (bn_wexpand(tmp_bn,bl) == NULL) goto err;\n\t\t\ttmp_bn->d[al]=0;\n\t\t\tal++;\n\t\t\ti++;\n\t\t\t}\n\t\tif (i == 0)\n\t\t\t{\n\t\t\tj=BN_num_bits_word((BN_ULONG)al);\n\t\t\tj=1<<(j-1);\n\t\t\tk=j+j;\n\t\t\tt = BN_CTX_get(ctx);\n\t\t\tif (al == j)\n\t\t\t\t{\n\t\t\t\tif (bn_wexpand(t,k*2) == NULL) goto err;\n\t\t\t\tif (bn_wexpand(rr,k*2) == NULL) goto err;\n\t\t\t\tbn_mul_recursive(rr->d,a->d,b->d,al,t->d);\n\t\t\t\t}\n\t\t\telse\n\t\t\t\t{\n\t\t\t\tif (bn_wexpand(t,k*4) == NULL) goto err;\n\t\t\t\tif (bn_wexpand(rr,k*4) == NULL) goto err;\n\t\t\t\tbn_mul_part_recursive(rr->d,a->d,b->d,al-j,j,t->d);\n\t\t\t\t}\n\t\t\trr->top=top;\n\t\t\tgoto end;\n\t\t\t}\n#endif\n\t\t}\n#endif\n\tif (bn_wexpand(rr,top) == NULL) goto err;\n\trr->top=top;\n\tbn_mul_normal(rr->d,a->d,al,b->d,bl);\n#if defined(BN_MUL_COMBA) || defined(BN_RECURSION)\nend:\n#endif\n\tbn_correct_top(rr);\n\tif (r != rr) BN_copy(r,rr);\n\tret=1;\nerr:\n\tbn_check_top(r);\n\tBN_CTX_end(ctx);\n\treturn(ret);\n\t}', 'static void BN_POOL_release(BN_POOL *p, unsigned int num)\n\t{\n\tunsigned int offset = (p->used - 1) % BN_CTX_POOL_SIZE;\n\tp->used -= num;\n\twhile(num--)\n\t\t{\n\t\tbn_check_top(p->current->vals + offset);\n\t\tif(!offset)\n\t\t\t{\n\t\t\toffset = BN_CTX_POOL_SIZE - 1;\n\t\t\tp->current = p->current->prev;\n\t\t\t}\n\t\telse\n\t\t\toffset--;\n\t\t}\n\t}']