crypto/bn/bn_exp.c:148: error: INTEGER_OVERFLOW_L2
  ([0, +oo] - 1):unsigned32 by call to `BN_sqr`.
Showing all 13 steps of the trace


crypto/bn/bn_exp.c:120:1: Parameter `ctx->stack.depth`
118.   
119.   /* this one works - simple but works */
120. > int BN_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx)
121.   	{
122.   	int i,bits,ret=0;

crypto/bn/bn_exp.c:132:2: Call
130.   		}
131.   
132.   	BN_CTX_start(ctx);
        ^
133.   	if ((r == a) || (r == p))
134.   		rr = BN_CTX_get(ctx);

crypto/bn/bn_ctx.c:255:1: Parameter `ctx->stack.depth`
  253.   	}
  254.   
  255. > void BN_CTX_start(BN_CTX *ctx)
  256.   	{
  257.   	CTXDBG_ENTRY("BN_CTX_start", ctx);

crypto/bn/bn_exp.c:148:8: Call
146.   	for (i=1; i<bits; i++)
147.   		{
148.   		if (!BN_sqr(v,v,ctx)) goto err;
              ^
149.   		if (BN_is_bit_set(p,i))
150.   			{

crypto/bn/bn_sqr.c:65:1: Parameter `ctx->stack.depth`
  63.   /* r must not be a */
  64.   /* I've just gone over this and it is now %20 faster on x86 - eay - 27 Jun 96 */
  65. > int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx)
  66.   	{
  67.   	int max,al;

crypto/bn/bn_sqr.c:83:2: Call
  81.   		}
  82.   
  83.   	BN_CTX_start(ctx);
         ^
  84.   	rr=(a != r) ? r : BN_CTX_get(ctx);
  85.   	tmp=BN_CTX_get(ctx);

crypto/bn/bn_ctx.c:255:1: Parameter `ctx->stack.depth`
    253.   	}
    254.   
    255. > void BN_CTX_start(BN_CTX *ctx)
    256.   	{
    257.   	CTXDBG_ENTRY("BN_CTX_start", ctx);

crypto/bn/bn_sqr.c:153:2: Call
  151.   	bn_check_top(rr);
  152.   	bn_check_top(tmp);
  153.   	BN_CTX_end(ctx);
          ^
  154.   	return(ret);
  155.   	}

crypto/bn/bn_ctx.c:270:1: Parameter `ctx->stack.depth`
    268.   	}
    269.   
    270. > void BN_CTX_end(BN_CTX *ctx)
    271.   	{
    272.   	CTXDBG_ENTRY("BN_CTX_end", ctx);

crypto/bn/bn_ctx.c:277:21: Call
    275.   	else
    276.   		{
    277.   		unsigned int fp = BN_STACK_pop(&ctx->stack);
                               ^
    278.   		/* Does this stack frame have anything to release? */
    279.   		if(fp < ctx->used)

crypto/bn/bn_ctx.c:351:1: <LHS trace>
349.   	}
350.   
351. > static unsigned int BN_STACK_pop(BN_STACK *st)
352.   	{
353.   	return st->indexes[--(st->depth)];

crypto/bn/bn_ctx.c:351:1: Parameter `st->depth`
      349.   	}
      350.   
      351. > static unsigned int BN_STACK_pop(BN_STACK *st)
      352.   	{
      353.   	return st->indexes[--(st->depth)];

crypto/bn/bn_ctx.c:353:9: Binary operation: ([0, +oo] - 1):unsigned32 by call to `BN_sqr` 
      351.   static unsigned int BN_STACK_pop(BN_STACK *st)
      352.   	{
      353.   	return st->indexes[--(st->depth)];
                     ^
      354.   	}
      355.   

static unsigned int BN_STACK_pop(BN_STACK *st)
	{
	return st->indexes[--(st->depth)];
	}
['int BN_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx)\n\t{\n\tint i,bits,ret=0;\n\tBIGNUM *v,*rr;\n\tif (BN_get_flags(p, BN_FLG_EXP_CONSTTIME) != 0)\n\t\t{\n\t\tBNerr(BN_F_BN_EXP,ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);\n\t\treturn -1;\n\t\t}\n\tBN_CTX_start(ctx);\n\tif ((r == a) || (r == p))\n\t\trr = BN_CTX_get(ctx);\n\telse\n\t\trr = r;\n\tif ((v = BN_CTX_get(ctx)) == NULL) goto err;\n\tif (BN_copy(v,a) == NULL) goto err;\n\tbits=BN_num_bits(p);\n\tif (BN_is_odd(p))\n\t\t{ if (BN_copy(rr,a) == NULL) goto err; }\n\telse\t{ if (!BN_one(rr)) goto err; }\n\tfor (i=1; i<bits; i++)\n\t\t{\n\t\tif (!BN_sqr(v,v,ctx)) goto err;\n\t\tif (BN_is_bit_set(p,i))\n\t\t\t{\n\t\t\tif (!BN_mul(rr,rr,v,ctx)) goto err;\n\t\t\t}\n\t\t}\n\tret=1;\nerr:\n\tif (r != rr) BN_copy(r,rr);\n\tBN_CTX_end(ctx);\n\tbn_check_top(r);\n\treturn(ret);\n\t}', 'void BN_CTX_start(BN_CTX *ctx)\n\t{\n\tCTXDBG_ENTRY("BN_CTX_start", ctx);\n\tif(ctx->err_stack || ctx->too_many)\n\t\tctx->err_stack++;\n\telse if(!BN_STACK_push(&ctx->stack, ctx->used))\n\t\t{\n\t\tBNerr(BN_F_BN_CTX_START,BN_R_TOO_MANY_TEMPORARY_VARIABLES);\n\t\tctx->err_stack++;\n\t\t}\n\tCTXDBG_EXIT(ctx);\n\t}', 'int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx)\n\t{\n\tint max,al;\n\tint ret = 0;\n\tBIGNUM *tmp,*rr;\n#ifdef BN_COUNT\n\tfprintf(stderr,"BN_sqr %d * %d\\n",a->top,a->top);\n#endif\n\tbn_check_top(a);\n\tal=a->top;\n\tif (al <= 0)\n\t\t{\n\t\tr->top=0;\n\t\treturn 1;\n\t\t}\n\tBN_CTX_start(ctx);\n\trr=(a != r) ? r : BN_CTX_get(ctx);\n\ttmp=BN_CTX_get(ctx);\n\tif (!rr || !tmp) goto err;\n\tmax = 2 * al;\n\tif (bn_wexpand(rr,max) == NULL) goto err;\n\tif (al == 4)\n\t\t{\n#ifndef BN_SQR_COMBA\n\t\tBN_ULONG t[8];\n\t\tbn_sqr_normal(rr->d,a->d,4,t);\n#else\n\t\tbn_sqr_comba4(rr->d,a->d);\n#endif\n\t\t}\n\telse if (al == 8)\n\t\t{\n#ifndef BN_SQR_COMBA\n\t\tBN_ULONG t[16];\n\t\tbn_sqr_normal(rr->d,a->d,8,t);\n#else\n\t\tbn_sqr_comba8(rr->d,a->d);\n#endif\n\t\t}\n\telse\n\t\t{\n#if defined(BN_RECURSION)\n\t\tif (al < BN_SQR_RECURSIVE_SIZE_NORMAL)\n\t\t\t{\n\t\t\tBN_ULONG t[BN_SQR_RECURSIVE_SIZE_NORMAL*2];\n\t\t\tbn_sqr_normal(rr->d,a->d,al,t);\n\t\t\t}\n\t\telse\n\t\t\t{\n\t\t\tint j,k;\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\tif (al == j)\n\t\t\t\t{\n\t\t\t\tif (bn_wexpand(tmp,k*2) == NULL) goto err;\n\t\t\t\tbn_sqr_recursive(rr->d,a->d,al,tmp->d);\n\t\t\t\t}\n\t\t\telse\n\t\t\t\t{\n\t\t\t\tif (bn_wexpand(tmp,max) == NULL) goto err;\n\t\t\t\tbn_sqr_normal(rr->d,a->d,al,tmp->d);\n\t\t\t\t}\n\t\t\t}\n#else\n\t\tif (bn_wexpand(tmp,max) == NULL) goto err;\n\t\tbn_sqr_normal(rr->d,a->d,al,tmp->d);\n#endif\n\t\t}\n\trr->neg=0;\n\tif(a->d[al - 1] == (a->d[al - 1] & BN_MASK2l))\n\t\trr->top = max - 1;\n\telse\n\t\trr->top = max;\n\tif (rr != r) BN_copy(r,rr);\n\tret = 1;\n err:\n\tbn_check_top(rr);\n\tbn_check_top(tmp);\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}', 'static unsigned int BN_STACK_pop(BN_STACK *st)\n\t{\n\treturn st->indexes[--(st->depth)];\n\t}']