crypto/ec/ec2_mult.c:273: error: INTEGER_OVERFLOW_L2
  ([0, +oo] - 1):unsigned32 by call to `gf2m_Madd`.
Showing all 13 steps of the trace


crypto/ec/ec2_mult.c:215:1: Parameter `ctx->stack.depth`
213.    *     GF(2^m) without precomputation" (CHES '99, LNCS 1717).
214.    */
215. > static int ec_GF2m_montgomery_point_multiply(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar,
216.   	const EC_POINT *point, BN_CTX *ctx)
217.   	{

crypto/ec/ec2_mult.c:239:2: Call
237.   
238.   	/* Since point_multiply is static we can guarantee that ctx != NULL. */
239.   	BN_CTX_start(ctx);
        ^
240.   	x1 = BN_CTX_get(ctx);
241.   	z1 = 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/ec/ec2_mult.c:273:10: Call
271.   			if (word & mask)
272.   				{
273.   				if (!gf2m_Madd(group, &point->X, x1, z1, x2, z2, ctx)) goto err;
                ^
274.   				if (!gf2m_Mdouble(group, x2, z2, ctx)) goto err;
275.   				}

crypto/ec/ec2_mult.c:113:1: Parameter `ctx->stack.depth`
  111.    *     GF(2^m) without precomputation" (CHES '99, LNCS 1717).
  112.    */
  113. > static int gf2m_Madd(const EC_GROUP *group, const BIGNUM *x, BIGNUM *x1, BIGNUM *z1, 
  114.   	const BIGNUM *x2, const BIGNUM *z2, BN_CTX *ctx)
  115.   	{

crypto/ec/ec2_mult.c:120:2: Call
  118.   	
  119.   	/* Since Madd is static we can guarantee that ctx != NULL. */
  120.   	BN_CTX_start(ctx);
          ^
  121.   	t1 = BN_CTX_get(ctx);
  122.   	t2 = 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/ec/ec2_mult.c:137:2: Call
  135.   
  136.    err:
  137.   	BN_CTX_end(ctx);
          ^
  138.   	return ret;
  139.   	}

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 `gf2m_Madd` 
      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)];
	}
['static int ec_GF2m_montgomery_point_multiply(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar,\n\tconst EC_POINT *point, BN_CTX *ctx)\n\t{\n\tBIGNUM *x1, *x2, *z1, *z2;\n\tint ret = 0, i;\n\tBN_ULONG mask,word;\n\tif (r == point)\n\t\t{\n\t\tECerr(EC_F_EC_GF2M_MONTGOMERY_POINT_MULTIPLY, EC_R_INVALID_ARGUMENT);\n\t\treturn 0;\n\t\t}\n\tif ((scalar == NULL) || BN_is_zero(scalar) || (point == NULL) ||\n\t\tEC_POINT_is_at_infinity(group, point))\n\t\t{\n\t\treturn EC_POINT_set_to_infinity(group, r);\n\t\t}\n\tif (!point->Z_is_one) return 0;\n\tBN_CTX_start(ctx);\n\tx1 = BN_CTX_get(ctx);\n\tz1 = BN_CTX_get(ctx);\n\tif (z1 == NULL) goto err;\n\tx2 = &r->X;\n\tz2 = &r->Y;\n\tif (!BN_GF2m_mod_arr(x1, &point->X, group->poly)) goto err;\n\tif (!BN_one(z1)) goto err;\n\tif (!group->meth->field_sqr(group, z2, x1, ctx)) goto err;\n\tif (!group->meth->field_sqr(group, x2, z2, ctx)) goto err;\n\tif (!BN_GF2m_add(x2, x2, &group->b)) goto err;\n\ti = scalar->top - 1;\n\tmask = BN_TBIT;\n\tword = scalar->d[i];\n\twhile (!(word & mask)) mask >>= 1;\n\tmask >>= 1;\n\tif (!mask)\n\t\t{\n\t\ti--;\n\t\tmask = BN_TBIT;\n\t\t}\n\tfor (; i >= 0; i--)\n\t\t{\n\t\tword = scalar->d[i];\n\t\twhile (mask)\n\t\t\t{\n\t\t\tif (word & mask)\n\t\t\t\t{\n\t\t\t\tif (!gf2m_Madd(group, &point->X, x1, z1, x2, z2, ctx)) goto err;\n\t\t\t\tif (!gf2m_Mdouble(group, x2, z2, ctx)) goto err;\n\t\t\t\t}\n\t\t\telse\n\t\t\t\t{\n\t\t\t\tif (!gf2m_Madd(group, &point->X, x2, z2, x1, z1, ctx)) goto err;\n\t\t\t\tif (!gf2m_Mdouble(group, x1, z1, ctx)) goto err;\n\t\t\t\t}\n\t\t\tmask >>= 1;\n\t\t\t}\n\t\tmask = BN_TBIT;\n\t\t}\n\ti = gf2m_Mxy(group, &point->X, &point->Y, x1, z1, x2, z2, ctx);\n\tif (i == 0) goto err;\n\telse if (i == 1)\n\t\t{\n\t\tif (!EC_POINT_set_to_infinity(group, r)) goto err;\n\t\t}\n\telse\n\t\t{\n\t\tif (!BN_one(&r->Z)) goto err;\n\t\tr->Z_is_one = 1;\n\t\t}\n\tBN_set_negative(&r->X, 0);\n\tBN_set_negative(&r->Y, 0);\n\tret = 1;\n err:\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}', 'static int gf2m_Madd(const EC_GROUP *group, const BIGNUM *x, BIGNUM *x1, BIGNUM *z1,\n\tconst BIGNUM *x2, const BIGNUM *z2, BN_CTX *ctx)\n\t{\n\tBIGNUM *t1, *t2;\n\tint ret = 0;\n\tBN_CTX_start(ctx);\n\tt1 = BN_CTX_get(ctx);\n\tt2 = BN_CTX_get(ctx);\n\tif (t2 == NULL) goto err;\n\tif (!BN_copy(t1, x)) goto err;\n\tif (!group->meth->field_mul(group, x1, x1, z2, ctx)) goto err;\n\tif (!group->meth->field_mul(group, z1, z1, x2, ctx)) goto err;\n\tif (!group->meth->field_mul(group, t2, x1, z1, ctx)) goto err;\n\tif (!BN_GF2m_add(z1, z1, x1)) goto err;\n\tif (!group->meth->field_sqr(group, z1, z1, ctx)) goto err;\n\tif (!group->meth->field_mul(group, x1, z1, t1, ctx)) goto err;\n\tif (!BN_GF2m_add(x1, x1, t2)) goto err;\n\tret = 1;\n err:\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}']