crypto/dsa/dsa_ossl.c:185: error: INTEGER_OVERFLOW_L2
  ([0, +oo] - 1):unsigned32 by call to `BN_mod_mul`.
Showing all 14 steps of the trace


crypto/dsa/dsa_ossl.c:185:7: Call
183.   
184.   	/* Compute  s = inv(k) (m + xr) mod q */
185.   	if (!BN_mod_mul(&xr,dsa->priv_key,r,dsa->q,ctx)) goto err;/* s = xr */
             ^
186.   	if (!BN_add(s, &xr, &m)) goto err;		/* s = m + xr */
187.   	if (BN_cmp(s,dsa->q) > 0)

crypto/bn/bn_mod.c:178:1: Parameter `ctx->stack.depth`
  176.   
  177.   /* slow but works */
  178. > int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m,
  179.   	BN_CTX *ctx)
  180.   	{

crypto/bn/bn_mod.c:188:2: Call
  186.   	bn_check_top(m);
  187.   
  188.   	BN_CTX_start(ctx);
          ^
  189.   	if ((t = BN_CTX_get(ctx)) == NULL) goto err;
  190.   	if (a == b)

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_mod.c:191:10: Call
  189.   	if ((t = BN_CTX_get(ctx)) == NULL) goto err;
  190.   	if (a == b)
  191.   		{ if (!BN_sqr(t,a,ctx)) goto err; }
                  ^
  192.   	else
  193.   		{ if (!BN_mul(t,a,b,ctx)) goto err; }

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_mod_mul` 
        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 DSA_SIG *dsa_do_sign(const unsigned char *dgst, int dlen, DSA *dsa)\n\t{\n\tBIGNUM *kinv=NULL,*r=NULL,*s=NULL;\n\tBIGNUM m;\n\tBIGNUM xr;\n\tBN_CTX *ctx=NULL;\n\tint reason=ERR_R_BN_LIB;\n\tDSA_SIG *ret=NULL;\n\tBN_init(&m);\n\tBN_init(&xr);\n\tif (!dsa->p || !dsa->q || !dsa->g)\n\t\t{\n\t\treason=DSA_R_MISSING_PARAMETERS;\n\t\tgoto err;\n\t\t}\n\ts=BN_new();\n\tif (s == NULL) goto err;\n\tif (dlen > SHA256_DIGEST_LENGTH)\n\t\t{\n\t\treason=DSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE;\n\t\tgoto err;\n\t\t}\n\tctx=BN_CTX_new();\n\tif (ctx == NULL) goto err;\n\tif ((dsa->kinv == NULL) || (dsa->r == NULL))\n\t\t{\n\t\tif (!DSA_sign_setup(dsa,ctx,&kinv,&r)) goto err;\n\t\t}\n\telse\n\t\t{\n\t\tkinv=dsa->kinv;\n\t\tdsa->kinv=NULL;\n\t\tr=dsa->r;\n\t\tdsa->r=NULL;\n\t\t}\n\tif (dlen > BN_num_bytes(dsa->q))\n\t\tdlen = BN_num_bytes(dsa->q);\n\tif (BN_bin2bn(dgst,dlen,&m) == NULL)\n\t\tgoto err;\n\tif (!BN_mod_mul(&xr,dsa->priv_key,r,dsa->q,ctx)) goto err;\n\tif (!BN_add(s, &xr, &m)) goto err;\n\tif (BN_cmp(s,dsa->q) > 0)\n\t\tBN_sub(s,s,dsa->q);\n\tif (!BN_mod_mul(s,s,kinv,dsa->q,ctx)) goto err;\n\tret=DSA_SIG_new();\n\tif (ret == NULL) goto err;\n\tret->r = r;\n\tret->s = s;\nerr:\n\tif (!ret)\n\t\t{\n\t\tDSAerr(DSA_F_DSA_DO_SIGN,reason);\n\t\tBN_free(r);\n\t\tBN_free(s);\n\t\t}\n\tif (ctx != NULL) BN_CTX_free(ctx);\n\tBN_clear_free(&m);\n\tBN_clear_free(&xr);\n\tif (kinv != NULL)\n\t    BN_clear_free(kinv);\n\treturn(ret);\n\t}', 'int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m,\n\tBN_CTX *ctx)\n\t{\n\tBIGNUM *t;\n\tint ret=0;\n\tbn_check_top(a);\n\tbn_check_top(b);\n\tbn_check_top(m);\n\tBN_CTX_start(ctx);\n\tif ((t = BN_CTX_get(ctx)) == NULL) goto err;\n\tif (a == b)\n\t\t{ if (!BN_sqr(t,a,ctx)) goto err; }\n\telse\n\t\t{ if (!BN_mul(t,a,b,ctx)) goto err; }\n\tif (!BN_nnmod(r,t,m,ctx)) goto err;\n\tbn_check_top(r);\n\tret=1;\nerr:\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}', '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}']