crypto/bn/bn_nist.c:513: error: INTEGER_OVERFLOW_L2
  (0 - [0, 2]):unsigned64.
Showing all 5 steps of the trace


crypto/bn/bn_nist.c:512:16: <RHS trace>
510.   		 * to be compared to the modulus and conditionally
511.   		 * adjusted by *subtracting* the latter. */
512.   		carry = (int)bn_add_words(r_d,r_d,_nist_p_224[-carry-1],BN_NIST_224_TOP);
                      ^
513.   		mask = 0-(size_t)carry;
514.   		u.p = ((size_t)bn_sub_words&mask) | ((size_t)bn_add_words&~mask);

crypto/bn/bn_nist.c:512:16: Call
510.   		 * to be compared to the modulus and conditionally
511.   		 * adjusted by *subtracting* the latter. */
512.   		carry = (int)bn_add_words(r_d,r_d,_nist_p_224[-carry-1],BN_NIST_224_TOP);
                      ^
513.   		mask = 0-(size_t)carry;
514.   		u.p = ((size_t)bn_sub_words&mask) | ((size_t)bn_add_words&~mask);

crypto/bn/bn_asm.c:346:14: Assignment
  344.   
  345.   	assert(n >= 0);
  346.   	if (n <= 0) return((BN_ULONG)0);
                      ^
  347.   
  348.   	c=0;

crypto/bn/bn_nist.c:512:3: Assignment
510.   		 * to be compared to the modulus and conditionally
511.   		 * adjusted by *subtracting* the latter. */
512.   		carry = (int)bn_add_words(r_d,r_d,_nist_p_224[-carry-1],BN_NIST_224_TOP);
         ^
513.   		mask = 0-(size_t)carry;
514.   		u.p = ((size_t)bn_sub_words&mask) | ((size_t)bn_add_words&~mask);

crypto/bn/bn_nist.c:513:3: Binary operation: (0 - [0, 2]):unsigned64
511.   		 * adjusted by *subtracting* the latter. */
512.   		carry = (int)bn_add_words(r_d,r_d,_nist_p_224[-carry-1],BN_NIST_224_TOP);
513.   		mask = 0-(size_t)carry;
         ^
514.   		u.p = ((size_t)bn_sub_words&mask) | ((size_t)bn_add_words&~mask);
515.   		}

int BN_nist_mod_224(BIGNUM *r, const BIGNUM *a, const BIGNUM *field,
	BN_CTX *ctx)
	{
	int	top = a->top, i;
	int	carry;
	BN_ULONG *r_d, *a_d = a->d;
	BN_ULONG t_d[BN_NIST_224_TOP],
	         buf[BN_NIST_224_TOP],
		 c_d[BN_NIST_224_TOP],
		*res;
	size_t   mask;
	union { bn_addsub_f f; size_t p; } u;
	static const BIGNUM _bignum_nist_p_224_sqr = {
		(BN_ULONG *)_nist_p_224_sqr,
		sizeof(_nist_p_224_sqr)/sizeof(_nist_p_224_sqr[0]),
		sizeof(_nist_p_224_sqr)/sizeof(_nist_p_224_sqr[0]),
		0,BN_FLG_STATIC_DATA };
	field = &_bignum_nist_p_224;
 	if (BN_is_negative(a) || BN_ucmp(a,&_bignum_nist_p_224_sqr)>=0)
		return BN_nnmod(r, a, field, ctx);
	i = BN_ucmp(field, a);
	if (i == 0)
		{
		BN_zero(r);
		return 1;
		}
	else if (i > 0)
		return (r == a)? 1 : (BN_copy(r ,a) != NULL);
	if (r != a)
		{
		if (!bn_wexpand(r, BN_NIST_224_TOP))
			return 0;
		r_d = r->d;
		nist_cp_bn(r_d, a_d, BN_NIST_224_TOP);
		}
	else
		r_d = a_d;
#if BN_BITS2==64
	nist_cp_bn_0(t_d, a_d + (BN_NIST_224_TOP-1), top - (BN_NIST_224_TOP-1), BN_NIST_224_TOP);
	nist_set_224(buf, t_d, 14, 13, 12, 11, 10, 9, 8);
	r_d[BN_NIST_224_TOP-1] &= BN_MASK2l;
#else
	nist_cp_bn_0(buf, a_d + BN_NIST_224_TOP, top - BN_NIST_224_TOP, BN_NIST_224_TOP);
#endif
	nist_set_224(t_d, buf, 10, 9, 8, 7, 0, 0, 0);
	carry = (int)bn_add_words(r_d, r_d, t_d, BN_NIST_224_TOP);
	nist_set_224(t_d, buf, 0, 13, 12, 11, 0, 0, 0);
	carry += (int)bn_add_words(r_d, r_d, t_d, BN_NIST_224_TOP);
	nist_set_224(t_d, buf, 13, 12, 11, 10, 9, 8, 7);
	carry -= (int)bn_sub_words(r_d, r_d, t_d, BN_NIST_224_TOP);
	nist_set_224(t_d, buf, 0, 0, 0, 0, 13, 12, 11);
	carry -= (int)bn_sub_words(r_d, r_d, t_d, BN_NIST_224_TOP);
#if BN_BITS2==64
	carry = (int)(r_d[BN_NIST_224_TOP-1]>>32);
#endif
	u.f = bn_sub_words;
	if (carry > 0)
		{
		carry = (int)bn_sub_words(r_d,r_d,_nist_p_224[carry-1],BN_NIST_224_TOP);
#if BN_BITS2==64
		carry=(int)(~(r_d[BN_NIST_224_TOP-1]>>32))&1;
#endif
		}
	else if (carry < 0)
		{
		carry = (int)bn_add_words(r_d,r_d,_nist_p_224[-carry-1],BN_NIST_224_TOP);
		mask = 0-(size_t)carry;
		u.p = ((size_t)bn_sub_words&mask) | ((size_t)bn_add_words&~mask);
		}
	else
		carry = 1;
	mask  = 0-(size_t)(*u.f)(c_d,r_d,_nist_p_224[0],BN_NIST_224_TOP);
	mask &= 0-(size_t)carry;
	res   = (BN_ULONG *)(((size_t)c_d&~mask) | ((size_t)r_d&mask));
	nist_cp_bn(r_d, res, BN_NIST_224_TOP);
	r->top = BN_NIST_224_TOP;
	bn_correct_top(r);
	return 1;
	}
['int BN_nist_mod_224(BIGNUM *r, const BIGNUM *a, const BIGNUM *field,\n\tBN_CTX *ctx)\n\t{\n\tint\ttop = a->top, i;\n\tint\tcarry;\n\tBN_ULONG *r_d, *a_d = a->d;\n\tBN_ULONG t_d[BN_NIST_224_TOP],\n\t         buf[BN_NIST_224_TOP],\n\t\t c_d[BN_NIST_224_TOP],\n\t\t*res;\n\tsize_t   mask;\n\tunion { bn_addsub_f f; size_t p; } u;\n\tstatic const BIGNUM _bignum_nist_p_224_sqr = {\n\t\t(BN_ULONG *)_nist_p_224_sqr,\n\t\tsizeof(_nist_p_224_sqr)/sizeof(_nist_p_224_sqr[0]),\n\t\tsizeof(_nist_p_224_sqr)/sizeof(_nist_p_224_sqr[0]),\n\t\t0,BN_FLG_STATIC_DATA };\n\tfield = &_bignum_nist_p_224;\n \tif (BN_is_negative(a) || BN_ucmp(a,&_bignum_nist_p_224_sqr)>=0)\n\t\treturn BN_nnmod(r, a, field, ctx);\n\ti = BN_ucmp(field, a);\n\tif (i == 0)\n\t\t{\n\t\tBN_zero(r);\n\t\treturn 1;\n\t\t}\n\telse if (i > 0)\n\t\treturn (r == a)? 1 : (BN_copy(r ,a) != NULL);\n\tif (r != a)\n\t\t{\n\t\tif (!bn_wexpand(r, BN_NIST_224_TOP))\n\t\t\treturn 0;\n\t\tr_d = r->d;\n\t\tnist_cp_bn(r_d, a_d, BN_NIST_224_TOP);\n\t\t}\n\telse\n\t\tr_d = a_d;\n#if BN_BITS2==64\n\tnist_cp_bn_0(t_d, a_d + (BN_NIST_224_TOP-1), top - (BN_NIST_224_TOP-1), BN_NIST_224_TOP);\n\tnist_set_224(buf, t_d, 14, 13, 12, 11, 10, 9, 8);\n\tr_d[BN_NIST_224_TOP-1] &= BN_MASK2l;\n#else\n\tnist_cp_bn_0(buf, a_d + BN_NIST_224_TOP, top - BN_NIST_224_TOP, BN_NIST_224_TOP);\n#endif\n\tnist_set_224(t_d, buf, 10, 9, 8, 7, 0, 0, 0);\n\tcarry = (int)bn_add_words(r_d, r_d, t_d, BN_NIST_224_TOP);\n\tnist_set_224(t_d, buf, 0, 13, 12, 11, 0, 0, 0);\n\tcarry += (int)bn_add_words(r_d, r_d, t_d, BN_NIST_224_TOP);\n\tnist_set_224(t_d, buf, 13, 12, 11, 10, 9, 8, 7);\n\tcarry -= (int)bn_sub_words(r_d, r_d, t_d, BN_NIST_224_TOP);\n\tnist_set_224(t_d, buf, 0, 0, 0, 0, 13, 12, 11);\n\tcarry -= (int)bn_sub_words(r_d, r_d, t_d, BN_NIST_224_TOP);\n#if BN_BITS2==64\n\tcarry = (int)(r_d[BN_NIST_224_TOP-1]>>32);\n#endif\n\tu.f = bn_sub_words;\n\tif (carry > 0)\n\t\t{\n\t\tcarry = (int)bn_sub_words(r_d,r_d,_nist_p_224[carry-1],BN_NIST_224_TOP);\n#if BN_BITS2==64\n\t\tcarry=(int)(~(r_d[BN_NIST_224_TOP-1]>>32))&1;\n#endif\n\t\t}\n\telse if (carry < 0)\n\t\t{\n\t\tcarry = (int)bn_add_words(r_d,r_d,_nist_p_224[-carry-1],BN_NIST_224_TOP);\n\t\tmask = 0-(size_t)carry;\n\t\tu.p = ((size_t)bn_sub_words&mask) | ((size_t)bn_add_words&~mask);\n\t\t}\n\telse\n\t\tcarry = 1;\n\tmask  = 0-(size_t)(*u.f)(c_d,r_d,_nist_p_224[0],BN_NIST_224_TOP);\n\tmask &= 0-(size_t)carry;\n\tres   = (BN_ULONG *)(((size_t)c_d&~mask) | ((size_t)r_d&mask));\n\tnist_cp_bn(r_d, res, BN_NIST_224_TOP);\n\tr->top = BN_NIST_224_TOP;\n\tbn_correct_top(r);\n\treturn 1;\n\t}', 'BN_ULONG bn_add_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b, int n)\n        {\n\tBN_ULONG c,l,t;\n\tassert(n >= 0);\n\tif (n <= 0) return((BN_ULONG)0);\n\tc=0;\n#ifndef OPENSSL_SMALL_FOOTPRINT\n\twhile (n&~3)\n\t\t{\n\t\tt=a[0];\n\t\tt=(t+c)&BN_MASK2;\n\t\tc=(t < c);\n\t\tl=(t+b[0])&BN_MASK2;\n\t\tc+=(l < t);\n\t\tr[0]=l;\n\t\tt=a[1];\n\t\tt=(t+c)&BN_MASK2;\n\t\tc=(t < c);\n\t\tl=(t+b[1])&BN_MASK2;\n\t\tc+=(l < t);\n\t\tr[1]=l;\n\t\tt=a[2];\n\t\tt=(t+c)&BN_MASK2;\n\t\tc=(t < c);\n\t\tl=(t+b[2])&BN_MASK2;\n\t\tc+=(l < t);\n\t\tr[2]=l;\n\t\tt=a[3];\n\t\tt=(t+c)&BN_MASK2;\n\t\tc=(t < c);\n\t\tl=(t+b[3])&BN_MASK2;\n\t\tc+=(l < t);\n\t\tr[3]=l;\n\t\ta+=4; b+=4; r+=4; n-=4;\n\t\t}\n#endif\n\twhile(n)\n\t\t{\n\t\tt=a[0];\n\t\tt=(t+c)&BN_MASK2;\n\t\tc=(t < c);\n\t\tl=(t+b[0])&BN_MASK2;\n\t\tc+=(l < t);\n\t\tr[0]=l;\n\t\ta++; b++; r++; n--;\n\t\t}\n\treturn((BN_ULONG)c);\n\t}']