crypto/bn/bn_gf2m.c:616: error: INTEGER_OVERFLOW_L2
  ([0, +oo] - 1):unsigned32 by call to `BN_GF2m_mod_mul`.
Showing all 15 steps of the trace


crypto/bn/bn_gf2m.c:615:7: Call
613.   	if (xinv == NULL) goto err;
614.   	
615.   	if (!BN_GF2m_mod_inv(xinv, x, p, ctx)) goto err;
             ^
616.   	if (!BN_GF2m_mod_mul(r, y, xinv, p, ctx)) goto err;
617.   	bn_check_top(r);

crypto/bn/bn_gf2m.c:569:4: Call
  567.   
  568.   err:
  569.     	BN_CTX_end(ctx);
            ^
  570.   	return ret;
  571.   	}

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

crypto/bn/bn_gf2m.c:616:7: Call
614.   	
615.   	if (!BN_GF2m_mod_inv(xinv, x, p, ctx)) goto err;
616.   	if (!BN_GF2m_mod_mul(r, y, xinv, p, ctx)) goto err;
             ^
617.   	bn_check_top(r);
618.   	ret = 1;

crypto/bn/bn_gf2m.c:433:1: Parameter `ctx->pool.used`
  431.    * BN_GF2m_mod_mul_arr function.
  432.    */
  433. > int	BN_GF2m_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *p, BN_CTX *ctx)
  434.   	{
  435.   	int ret = 0;

crypto/bn/bn_gf2m.c:448:8: Call
  446.   		goto err;
  447.   		}
  448.   	ret = BN_GF2m_mod_mul_arr(r, a, b, arr, ctx);
                ^
  449.   	bn_check_top(r);
  450.   err:

crypto/bn/bn_gf2m.c:380:1: Parameter `ctx->pool.used`
    378.    * the result in r.  r could be a or b; a could be b.
    379.    */
    380. > int	BN_GF2m_mod_mul_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const int p[], BN_CTX *ctx)
    381.   	{
    382.   	int zlen, i, j, k, ret = 0;

crypto/bn/bn_gf2m.c:395:11: Call
    393.   
    394.   	BN_CTX_start(ctx);
    395.   	if ((s = BN_CTX_get(ctx)) == NULL) goto err;
                     ^
    396.   	
    397.   	zlen = a->top + b->top + 4;

crypto/bn/bn_ctx.c:288:1: Parameter `ctx->pool.used`
      286.   	}
      287.   
      288. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
      289.   	{
      290.   	BIGNUM *ret;

crypto/bn/bn_gf2m.c:422:2: Call
    420.   
    421.   err:
    422.   	BN_CTX_end(ctx);
            ^
    423.   	return ret;
    424.   	}

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

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

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

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

crypto/bn/bn_ctx.c:440:2: Binary operation: ([0, +oo] - 1):unsigned32 by call to `BN_GF2m_mod_mul` 
        438.   static void BN_POOL_release(BN_POOL *p, unsigned int num)
        439.   	{
        440.   	unsigned int offset = (p->used - 1) % BN_CTX_POOL_SIZE;
                ^
        441.   	p->used -= num;
        442.   	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_GF2m_mod_div(BIGNUM *r, const BIGNUM *y, const BIGNUM *x, const BIGNUM *p, BN_CTX *ctx)\n\t{\n\tBIGNUM *xinv = NULL;\n\tint ret = 0;\n\tbn_check_top(y);\n\tbn_check_top(x);\n\tbn_check_top(p);\n\tBN_CTX_start(ctx);\n\txinv = BN_CTX_get(ctx);\n\tif (xinv == NULL) goto err;\n\tif (!BN_GF2m_mod_inv(xinv, x, p, ctx)) goto err;\n\tif (!BN_GF2m_mod_mul(r, y, xinv, p, ctx)) goto err;\n\tbn_check_top(r);\n\tret = 1;\nerr:\n\tBN_CTX_end(ctx);\n\treturn ret;\n\t}', 'int BN_GF2m_mod_inv(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx)\n\t{\n\tBIGNUM *b, *c, *u, *v, *tmp;\n\tint ret = 0;\n\tbn_check_top(a);\n\tbn_check_top(p);\n\tBN_CTX_start(ctx);\n\tb = BN_CTX_get(ctx);\n\tc = BN_CTX_get(ctx);\n\tu = BN_CTX_get(ctx);\n\tv = BN_CTX_get(ctx);\n\tif (v == NULL) goto err;\n\tif (!BN_one(b)) goto err;\n\tif (!BN_GF2m_mod(u, a, p)) goto err;\n\tif (!BN_copy(v, p)) goto err;\n\tif (BN_is_zero(u)) goto err;\n\twhile (1)\n\t\t{\n\t\twhile (!BN_is_odd(u))\n\t\t\t{\n\t\t\tif (!BN_rshift1(u, u)) goto err;\n\t\t\tif (BN_is_odd(b))\n\t\t\t\t{\n\t\t\t\tif (!BN_GF2m_add(b, b, p)) goto err;\n\t\t\t\t}\n\t\t\tif (!BN_rshift1(b, b)) goto err;\n\t\t\t}\n\t\tif (BN_abs_is_word(u, 1)) break;\n\t\tif (BN_num_bits(u) < BN_num_bits(v))\n\t\t\t{\n\t\t\ttmp = u; u = v; v = tmp;\n\t\t\ttmp = b; b = c; c = tmp;\n\t\t\t}\n\t\tif (!BN_GF2m_add(u, u, v)) goto err;\n\t\tif (!BN_GF2m_add(b, b, c)) goto err;\n\t\t}\n\tif (!BN_copy(r, b)) goto err;\n\tbn_check_top(r);\n\tret = 1;\nerr:\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\tBN_GF2m_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *p, BN_CTX *ctx)\n\t{\n\tint ret = 0;\n\tconst int max = BN_num_bits(p) + 1;\n\tint *arr=NULL;\n\tbn_check_top(a);\n\tbn_check_top(b);\n\tbn_check_top(p);\n\tif ((arr = (int *)OPENSSL_malloc(sizeof(int) * max)) == NULL) goto err;\n\tret = BN_GF2m_poly2arr(p, arr, max);\n\tif (!ret || ret > max)\n\t\t{\n\t\tBNerr(BN_F_BN_GF2M_MOD_MUL,BN_R_INVALID_LENGTH);\n\t\tgoto err;\n\t\t}\n\tret = BN_GF2m_mod_mul_arr(r, a, b, arr, ctx);\n\tbn_check_top(r);\nerr:\n\tif (arr) OPENSSL_free(arr);\n\treturn ret;\n\t}', 'int\tBN_GF2m_mod_mul_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const int p[], BN_CTX *ctx)\n\t{\n\tint zlen, i, j, k, ret = 0;\n\tBIGNUM *s;\n\tBN_ULONG x1, x0, y1, y0, zz[4];\n\tbn_check_top(a);\n\tbn_check_top(b);\n\tif (a == b)\n\t\t{\n\t\treturn BN_GF2m_mod_sqr_arr(r, a, p, ctx);\n\t\t}\n\tBN_CTX_start(ctx);\n\tif ((s = BN_CTX_get(ctx)) == NULL) goto err;\n\tzlen = a->top + b->top + 4;\n\tif (!bn_wexpand(s, zlen)) goto err;\n\ts->top = zlen;\n\tfor (i = 0; i < zlen; i++) s->d[i] = 0;\n\tfor (j = 0; j < b->top; j += 2)\n\t\t{\n\t\ty0 = b->d[j];\n\t\ty1 = ((j+1) == b->top) ? 0 : b->d[j+1];\n\t\tfor (i = 0; i < a->top; i += 2)\n\t\t\t{\n\t\t\tx0 = a->d[i];\n\t\t\tx1 = ((i+1) == a->top) ? 0 : a->d[i+1];\n\t\t\tbn_GF2m_mul_2x2(zz, x1, x0, y1, y0);\n\t\t\tfor (k = 0; k < 4; k++) s->d[i+j+k] ^= zz[k];\n\t\t\t}\n\t\t}\n\tbn_correct_top(s);\n\tif (BN_GF2m_mod_arr(r, s, p))\n\t\tret = 1;\n\tbn_check_top(r);\nerr:\n\tBN_CTX_end(ctx);\n\treturn ret;\n\t}', 'BIGNUM *BN_CTX_get(BN_CTX *ctx)\n\t{\n\tBIGNUM *ret;\n\tCTXDBG_ENTRY("BN_CTX_get", ctx);\n\tif(ctx->err_stack || ctx->too_many) return NULL;\n\tif((ret = BN_POOL_get(&ctx->pool)) == NULL)\n\t\t{\n\t\tctx->too_many = 1;\n\t\tBNerr(BN_F_BN_CTX_GET,BN_R_TOO_MANY_TEMPORARY_VARIABLES);\n\t\treturn NULL;\n\t\t}\n\tBN_zero(ret);\n\tctx->used++;\n\tCTXDBG_RET(ctx, ret);\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}']