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


crypto/bn/bn_nist.c:594:10: <RHS trace>
592.   		*ap=c;
593.   		}
594.   	carry = bn_add_words(r_d+(128/BN_BITS2), r_d+(128/BN_BITS2), 
                ^
595.   		t_d, BN_NIST_256_TOP);
596.   	/*

crypto/bn/bn_nist.c:594:10: Call
592.   		*ap=c;
593.   		}
594.   	carry = bn_add_words(r_d+(128/BN_BITS2), r_d+(128/BN_BITS2), 
                ^
595.   		t_d, BN_NIST_256_TOP);
596.   	/*

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:594:2: Assignment
592.   		*ap=c;
593.   		}
594.   	carry = bn_add_words(r_d+(128/BN_BITS2), r_d+(128/BN_BITS2), 
        ^
595.   		t_d, BN_NIST_256_TOP);
596.   	/*

crypto/bn/bn_nist.c:606:2: Binary operation: (0 - [0, 2]):unsigned64
604.   	 */
605.   	mask = 0-(size_t)bn_sub_words(c_d,r_d,_nist_p_384,BN_NIST_384_TOP);
606.   	mask = ~mask | (0-(size_t)carry);
        ^
607.   	res = (BN_ULONG *)(((size_t)c_d&mask) | ((size_t)r_d&~mask));
608.   

int BN_nist_mod_384(BIGNUM *r, const BIGNUM *a, const BIGNUM *field,
	BN_CTX *ctx)
	{
#if BN_BITS2 == 32
	int	i, top = a->top;
	int	carry = 0;
	register BN_ULONG *r_d, *a_d = a->d;
	BN_ULONG t_d[BN_NIST_384_TOP],
	         buf[BN_NIST_384_TOP],
		 c_d[BN_NIST_384_TOP],
		*res;
	size_t	 mask;
	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 (top == BN_NIST_384_TOP)
		return BN_usub(r, a, field);
	if (r != a)
		{
		if (!bn_wexpand(r, BN_NIST_384_TOP))
			return 0;
		r_d = r->d;
		nist_cp_bn(r_d, a_d, BN_NIST_384_TOP);
		}
	else
		r_d = a_d;
	nist_cp_bn_0(buf, a_d + BN_NIST_384_TOP, top - BN_NIST_384_TOP, BN_NIST_384_TOP);
	nist_set_256(t_d, buf, 0, 0, 0, 0, 0, 23-4, 22-4, 21-4);
		{
		register BN_ULONG *ap,t,c;
		ap = t_d;
		c=0;
		for (i = 3; i != 0; --i)
			{
			t= *ap;
			*(ap++)=((t<<1)|c)&BN_MASK2;
			c=(t & BN_TBIT)?1:0;
			}
		*ap=c;
		}
	carry = bn_add_words(r_d+(128/BN_BITS2), r_d+(128/BN_BITS2),
		t_d, BN_NIST_256_TOP);
	mask = 0-(size_t)bn_sub_words(c_d,r_d,_nist_p_384,BN_NIST_384_TOP);
	mask = ~mask | (0-(size_t)carry);
	res = (BN_ULONG *)(((size_t)c_d&mask) | ((size_t)r_d&~mask));
	carry = bn_add_words(r_d, res, buf, BN_NIST_384_TOP);
	mask = 0-(size_t)bn_sub_words(c_d,r_d,_nist_p_384,BN_NIST_384_TOP);
	mask = ~mask | (0-(size_t)carry);
	res = (BN_ULONG *)(((size_t)c_d&mask) | ((size_t)r_d&~mask));
	nist_set_384(t_d,buf,20,19,18,17,16,15,14,13,12,23,22,21);
	carry = bn_add_words(r_d, res, t_d, BN_NIST_384_TOP);
	mask = 0-(size_t)bn_sub_words(c_d,r_d,_nist_p_384,BN_NIST_384_TOP);
	mask = ~mask | (0-(size_t)carry);
	res = (BN_ULONG *)(((size_t)c_d&mask) | ((size_t)r_d&~mask));
	nist_set_384(t_d,buf,19,18,17,16,15,14,13,12,20,0,23,0);
	carry = bn_add_words(r_d, res, t_d, BN_NIST_384_TOP);
	mask = 0-(size_t)bn_sub_words(c_d,r_d,_nist_p_384,BN_NIST_384_TOP);
	mask = ~mask | (0-(size_t)carry);
	res = (BN_ULONG *)(((size_t)c_d&mask) | ((size_t)r_d&~mask));
	nist_set_384(t_d, buf,0,0,0,0,23,22,21,20,0,0,0,0);
	carry = bn_add_words(r_d, res, t_d, BN_NIST_384_TOP);
	mask = 0-(size_t)bn_sub_words(c_d,r_d,_nist_p_384,BN_NIST_384_TOP);
	mask = ~mask | (0-(size_t)carry);
	res = (BN_ULONG *)(((size_t)c_d&mask) | ((size_t)r_d&~mask));
	nist_set_384(t_d,buf,0,0,0,0,0,0,23,22,21,0,0,20);
	carry = bn_add_words(r_d, res, t_d, BN_NIST_384_TOP);
	mask = 0-(size_t)bn_sub_words(c_d,r_d,_nist_p_384,BN_NIST_384_TOP);
	mask = ~mask | (0-(size_t)carry);
	res = (BN_ULONG *)(((size_t)c_d&mask) | ((size_t)r_d&~mask));
	nist_set_384(t_d,buf,22,21,20,19,18,17,16,15,14,13,12,23);
#if BRANCH_FREE
	carry = bn_sub_words(r_d, res, t_d, BN_NIST_384_TOP);
	bn_add_words(c_d,r_d,_nist_p_384,BN_NIST_384_TOP);
	mask = 0-(size_t)carry;
	res = (BN_ULONG *)(((size_t)c_d&mask) | ((size_t)r_d&~mask));
#else
	if (bn_sub_words(r_d, res, t_d, BN_NIST_384_TOP))
		bn_add_words(r_d,r_d,_nist_p_384,BN_NIST_384_TOP);
#endif
	nist_set_384(t_d,buf,0,0,0,0,0,0,0,23,22,21,20,0);
#if BRANCH_FREE
	carry = bn_sub_words(r_d, res, t_d, BN_NIST_384_TOP);
	bn_add_words(c_d,r_d,_nist_p_384,BN_NIST_384_TOP);
	mask = 0-(size_t)carry;
	res = (BN_ULONG *)(((size_t)c_d&mask) | ((size_t)r_d&~mask));
#else
	if (bn_sub_words(r_d, r_d, t_d, BN_NIST_384_TOP))
		bn_add_words(r_d,r_d,_nist_p_384,BN_NIST_384_TOP);
#endif
	nist_set_384(t_d,buf,0,0,0,0,0,0,0,23,23,0,0,0);
#if BRANCH_FREE
	carry = bn_sub_words(r_d, res, t_d, BN_NIST_384_TOP);
	bn_add_words(c_d,r_d,_nist_p_384,BN_NIST_384_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_384_TOP);
#else
	if (bn_sub_words(r_d, r_d, t_d, BN_NIST_384_TOP))
		bn_add_words(r_d,r_d,_nist_p_384,BN_NIST_384_TOP);
#endif
	r->top = BN_NIST_384_TOP;
	bn_correct_top(r);
	return 1;
#else
	return 0;
#endif
	}
['int BN_nist_mod_384(BIGNUM *r, const BIGNUM *a, const BIGNUM *field,\n\tBN_CTX *ctx)\n\t{\n#if BN_BITS2 == 32\n\tint\ti, top = a->top;\n\tint\tcarry = 0;\n\tregister BN_ULONG *r_d, *a_d = a->d;\n\tBN_ULONG t_d[BN_NIST_384_TOP],\n\t         buf[BN_NIST_384_TOP],\n\t\t c_d[BN_NIST_384_TOP],\n\t\t*res;\n\tsize_t\t mask;\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 (top == BN_NIST_384_TOP)\n\t\treturn BN_usub(r, a, field);\n\tif (r != a)\n\t\t{\n\t\tif (!bn_wexpand(r, BN_NIST_384_TOP))\n\t\t\treturn 0;\n\t\tr_d = r->d;\n\t\tnist_cp_bn(r_d, a_d, BN_NIST_384_TOP);\n\t\t}\n\telse\n\t\tr_d = a_d;\n\tnist_cp_bn_0(buf, a_d + BN_NIST_384_TOP, top - BN_NIST_384_TOP, BN_NIST_384_TOP);\n\tnist_set_256(t_d, buf, 0, 0, 0, 0, 0, 23-4, 22-4, 21-4);\n\t\t{\n\t\tregister BN_ULONG *ap,t,c;\n\t\tap = t_d;\n\t\tc=0;\n\t\tfor (i = 3; i != 0; --i)\n\t\t\t{\n\t\t\tt= *ap;\n\t\t\t*(ap++)=((t<<1)|c)&BN_MASK2;\n\t\t\tc=(t & BN_TBIT)?1:0;\n\t\t\t}\n\t\t*ap=c;\n\t\t}\n\tcarry = bn_add_words(r_d+(128/BN_BITS2), r_d+(128/BN_BITS2),\n\t\tt_d, BN_NIST_256_TOP);\n\tmask = 0-(size_t)bn_sub_words(c_d,r_d,_nist_p_384,BN_NIST_384_TOP);\n\tmask = ~mask | (0-(size_t)carry);\n\tres = (BN_ULONG *)(((size_t)c_d&mask) | ((size_t)r_d&~mask));\n\tcarry = bn_add_words(r_d, res, buf, BN_NIST_384_TOP);\n\tmask = 0-(size_t)bn_sub_words(c_d,r_d,_nist_p_384,BN_NIST_384_TOP);\n\tmask = ~mask | (0-(size_t)carry);\n\tres = (BN_ULONG *)(((size_t)c_d&mask) | ((size_t)r_d&~mask));\n\tnist_set_384(t_d,buf,20,19,18,17,16,15,14,13,12,23,22,21);\n\tcarry = bn_add_words(r_d, res, t_d, BN_NIST_384_TOP);\n\tmask = 0-(size_t)bn_sub_words(c_d,r_d,_nist_p_384,BN_NIST_384_TOP);\n\tmask = ~mask | (0-(size_t)carry);\n\tres = (BN_ULONG *)(((size_t)c_d&mask) | ((size_t)r_d&~mask));\n\tnist_set_384(t_d,buf,19,18,17,16,15,14,13,12,20,0,23,0);\n\tcarry = bn_add_words(r_d, res, t_d, BN_NIST_384_TOP);\n\tmask = 0-(size_t)bn_sub_words(c_d,r_d,_nist_p_384,BN_NIST_384_TOP);\n\tmask = ~mask | (0-(size_t)carry);\n\tres = (BN_ULONG *)(((size_t)c_d&mask) | ((size_t)r_d&~mask));\n\tnist_set_384(t_d, buf,0,0,0,0,23,22,21,20,0,0,0,0);\n\tcarry = bn_add_words(r_d, res, t_d, BN_NIST_384_TOP);\n\tmask = 0-(size_t)bn_sub_words(c_d,r_d,_nist_p_384,BN_NIST_384_TOP);\n\tmask = ~mask | (0-(size_t)carry);\n\tres = (BN_ULONG *)(((size_t)c_d&mask) | ((size_t)r_d&~mask));\n\tnist_set_384(t_d,buf,0,0,0,0,0,0,23,22,21,0,0,20);\n\tcarry = bn_add_words(r_d, res, t_d, BN_NIST_384_TOP);\n\tmask = 0-(size_t)bn_sub_words(c_d,r_d,_nist_p_384,BN_NIST_384_TOP);\n\tmask = ~mask | (0-(size_t)carry);\n\tres = (BN_ULONG *)(((size_t)c_d&mask) | ((size_t)r_d&~mask));\n\tnist_set_384(t_d,buf,22,21,20,19,18,17,16,15,14,13,12,23);\n#if BRANCH_FREE\n\tcarry = bn_sub_words(r_d, res, t_d, BN_NIST_384_TOP);\n\tbn_add_words(c_d,r_d,_nist_p_384,BN_NIST_384_TOP);\n\tmask = 0-(size_t)carry;\n\tres = (BN_ULONG *)(((size_t)c_d&mask) | ((size_t)r_d&~mask));\n#else\n\tif (bn_sub_words(r_d, res, t_d, BN_NIST_384_TOP))\n\t\tbn_add_words(r_d,r_d,_nist_p_384,BN_NIST_384_TOP);\n#endif\n\tnist_set_384(t_d,buf,0,0,0,0,0,0,0,23,22,21,20,0);\n#if BRANCH_FREE\n\tcarry = bn_sub_words(r_d, res, t_d, BN_NIST_384_TOP);\n\tbn_add_words(c_d,r_d,_nist_p_384,BN_NIST_384_TOP);\n\tmask = 0-(size_t)carry;\n\tres = (BN_ULONG *)(((size_t)c_d&mask) | ((size_t)r_d&~mask));\n#else\n\tif (bn_sub_words(r_d, r_d, t_d, BN_NIST_384_TOP))\n\t\tbn_add_words(r_d,r_d,_nist_p_384,BN_NIST_384_TOP);\n#endif\n\tnist_set_384(t_d,buf,0,0,0,0,0,0,0,23,23,0,0,0);\n#if BRANCH_FREE\n\tcarry = bn_sub_words(r_d, res, t_d, BN_NIST_384_TOP);\n\tbn_add_words(c_d,r_d,_nist_p_384,BN_NIST_384_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_384_TOP);\n#else\n\tif (bn_sub_words(r_d, r_d, t_d, BN_NIST_384_TOP))\n\t\tbn_add_words(r_d,r_d,_nist_p_384,BN_NIST_384_TOP);\n#endif\n\tr->top = BN_NIST_384_TOP;\n\tbn_correct_top(r);\n\treturn 1;\n#else\n\treturn 0;\n#endif\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}']