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


crypto/ec/ec2_mult.c:224:1: Parameter `ctx->stack.depth`
222.    * avoiding conditional branches.
223.    */
224. > static int ec_GF2m_montgomery_point_multiply(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar,
225.   	const EC_POINT *point, BN_CTX *ctx)
226.   	{

crypto/ec/ec2_mult.c:248:2: Call
246.   
247.   	/* Since point_multiply is static we can guarantee that ctx != NULL. */
248.   	BN_CTX_start(ctx);
        ^
249.   	x1 = BN_CTX_get(ctx);
250.   	z1 = BN_CTX_get(ctx);

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

crypto/ec/ec2_mult.c:297:6: Call
295.   
296.   	/* convert out of "projective" coordinates */
297.   	i = gf2m_Mxy(group, point->X, point->Y, x1, z1, x2, z2, ctx);
            ^
298.   	if (i == 0) goto err;
299.   	else if (i == 1) 

crypto/ec/ec2_mult.c:155:1: Parameter `ctx->stack.depth`
  153.    *     2 otherwise
  154.    */
  155. > static int gf2m_Mxy(const EC_GROUP *group, const BIGNUM *x, const BIGNUM *y, BIGNUM *x1, 
  156.   	BIGNUM *z1, BIGNUM *x2, BIGNUM *z2, BN_CTX *ctx)
  157.   	{

crypto/ec/ec2_mult.c:176:2: Call
  174.   		
  175.   	/* Since Mxy is static we can guarantee that ctx != NULL. */
  176.   	BN_CTX_start(ctx);
          ^
  177.   	t3 = BN_CTX_get(ctx);
  178.   	t4 = BN_CTX_get(ctx);

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

crypto/ec/ec2_mult.c:210:2: Call
  208.   
  209.    err:
  210.   	BN_CTX_end(ctx);
          ^
  211.   	return ret;
  212.   	}

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

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

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

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

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

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\tbn_wexpand(x1, bn_get_top(group->field));\n\tbn_wexpand(z1, bn_get_top(group->field));\n\tbn_wexpand(x2, bn_get_top(group->field));\n\tbn_wexpand(z2, bn_get_top(group->field));\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 = bn_get_top(scalar) - 1;\n\tmask = BN_TBIT;\n\tword = bn_get_words(scalar)[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 = bn_get_words(scalar)[i];\n\t\twhile (mask)\n\t\t\t{\n\t\t\tBN_consttime_swap(word & mask, x1, x2, bn_get_top(group->field));\n\t\t\tBN_consttime_swap(word & mask, z1, z2, bn_get_top(group->field));\n\t\t\tif (!gf2m_Madd(group, point->X, x2, z2, x1, z1, ctx)) goto err;\n\t\t\tif (!gf2m_Mdouble(group, x1, z1, ctx)) goto err;\n\t\t\tBN_consttime_swap(word & mask, x1, x2, bn_get_top(group->field));\n\t\t\tBN_consttime_swap(word & mask, z1, z2, bn_get_top(group->field));\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_Mxy(const EC_GROUP *group, const BIGNUM *x, const BIGNUM *y, BIGNUM *x1,\n\tBIGNUM *z1, BIGNUM *x2, BIGNUM *z2, BN_CTX *ctx)\n\t{\n\tBIGNUM *t3, *t4, *t5;\n\tint ret = 0;\n\tif (BN_is_zero(z1))\n\t\t{\n\t\tBN_zero(x2);\n\t\tBN_zero(z2);\n\t\treturn 1;\n\t\t}\n\tif (BN_is_zero(z2))\n\t\t{\n\t\tif (!BN_copy(x2, x)) return 0;\n\t\tif (!BN_GF2m_add(z2, x, y)) return 0;\n\t\treturn 2;\n\t\t}\n\tBN_CTX_start(ctx);\n\tt3 = BN_CTX_get(ctx);\n\tt4 = BN_CTX_get(ctx);\n\tt5 = BN_CTX_get(ctx);\n\tif (t5 == NULL) goto err;\n\tif (!BN_one(t5)) goto err;\n\tif (!group->meth->field_mul(group, t3, z1, z2, ctx)) goto err;\n\tif (!group->meth->field_mul(group, z1, z1, x, ctx)) goto err;\n\tif (!BN_GF2m_add(z1, z1, x1)) goto err;\n\tif (!group->meth->field_mul(group, z2, z2, x, ctx)) goto err;\n\tif (!group->meth->field_mul(group, x1, z2, x1, ctx)) goto err;\n\tif (!BN_GF2m_add(z2, z2, x2)) goto err;\n\tif (!group->meth->field_mul(group, z2, z2, z1, ctx)) goto err;\n\tif (!group->meth->field_sqr(group, t4, x, ctx)) goto err;\n\tif (!BN_GF2m_add(t4, t4, y)) goto err;\n\tif (!group->meth->field_mul(group, t4, t4, t3, ctx)) goto err;\n\tif (!BN_GF2m_add(t4, t4, z2)) goto err;\n\tif (!group->meth->field_mul(group, t3, t3, x, ctx)) goto err;\n\tif (!group->meth->field_div(group, t3, t5, t3, ctx)) goto err;\n\tif (!group->meth->field_mul(group, t4, t3, t4, ctx)) goto err;\n\tif (!group->meth->field_mul(group, x2, x1, t3, ctx)) goto err;\n\tif (!BN_GF2m_add(z2, x2, x)) goto err;\n\tif (!group->meth->field_mul(group, z2, z2, t4, ctx)) goto err;\n\tif (!BN_GF2m_add(z2, z2, y)) goto err;\n\tret = 2;\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}']