crypto/bn/bn_mont.c:228: error: INTEGER_OVERFLOW_L2
  ([0, 4294967295] + [0, 1]):unsigned32.
Showing all 7 steps of the trace


crypto/bn/bn_mont.c:226:5: <LHS trace>
224.                   }
225.   #else
226.   		v=bn_mul_add_words(rp,np,nl,(rp[0]*n0)&BN_MASK2);
           ^
227.   #endif
228.   		v = (v+carry+rp[nl])&BN_MASK2;

crypto/bn/bn_mont.c:226:5: Call
224.                   }
225.   #else
226.   		v=bn_mul_add_words(rp,np,nl,(rp[0]*n0)&BN_MASK2);
           ^
227.   #endif
228.   		v = (v+carry+rp[nl])&BN_MASK2;

crypto/bn/bn_asm.c:153:16: Assignment
  151.   
  152.   	assert(num >= 0);
  153.   	if (num <= 0) return((BN_ULONG)0);
                        ^
  154.   
  155.   	bl=LBITS(w);

crypto/bn/bn_mont.c:226:3: Assignment
224.                   }
225.   #else
226.   		v=bn_mul_add_words(rp,np,nl,(rp[0]*n0)&BN_MASK2);
         ^
227.   #endif
228.   		v = (v+carry+rp[nl])&BN_MASK2;

crypto/bn/bn_mont.c:210:7: <RHS trace>
208.   	fprintf(stderr,"word BN_from_montgomery_word %d * %d\n",nl,nl);
209.   #endif
210.   	for (carry=0, i=0; i<nl; i++, rp++)
             ^
211.   		{
212.   #ifdef __TANDEM

crypto/bn/bn_mont.c:210:7: Assignment
208.   	fprintf(stderr,"word BN_from_montgomery_word %d * %d\n",nl,nl);
209.   #endif
210.   	for (carry=0, i=0; i<nl; i++, rp++)
             ^
211.   		{
212.   #ifdef __TANDEM

crypto/bn/bn_mont.c:228:3: Binary operation: ([0, 4294967295] + [0, 1]):unsigned32
226.   		v=bn_mul_add_words(rp,np,nl,(rp[0]*n0)&BN_MASK2);
227.   #endif
228.   		v = (v+carry+rp[nl])&BN_MASK2;
         ^
229.   		carry |= (v != rp[nl]);
230.   		carry &= (v <= rp[nl]);

static int BN_from_montgomery_word(BIGNUM *ret, BIGNUM *r, BN_MONT_CTX *mont)
	{
	BIGNUM *n;
	BN_ULONG *ap,*np,*rp,n0,v,carry;
	int nl,max,i;
	n= &(mont->N);
	nl=n->top;
	if (nl == 0) { ret->top=0; return(1); }
	max=(2*nl);
	if (bn_wexpand(r,max) == NULL) return(0);
	r->neg^=n->neg;
	np=n->d;
	rp=r->d;
#if 1
	for (i=r->top; i<max; i++)
		rp[i]=0;
#else
	memset(&(rp[r->top]),0,(max-r->top)*sizeof(BN_ULONG));
#endif
	r->top=max;
	n0=mont->n0[0];
#ifdef BN_COUNT
	fprintf(stderr,"word BN_from_montgomery_word %d * %d\n",nl,nl);
#endif
	for (carry=0, i=0; i<nl; i++, rp++)
		{
#ifdef __TANDEM
                {
                   long long t1;
                   long long t2;
                   long long t3;
                   t1 = rp[0] * (n0 & 0177777);
                   t2 = 037777600000l;
                   t2 = n0 & t2;
                   t3 = rp[0] & 0177777;
                   t2 = (t3 * t2) & BN_MASK2;
                   t1 = t1 + t2;
                   v=bn_mul_add_words(rp,np,nl,(BN_ULONG) t1);
                }
#else
		v=bn_mul_add_words(rp,np,nl,(rp[0]*n0)&BN_MASK2);
#endif
		v = (v+carry+rp[nl])&BN_MASK2;
		carry |= (v != rp[nl]);
		carry &= (v <= rp[nl]);
		rp[nl]=v;
		}
	if (bn_wexpand(ret,nl) == NULL) return(0);
	ret->top=nl;
	ret->neg=r->neg;
	rp=ret->d;
	ap=&(r->d[nl]);
#define BRANCH_FREE 1
#if BRANCH_FREE
	{
	BN_ULONG *nrp;
	size_t m;
	v=bn_sub_words(rp,ap,np,nl)-carry;
	m=(0-(size_t)v);
	nrp=(BN_ULONG *)(((PTR_SIZE_INT)rp&~m)|((PTR_SIZE_INT)ap&m));
	for (i=0,nl-=4; i<nl; i+=4)
		{
		BN_ULONG t1,t2,t3,t4;
		t1=nrp[i+0];
		t2=nrp[i+1];
		t3=nrp[i+2];	ap[i+0]=0;
		t4=nrp[i+3];	ap[i+1]=0;
		rp[i+0]=t1;	ap[i+2]=0;
		rp[i+1]=t2;	ap[i+3]=0;
		rp[i+2]=t3;
		rp[i+3]=t4;
		}
	for (nl+=4; i<nl; i++)
		rp[i]=nrp[i], ap[i]=0;
	}
#else
	if (bn_sub_words (rp,ap,np,nl)-carry)
		memcpy(rp,ap,nl*sizeof(BN_ULONG));
#endif
	bn_correct_top(r);
	bn_correct_top(ret);
	bn_check_top(ret);
	return(1);
	}
['static int BN_from_montgomery_word(BIGNUM *ret, BIGNUM *r, BN_MONT_CTX *mont)\n\t{\n\tBIGNUM *n;\n\tBN_ULONG *ap,*np,*rp,n0,v,carry;\n\tint nl,max,i;\n\tn= &(mont->N);\n\tnl=n->top;\n\tif (nl == 0) { ret->top=0; return(1); }\n\tmax=(2*nl);\n\tif (bn_wexpand(r,max) == NULL) return(0);\n\tr->neg^=n->neg;\n\tnp=n->d;\n\trp=r->d;\n#if 1\n\tfor (i=r->top; i<max; i++)\n\t\trp[i]=0;\n#else\n\tmemset(&(rp[r->top]),0,(max-r->top)*sizeof(BN_ULONG));\n#endif\n\tr->top=max;\n\tn0=mont->n0[0];\n#ifdef BN_COUNT\n\tfprintf(stderr,"word BN_from_montgomery_word %d * %d\\n",nl,nl);\n#endif\n\tfor (carry=0, i=0; i<nl; i++, rp++)\n\t\t{\n#ifdef __TANDEM\n                {\n                   long long t1;\n                   long long t2;\n                   long long t3;\n                   t1 = rp[0] * (n0 & 0177777);\n                   t2 = 037777600000l;\n                   t2 = n0 & t2;\n                   t3 = rp[0] & 0177777;\n                   t2 = (t3 * t2) & BN_MASK2;\n                   t1 = t1 + t2;\n                   v=bn_mul_add_words(rp,np,nl,(BN_ULONG) t1);\n                }\n#else\n\t\tv=bn_mul_add_words(rp,np,nl,(rp[0]*n0)&BN_MASK2);\n#endif\n\t\tv = (v+carry+rp[nl])&BN_MASK2;\n\t\tcarry |= (v != rp[nl]);\n\t\tcarry &= (v <= rp[nl]);\n\t\trp[nl]=v;\n\t\t}\n\tif (bn_wexpand(ret,nl) == NULL) return(0);\n\tret->top=nl;\n\tret->neg=r->neg;\n\trp=ret->d;\n\tap=&(r->d[nl]);\n#define BRANCH_FREE 1\n#if BRANCH_FREE\n\t{\n\tBN_ULONG *nrp;\n\tsize_t m;\n\tv=bn_sub_words(rp,ap,np,nl)-carry;\n\tm=(0-(size_t)v);\n\tnrp=(BN_ULONG *)(((PTR_SIZE_INT)rp&~m)|((PTR_SIZE_INT)ap&m));\n\tfor (i=0,nl-=4; i<nl; i+=4)\n\t\t{\n\t\tBN_ULONG t1,t2,t3,t4;\n\t\tt1=nrp[i+0];\n\t\tt2=nrp[i+1];\n\t\tt3=nrp[i+2];\tap[i+0]=0;\n\t\tt4=nrp[i+3];\tap[i+1]=0;\n\t\trp[i+0]=t1;\tap[i+2]=0;\n\t\trp[i+1]=t2;\tap[i+3]=0;\n\t\trp[i+2]=t3;\n\t\trp[i+3]=t4;\n\t\t}\n\tfor (nl+=4; i<nl; i++)\n\t\trp[i]=nrp[i], ap[i]=0;\n\t}\n#else\n\tif (bn_sub_words (rp,ap,np,nl)-carry)\n\t\tmemcpy(rp,ap,nl*sizeof(BN_ULONG));\n#endif\n\tbn_correct_top(r);\n\tbn_correct_top(ret);\n\tbn_check_top(ret);\n\treturn(1);\n\t}', 'BN_ULONG bn_mul_add_words(BN_ULONG *rp, const BN_ULONG *ap, int num, BN_ULONG w)\n\t{\n\tBN_ULONG c=0;\n\tBN_ULONG bl,bh;\n\tassert(num >= 0);\n\tif (num <= 0) return((BN_ULONG)0);\n\tbl=LBITS(w);\n\tbh=HBITS(w);\n#ifndef OPENSSL_SMALL_FOOTPRINT\n\twhile (num&~3)\n\t\t{\n\t\tmul_add(rp[0],ap[0],bl,bh,c);\n\t\tmul_add(rp[1],ap[1],bl,bh,c);\n\t\tmul_add(rp[2],ap[2],bl,bh,c);\n\t\tmul_add(rp[3],ap[3],bl,bh,c);\n\t\tap+=4; rp+=4; num-=4;\n\t\t}\n#endif\n\twhile (num)\n\t\t{\n\t\tmul_add(rp[0],ap[0],bl,bh,c);\n\t\tap++; rp++; num--;\n\t\t}\n\treturn(c);\n\t}']