crypto/ec/ectest.c:242: error: INTEGER_OVERFLOW_L2
  ([0, +oo] - 1):unsigned32 by call to `BN_mul`.
Showing all 12 steps of the trace


crypto/ec/ectest.c:212:7: Call
210.   	fprintf(stdout, ".");
211.   	fflush(stdout);
212.   	if (!EC_GROUP_precompute_mult(group, ctx)) ABORT;
             ^
213.   	if (!EC_POINT_mul(group, Q, order, NULL, NULL, ctx)) ABORT;
214.   	if (!EC_POINT_is_at_infinity(group, Q)) ABORT;

crypto/ec/ec_lib.c:1077:1: Parameter `ctx->stack.depth`
  1075.   	}
  1076.   
  1077. > int EC_GROUP_precompute_mult(EC_GROUP *group, BN_CTX *ctx)
  1078.   	{
  1079.   	if (group->meth->mul == 0)

crypto/ec/ectest.c:242:8: Call
240.   
241.   		/* n2 = (1 - order) * (1 + order) = 1 - order^2 */
242.   		if (!BN_mul(n2, n1, n2, ctx)) ABORT;
              ^
243.   		if (!EC_POINT_mul(group, Q, NULL, P, n2, ctx)) ABORT;
244.   		if (0 != EC_POINT_cmp(group, Q, P, ctx)) ABORT;

crypto/bn/bn_mul.c:943:1: Parameter `ctx->stack.depth`
  941.   #endif /* BN_RECURSION */
  942.   
  943. > int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
  944.   	{
  945.   	int ret=0;

crypto/bn/bn_mul.c:974:2: Call
  972.   	top=al+bl;
  973.   
  974.   	BN_CTX_start(ctx);
          ^
  975.   	if ((r == a) || (r == b))
  976.   		{

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

crypto/bn/bn_mul.c:1100:2: Call
  1098.   err:
  1099.   	bn_check_top(r);
  1100.   	BN_CTX_end(ctx);
           ^
  1101.   	return(ret);
  1102.   	}

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

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

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

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

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

static unsigned int BN_STACK_pop(BN_STACK *st)
	{
	return st->indexes[--(st->depth)];
	}
['static void group_order_tests(EC_GROUP *group)\n\t{\n\tBIGNUM *n1, *n2, *order;\n\tEC_POINT *P = EC_POINT_new(group);\n\tEC_POINT *Q = EC_POINT_new(group);\n\tBN_CTX *ctx = BN_CTX_new();\n\tint i;\n\tn1 = BN_new(); n2 = BN_new(); order = BN_new();\n\tfprintf(stdout, "verify group order ...");\n\tfflush(stdout);\n\tif (!EC_GROUP_get_order(group, order, ctx)) ABORT;\n\tif (!EC_POINT_mul(group, Q, order, NULL, NULL, ctx)) ABORT;\n\tif (!EC_POINT_is_at_infinity(group, Q)) ABORT;\n\tfprintf(stdout, ".");\n\tfflush(stdout);\n\tif (!EC_GROUP_precompute_mult(group, ctx)) ABORT;\n\tif (!EC_POINT_mul(group, Q, order, NULL, NULL, ctx)) ABORT;\n\tif (!EC_POINT_is_at_infinity(group, Q)) ABORT;\n\tfprintf(stdout, " ok\\n");\n\tfprintf(stdout, "long/negative scalar tests ");\n        for (i = 1; i <= 2; i++)\n\t\t{\n\t\tconst BIGNUM *scalars[6];\n\t\tconst EC_POINT *points[6];\n\t\tfprintf(stdout, i == 1 ?\n\t\t\t"allowing precomputation ... " :\n\t\t\t"without precomputation ... ");\n\t\tif (!BN_set_word(n1, i)) ABORT;\n\t\tif (!EC_POINT_mul(group, P, n1, NULL, NULL, ctx)) ABORT;\n\t\tif (!BN_one(n1)) ABORT;\n\t\tif (!BN_sub(n1, n1, order)) ABORT;\n\t\tif (!EC_POINT_mul(group, Q, NULL, P, n1, ctx)) ABORT;\n\t\tif (0 != EC_POINT_cmp(group, Q, P, ctx)) ABORT;\n\t\tif (!BN_add(n2, order, BN_value_one())) ABORT;\n\t\tif (!EC_POINT_mul(group, Q, NULL, P, n2, ctx)) ABORT;\n\t\tif (0 != EC_POINT_cmp(group, Q, P, ctx)) ABORT;\n\t\tif (!BN_mul(n2, n1, n2, ctx)) ABORT;\n\t\tif (!EC_POINT_mul(group, Q, NULL, P, n2, ctx)) ABORT;\n\t\tif (0 != EC_POINT_cmp(group, Q, P, ctx)) ABORT;\n\t\tBN_set_negative(n2, 0);\n\t\tif (!EC_POINT_mul(group, Q, NULL, P, n2, ctx)) ABORT;\n\t\tif (!EC_POINT_add(group, Q, Q, P, ctx)) ABORT;\n\t\tif (!EC_POINT_is_at_infinity(group, Q)) ABORT;\n\t\tscalars[0] = n1; points[0] = Q;\n\t\tscalars[1] = n2; points[1] = P;\n\t\tscalars[2] = n1; points[2] = Q;\n\t\tscalars[3] = n2; points[3] = Q;\n\t\tscalars[4] = n1; points[4] = P;\n\t\tscalars[5] = n2; points[5] = Q;\n\t\tif (!EC_POINTs_mul(group, Q, NULL, 5, points, scalars, ctx)) ABORT;\n\t\tif (!EC_POINT_is_at_infinity(group, Q)) ABORT;\n\t\t}\n\tfprintf(stdout, "ok\\n");\n\tEC_POINT_free(P);\n\tEC_POINT_free(Q);\n\tBN_free(n1);\n\tBN_free(n2);\n\tBN_free(order);\n\tBN_CTX_free(ctx);\n\t}', 'int EC_GROUP_precompute_mult(EC_GROUP *group, BN_CTX *ctx)\n\t{\n\tif (group->meth->mul == 0)\n\t\treturn ec_wNAF_precompute_mult(group, ctx);\n\tif (group->meth->precompute_mult != 0)\n\t\treturn group->meth->precompute_mult(group, ctx);\n\telse\n\t\treturn 1;\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#ifdef BN_COUNT\n\tfprintf(stderr,"BN_mul %d * %d\\n",a->top,b->top);\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}', '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}', '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}']