add parentheses for explicit operator precedence
This commit is contained in:
		
							parent
							
								
									10cfb95508
								
							
						
					
					
						commit
						99c84acc4c
					
				| @ -32,7 +32,7 @@ int fast_mp_montgomery_reduce (mp_int * x, mp_int * n, mp_digit rho) | ||||
|   olduse = x->used; | ||||
| 
 | ||||
|   /* grow a as required */ | ||||
|   if (x->alloc < n->used + 1) { | ||||
|   if (x->alloc < (n->used + 1)) { | ||||
|     if ((res = mp_grow (x, n->used + 1)) != MP_OKAY) { | ||||
|       return res; | ||||
|     } | ||||
| @ -57,7 +57,7 @@ int fast_mp_montgomery_reduce (mp_int * x, mp_int * n, mp_digit rho) | ||||
|     } | ||||
| 
 | ||||
|     /* zero the high words of W[a->used..m->used*2] */ | ||||
|     for (; ix < n->used * 2 + 1; ix++) { | ||||
|     for (; ix < ((n->used * 2) + 1); ix++) { | ||||
|       *_W++ = 0; | ||||
|     } | ||||
|   } | ||||
| @ -126,7 +126,7 @@ int fast_mp_montgomery_reduce (mp_int * x, mp_int * n, mp_digit rho) | ||||
|     /* alias for next word, where the carry goes */ | ||||
|     _W = W + ++ix; | ||||
| 
 | ||||
|     for (; ix <= n->used * 2 + 1; ix++) { | ||||
|     for (; ix <= ((n->used * 2) + 1); ix++) { | ||||
|       *_W++ += *_W1++ >> ((mp_word) DIGIT_BIT); | ||||
|     } | ||||
| 
 | ||||
| @ -143,7 +143,7 @@ int fast_mp_montgomery_reduce (mp_int * x, mp_int * n, mp_digit rho) | ||||
|     /* alias for shifted double precision result */ | ||||
|     _W = W + n->used; | ||||
| 
 | ||||
|     for (ix = 0; ix < n->used + 1; ix++) { | ||||
|     for (ix = 0; ix < (n->used + 1); ix++) { | ||||
|       *tmpx++ = (mp_digit)(*_W++ & ((mp_word) MP_MASK)); | ||||
|     } | ||||
| 
 | ||||
|  | ||||
| @ -87,7 +87,7 @@ int fast_s_mp_mul_digs (mp_int * a, mp_int * b, mp_int * c, int digs) | ||||
|   { | ||||
|     register mp_digit *tmpc; | ||||
|     tmpc = c->dp; | ||||
|     for (ix = 0; ix < pa+1; ix++) { | ||||
|     for (ix = 0; ix < (pa + 1); ix++) { | ||||
|       /* now extract the previous digit [below the carry] */ | ||||
|       *tmpc++ = W[ix]; | ||||
|     } | ||||
|  | ||||
| @ -29,12 +29,12 @@ mp_2expt (mp_int * a, int b) | ||||
|   mp_zero (a); | ||||
| 
 | ||||
|   /* grow a to accomodate the single bit */ | ||||
|   if ((res = mp_grow (a, b / DIGIT_BIT + 1)) != MP_OKAY) { | ||||
|   if ((res = mp_grow (a, (b / DIGIT_BIT) + 1)) != MP_OKAY) { | ||||
|     return res; | ||||
|   } | ||||
| 
 | ||||
|   /* set the used count of where the bit will go */ | ||||
|   a->used = b / DIGIT_BIT + 1; | ||||
|   a->used = (b / DIGIT_BIT) + 1; | ||||
| 
 | ||||
|   /* put the single bit in its place */ | ||||
|   a->dp[b / DIGIT_BIT] = ((mp_digit)1) << (b % DIGIT_BIT); | ||||
|  | ||||
| @ -23,14 +23,14 @@ mp_add_d (mp_int * a, mp_digit b, mp_int * c) | ||||
|   mp_digit *tmpa, *tmpc, mu; | ||||
| 
 | ||||
|   /* grow c as required */ | ||||
|   if (c->alloc < a->used + 1) { | ||||
|   if (c->alloc < (a->used + 1)) { | ||||
|      if ((res = mp_grow(c, a->used + 1)) != MP_OKAY) { | ||||
|         return res; | ||||
|      } | ||||
|   } | ||||
| 
 | ||||
|   /* if a is negative and |a| >= b, call c = |a| - b */ | ||||
|   if (a->sign == MP_NEG && (a->used > 1 || a->dp[0] >= b)) { | ||||
|   if ((a->sign == MP_NEG) && ((a->used > 1) || (a->dp[0] >= b))) { | ||||
|      /* temporarily fix sign of a */ | ||||
|      a->sign = MP_ZPOS; | ||||
| 
 | ||||
|  | ||||
| @ -28,7 +28,7 @@ mp_clamp (mp_int * a) | ||||
|   /* decrease used while the most significant digit is
 | ||||
|    * zero. | ||||
|    */ | ||||
|   while (a->used > 0 && a->dp[a->used - 1] == 0) { | ||||
|   while ((a->used > 0) && (a->dp[a->used - 1] == 0)) { | ||||
|     --(a->used); | ||||
|   } | ||||
| 
 | ||||
|  | ||||
| @ -31,7 +31,7 @@ int mp_cnt_lsb(mp_int *a) | ||||
|    } | ||||
| 
 | ||||
|    /* scan lower digits until non-zero */ | ||||
|    for (x = 0; x < a->used && a->dp[x] == 0; x++) {} | ||||
|    for (x = 0; (x < a->used) && (a->dp[x] == 0); x++) {} | ||||
|    q = a->dp[x]; | ||||
|    x *= DIGIT_BIT; | ||||
| 
 | ||||
|  | ||||
							
								
								
									
										10
									
								
								bn_mp_div.c
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								bn_mp_div.c
									
									
									
									
									
								
							| @ -71,7 +71,7 @@ int mp_div(mp_int * a, mp_int * b, mp_int * c, mp_int * d) | ||||
| 
 | ||||
|   /* now q == quotient and ta == remainder */ | ||||
|   n  = a->sign; | ||||
|   n2 = (a->sign == b->sign ? MP_ZPOS : MP_NEG); | ||||
|   n2 = (a->sign == b->sign) ? MP_ZPOS : MP_NEG; | ||||
|   if (c != NULL) { | ||||
|      mp_exch(c, &q); | ||||
|      c->sign  = (mp_iszero(c) == MP_YES) ? MP_ZPOS : n2; | ||||
| @ -213,7 +213,7 @@ int mp_div (mp_int * a, mp_int * b, mp_int * c, mp_int * d) | ||||
| 
 | ||||
|       /* find left hand */ | ||||
|       mp_zero (&t1); | ||||
|       t1.dp[0] = (t - 1 < 0) ? 0 : y.dp[t - 1]; | ||||
|       t1.dp[0] = ((t - 1) < 0) ? 0 : y.dp[t - 1]; | ||||
|       t1.dp[1] = y.dp[t]; | ||||
|       t1.used = 2; | ||||
|       if ((res = mp_mul_d (&t1, q.dp[i - t - 1], &t1)) != MP_OKAY) { | ||||
| @ -221,8 +221,8 @@ int mp_div (mp_int * a, mp_int * b, mp_int * c, mp_int * d) | ||||
|       } | ||||
| 
 | ||||
|       /* find right hand */ | ||||
|       t2.dp[0] = (i - 2 < 0) ? 0 : x.dp[i - 2]; | ||||
|       t2.dp[1] = (i - 1 < 0) ? 0 : x.dp[i - 1]; | ||||
|       t2.dp[0] = ((i - 2) < 0) ? 0 : x.dp[i - 2]; | ||||
|       t2.dp[1] = ((i - 1) < 0) ? 0 : x.dp[i - 1]; | ||||
|       t2.dp[2] = x.dp[i]; | ||||
|       t2.used = 3; | ||||
|     } while (mp_cmp_mag(&t1, &t2) == MP_GT); | ||||
| @ -261,7 +261,7 @@ int mp_div (mp_int * a, mp_int * b, mp_int * c, mp_int * d) | ||||
|    */ | ||||
| 
 | ||||
|   /* get sign before writing to c */ | ||||
|   x.sign = x.used == 0 ? MP_ZPOS : a->sign; | ||||
|   x.sign = (x.used == 0) ? MP_ZPOS : a->sign; | ||||
| 
 | ||||
|   if (c != NULL) { | ||||
|     mp_clamp (&q); | ||||
|  | ||||
| @ -47,7 +47,7 @@ int mp_div_d (mp_int * a, mp_digit b, mp_int * c, mp_digit * d) | ||||
|   } | ||||
| 
 | ||||
|   /* quick outs */ | ||||
|   if (b == 1 || mp_iszero(a) == MP_YES) { | ||||
|   if ((b == 1) || (mp_iszero(a) == MP_YES)) { | ||||
|      if (d != NULL) { | ||||
|         *d = 0; | ||||
|      } | ||||
|  | ||||
| @ -40,7 +40,7 @@ mp_dr_reduce (mp_int * x, mp_int * n, mp_digit k) | ||||
|   m = n->used; | ||||
| 
 | ||||
|   /* ensure that "x" has at least 2m digits */ | ||||
|   if (x->alloc < m + m) { | ||||
|   if (x->alloc < (m + m)) { | ||||
|     if ((err = mp_grow (x, m + m)) != MP_OKAY) { | ||||
|       return err; | ||||
|     } | ||||
| @ -62,7 +62,7 @@ top: | ||||
| 
 | ||||
|   /* compute (x mod B**m) + k * [x/B**m] inline and inplace */ | ||||
|   for (i = 0; i < m; i++) { | ||||
|       r         = ((mp_word)*tmpx2++) * ((mp_word)k) + *tmpx1 + mu; | ||||
|       r         = (((mp_word)*tmpx2++) * (mp_word)k) + *tmpx1 + mu; | ||||
|       *tmpx1++  = (mp_digit)(r & MP_MASK); | ||||
|       mu        = (mp_digit)(r >> ((mp_word)DIGIT_BIT)); | ||||
|   } | ||||
|  | ||||
| @ -37,7 +37,7 @@ int mp_export(void* rop, size_t* countp, int order, size_t size, | ||||
| 		} lint; | ||||
| 		lint.i = 0x01020304; | ||||
| 
 | ||||
| 		endian = (lint.c[0] == 4 ? -1 : 1); | ||||
| 		endian = (lint.c[0] == 4) ? -1 : 1; | ||||
| 	} | ||||
| 
 | ||||
| 	odd_nails = (nails % 8); | ||||
| @ -48,14 +48,14 @@ int mp_export(void* rop, size_t* countp, int order, size_t size, | ||||
| 	nail_bytes = nails / 8; | ||||
| 
 | ||||
| 	bits = mp_count_bits(&t); | ||||
| 	count = bits / (size * 8 - nails) + ((bits % (size * 8 - nails) != 0) ? 1 : 0); | ||||
| 	count = (bits / ((size * 8) - nails)) + (((bits % ((size * 8) - nails)) != 0) ? 1 : 0); | ||||
| 
 | ||||
| 	for (i = 0; i < count; ++i) { | ||||
| 		for (j = 0; j < size; ++j) { | ||||
| 			unsigned char* byte = ( | ||||
| 				(unsigned char*)rop +  | ||||
| 				(order == -1 ? i : count - 1 - i) * size +  | ||||
| 				(endian == -1 ? j : size - 1 - j) | ||||
| 				(((order == -1) ? i : (count - 1 - i)) * size) + | ||||
| 				((endian == -1) ? j : (size - 1 - j)) | ||||
| 			); | ||||
| 
 | ||||
| 			if (j >= (size - nail_bytes)) { | ||||
| @ -63,9 +63,9 @@ int mp_export(void* rop, size_t* countp, int order, size_t size, | ||||
| 				continue; | ||||
| 			} | ||||
| 
 | ||||
| 			*byte = (unsigned char)(j == size - nail_bytes - 1 ? (t.dp[0] & odd_nail_mask) : t.dp[0] & 0xFF); | ||||
| 			*byte = (unsigned char)((j == (size - nail_bytes - 1)) ? (t.dp[0] & odd_nail_mask) : (t.dp[0] & 0xFF)); | ||||
| 
 | ||||
| 			if ((result = mp_div_2d(&t, (j == size - nail_bytes - 1 ? 8 - odd_nails : 8), &t, NULL)) != MP_OKAY) { | ||||
| 			if ((result = mp_div_2d(&t, ((j == (size - nail_bytes - 1)) ? (8 - odd_nails) : 8), &t, NULL)) != MP_OKAY) { | ||||
| 				mp_clear(&t); | ||||
| 				return result; | ||||
| 			} | ||||
|  | ||||
| @ -89,7 +89,7 @@ int mp_exptmod (mp_int * G, mp_int * X, mp_int * P, mp_int * Y) | ||||
|      | ||||
|   /* if the modulus is odd or dr != 0 use the montgomery method */ | ||||
| #ifdef BN_MP_EXPTMOD_FAST_C | ||||
|   if (mp_isodd (P) == MP_YES || dr !=  0) { | ||||
|   if ((mp_isodd (P) == MP_YES) || (dr !=  0)) { | ||||
|     return mp_exptmod_fast (G, X, P, Y, dr); | ||||
|   } else { | ||||
| #endif | ||||
|  | ||||
| @ -96,8 +96,8 @@ int mp_exptmod_fast (mp_int * G, mp_int * X, mp_int * P, mp_int * Y, int redmode | ||||
| 
 | ||||
|      /* automatically pick the comba one if available (saves quite a few calls/ifs) */ | ||||
| #ifdef BN_FAST_MP_MONTGOMERY_REDUCE_C | ||||
|      if (((P->used * 2 + 1) < MP_WARRAY) && | ||||
|           P->used < (1 << ((CHAR_BIT * sizeof (mp_word)) - (2 * DIGIT_BIT)))) { | ||||
|      if ((((P->used * 2) + 1) < MP_WARRAY) && | ||||
|           (P->used < (1 << ((CHAR_BIT * sizeof(mp_word)) - (2 * DIGIT_BIT))))) { | ||||
|         redux = fast_mp_montgomery_reduce; | ||||
|      } else  | ||||
| #endif | ||||
| @ -219,12 +219,12 @@ int mp_exptmod_fast (mp_int * G, mp_int * X, mp_int * P, mp_int * Y, int redmode | ||||
|      * in the exponent.  Technically this opt is not required but it | ||||
|      * does lower the # of trivial squaring/reductions used | ||||
|      */ | ||||
|     if (mode == 0 && y == 0) { | ||||
|     if ((mode == 0) && (y == 0)) { | ||||
|       continue; | ||||
|     } | ||||
| 
 | ||||
|     /* if the bit is zero and mode == 1 then we square */ | ||||
|     if (mode == 1 && y == 0) { | ||||
|     if ((mode == 1) && (y == 0)) { | ||||
|       if ((err = mp_sqr (&res, &res)) != MP_OKAY) { | ||||
|         goto LBL_RES; | ||||
|       } | ||||
| @ -266,7 +266,7 @@ int mp_exptmod_fast (mp_int * G, mp_int * X, mp_int * P, mp_int * Y, int redmode | ||||
|   } | ||||
| 
 | ||||
|   /* if bits remain then square/multiply */ | ||||
|   if (mode == 2 && bitcpy > 0) { | ||||
|   if ((mode == 2) && (bitcpy > 0)) { | ||||
|     /* square then multiply if the bit is set */ | ||||
|     for (x = 0; x < bitcpy; x++) { | ||||
|       if ((err = mp_sqr (&res, &res)) != MP_OKAY) { | ||||
|  | ||||
| @ -26,7 +26,7 @@ unsigned long mp_get_int(mp_int * a) | ||||
|   } | ||||
| 
 | ||||
|   /* get number of digits of the lsb we have to read */ | ||||
|   i = MIN(a->used,(int)((sizeof(unsigned long)*CHAR_BIT+DIGIT_BIT-1)/DIGIT_BIT))-1; | ||||
|   i = MIN(a->used,(int)(((sizeof(unsigned long) * CHAR_BIT) + DIGIT_BIT - 1) / DIGIT_BIT)) - 1; | ||||
| 
 | ||||
|   /* get most significant digit of result */ | ||||
|   res = DIGIT(a,i); | ||||
|  | ||||
| @ -26,12 +26,12 @@ unsigned long mp_get_long(mp_int * a) | ||||
|   } | ||||
| 
 | ||||
|   /* get number of digits of the lsb we have to read */ | ||||
|   i = MIN(a->used,(int)((sizeof(unsigned long)*CHAR_BIT+DIGIT_BIT-1)/DIGIT_BIT))-1; | ||||
|   i = MIN(a->used,(int)(((sizeof(unsigned long) * CHAR_BIT) + DIGIT_BIT - 1) / DIGIT_BIT)) - 1; | ||||
| 
 | ||||
|   /* get most significant digit of result */ | ||||
|   res = DIGIT(a,i); | ||||
| 
 | ||||
| #if ULONG_MAX != 0xffffffffuL || DIGIT_BIT < 32 | ||||
| #if (ULONG_MAX != 0xffffffffuL) || (DIGIT_BIT < 32) | ||||
|   while (--i >= 0) { | ||||
|     res = (res << DIGIT_BIT) | DIGIT(a,i); | ||||
|   } | ||||
|  | ||||
| @ -26,7 +26,7 @@ unsigned long long mp_get_long_long (mp_int * a) | ||||
|   } | ||||
| 
 | ||||
|   /* get number of digits of the lsb we have to read */ | ||||
|   i = MIN(a->used,(int)((sizeof(unsigned long long)*CHAR_BIT+DIGIT_BIT-1)/DIGIT_BIT))-1; | ||||
|   i = MIN(a->used,(int)(((sizeof(unsigned long long) * CHAR_BIT) + DIGIT_BIT - 1) / DIGIT_BIT)) - 1; | ||||
| 
 | ||||
|   /* get most significant digit of result */ | ||||
|   res = DIGIT(a,i); | ||||
|  | ||||
| @ -33,7 +33,7 @@ int mp_import(mp_int* rop, size_t count, int order, size_t size, | ||||
| 		} lint; | ||||
| 		lint.i = 0x01020304; | ||||
| 
 | ||||
| 		endian = (lint.c[0] == 4 ? -1 : 1); | ||||
| 		endian = (lint.c[0] == 4) ? -1 : 1; | ||||
| 	} | ||||
| 
 | ||||
| 	odd_nails = (nails % 8); | ||||
| @ -44,19 +44,19 @@ int mp_import(mp_int* rop, size_t count, int order, size_t size, | ||||
| 	nail_bytes = nails / 8; | ||||
| 
 | ||||
| 	for (i = 0; i < count; ++i) { | ||||
| 		for (j = 0; j < size - nail_bytes; ++j) { | ||||
| 		for (j = 0; j < (size - nail_bytes); ++j) { | ||||
| 			unsigned char byte = *( | ||||
| 					(unsigned char*)op +  | ||||
| 					(order == 1 ? i : count - 1 - i) * size +  | ||||
| 					(endian == 1 ? j + nail_bytes : size - 1 - j - nail_bytes) | ||||
| 					(((order == 1) ? i : (count - 1 - i)) * size) + | ||||
| 					((endian == 1) ? (j + nail_bytes) : (size - 1 - j - nail_bytes)) | ||||
| 				); | ||||
| 
 | ||||
| 			if ( | ||||
| 				(result = mp_mul_2d(rop, (j == 0 ? 8 - odd_nails : 8), rop)) != MP_OKAY) { | ||||
| 				(result = mp_mul_2d(rop, ((j == 0) ? (8 - odd_nails) : 8), rop)) != MP_OKAY) { | ||||
| 				return result; | ||||
| 			} | ||||
| 
 | ||||
| 			rop->dp[0] |= (j == 0 ? (byte & odd_nail_mask) : byte); | ||||
| 			rop->dp[0] |= (j == 0) ? (byte & odd_nail_mask) : byte; | ||||
| 			rop->used  += 1; | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| @ -19,7 +19,7 @@ | ||||
| int mp_invmod (mp_int * a, mp_int * b, mp_int * c) | ||||
| { | ||||
|   /* b cannot be negative */ | ||||
|   if (b->sign == MP_NEG || mp_iszero(b) == MP_YES) { | ||||
|   if ((b->sign == MP_NEG) || (mp_iszero(b) == MP_YES)) { | ||||
|     return MP_VAL; | ||||
|   } | ||||
| 
 | ||||
|  | ||||
| @ -22,7 +22,7 @@ int mp_invmod_slow (mp_int * a, mp_int * b, mp_int * c) | ||||
|   int     res; | ||||
| 
 | ||||
|   /* b cannot be negative */ | ||||
|   if (b->sign == MP_NEG || mp_iszero(b) == MP_YES) { | ||||
|   if ((b->sign == MP_NEG) || (mp_iszero(b) == MP_YES)) { | ||||
|     return MP_VAL; | ||||
|   } | ||||
| 
 | ||||
| @ -41,7 +41,7 @@ int mp_invmod_slow (mp_int * a, mp_int * b, mp_int * c) | ||||
|   } | ||||
| 
 | ||||
|   /* 2. [modified] if x,y are both even then return an error! */ | ||||
|   if (mp_iseven (&x) == MP_YES && mp_iseven (&y) == MP_YES) { | ||||
|   if ((mp_iseven (&x) == MP_YES) && (mp_iseven (&y) == MP_YES)) { | ||||
|     res = MP_VAL; | ||||
|     goto LBL_ERR; | ||||
|   } | ||||
| @ -64,7 +64,7 @@ top: | ||||
|       goto LBL_ERR; | ||||
|     } | ||||
|     /* 4.2 if A or B is odd then */ | ||||
|     if (mp_isodd (&A) == MP_YES || mp_isodd (&B) == MP_YES) { | ||||
|     if ((mp_isodd (&A) == MP_YES) || (mp_isodd (&B) == MP_YES)) { | ||||
|       /* A = (A+y)/2, B = (B-x)/2 */ | ||||
|       if ((res = mp_add (&A, &y, &A)) != MP_OKAY) { | ||||
|          goto LBL_ERR; | ||||
| @ -89,7 +89,7 @@ top: | ||||
|       goto LBL_ERR; | ||||
|     } | ||||
|     /* 5.2 if C or D is odd then */ | ||||
|     if (mp_isodd (&C) == MP_YES || mp_isodd (&D) == MP_YES) { | ||||
|     if ((mp_isodd (&C) == MP_YES) || (mp_isodd (&D) == MP_YES)) { | ||||
|       /* C = (C+y)/2, D = (D-x)/2 */ | ||||
|       if ((res = mp_add (&C, &y, &C)) != MP_OKAY) { | ||||
|          goto LBL_ERR; | ||||
|  | ||||
| @ -73,9 +73,9 @@ int mp_jacobi (mp_int * a, mp_int * n, int *c) | ||||
|     /* else set s=1 if p = 1/7 (mod 8) or s=-1 if p = 3/5 (mod 8) */ | ||||
|     residue = n->dp[0] & 7; | ||||
| 
 | ||||
|     if (residue == 1 || residue == 7) { | ||||
|     if ((residue == 1) || (residue == 7)) { | ||||
|       s = 1; | ||||
|     } else if (residue == 3 || residue == 5) { | ||||
|     } else if ((residue == 3) || (residue == 5)) { | ||||
|       s = -1; | ||||
|     } | ||||
|   } | ||||
|  | ||||
| @ -26,7 +26,7 @@ int mp_lshd (mp_int * a, int b) | ||||
|   } | ||||
| 
 | ||||
|   /* grow to fit the new digits */ | ||||
|   if (a->alloc < a->used + b) { | ||||
|   if (a->alloc < (a->used + b)) { | ||||
|      if ((res = mp_grow (a, a->used + b)) != MP_OKAY) { | ||||
|        return res; | ||||
|      } | ||||
|  | ||||
| @ -31,7 +31,7 @@ mp_mod (mp_int * a, mp_int * b, mp_int * c) | ||||
|     return res; | ||||
|   } | ||||
| 
 | ||||
|   if (mp_iszero(&t) != MP_NO || t.sign == b->sign) { | ||||
|   if ((mp_iszero(&t) != MP_NO) || (t.sign == b->sign)) { | ||||
|     res = MP_OKAY; | ||||
|     mp_exch (&t, c); | ||||
|   } else { | ||||
|  | ||||
| @ -39,7 +39,7 @@ mp_mod_2d (mp_int * a, int b, mp_int * c) | ||||
|   } | ||||
| 
 | ||||
|   /* zero digits above the last digit of the modulus */ | ||||
|   for (x = (b / DIGIT_BIT) + ((b % DIGIT_BIT) == 0 ? 0 : 1); x < c->used; x++) { | ||||
|   for (x = (b / DIGIT_BIT) + (((b % DIGIT_BIT) == 0) ? 0 : 1); x < c->used; x++) { | ||||
|     c->dp[x] = 0; | ||||
|   } | ||||
|   /* clear the digit that is not completely outside/inside the modulus */ | ||||
|  | ||||
| @ -29,7 +29,7 @@ int mp_montgomery_calc_normalization (mp_int * a, mp_int * b) | ||||
|   bits = mp_count_bits (b) % DIGIT_BIT; | ||||
| 
 | ||||
|   if (b->used > 1) { | ||||
|      if ((res = mp_2expt (a, (b->used - 1) * DIGIT_BIT + bits - 1)) != MP_OKAY) { | ||||
|      if ((res = mp_2expt (a, ((b->used - 1) * DIGIT_BIT) + bits - 1)) != MP_OKAY) { | ||||
|         return res; | ||||
|      } | ||||
|   } else { | ||||
|  | ||||
| @ -28,10 +28,10 @@ mp_montgomery_reduce (mp_int * x, mp_int * n, mp_digit rho) | ||||
|    * than the available columns [255 per default] since carries | ||||
|    * are fixed up in the inner loop. | ||||
|    */ | ||||
|   digs = n->used * 2 + 1; | ||||
|   digs = (n->used * 2) + 1; | ||||
|   if ((digs < MP_WARRAY) && | ||||
|       n->used < | ||||
|       (1 << ((CHAR_BIT * sizeof (mp_word)) - (2 * DIGIT_BIT)))) { | ||||
|       (n->used < | ||||
|       (1 << ((CHAR_BIT * sizeof(mp_word)) - (2 * DIGIT_BIT))))) { | ||||
|     return fast_mp_montgomery_reduce (x, n, rho); | ||||
|   } | ||||
| 
 | ||||
| @ -52,7 +52,7 @@ mp_montgomery_reduce (mp_int * x, mp_int * n, mp_digit rho) | ||||
|      * following inner loop to reduce the | ||||
|      * input one digit at a time | ||||
|      */ | ||||
|     mu = (mp_digit) (((mp_word)x->dp[ix]) * ((mp_word)rho) & MP_MASK); | ||||
|     mu = (mp_digit) (((mp_word)x->dp[ix] * (mp_word)rho) & MP_MASK); | ||||
| 
 | ||||
|     /* a = a + mu * m * b**i */ | ||||
|     { | ||||
| @ -72,8 +72,8 @@ mp_montgomery_reduce (mp_int * x, mp_int * n, mp_digit rho) | ||||
|       /* Multiply and add in place */ | ||||
|       for (iy = 0; iy < n->used; iy++) { | ||||
|         /* compute product and sum */ | ||||
|         r       = ((mp_word)mu) * ((mp_word)*tmpn++) + | ||||
|                   ((mp_word) u) + ((mp_word) * tmpx); | ||||
|         r       = ((mp_word)mu * (mp_word)*tmpn++) + | ||||
|                    (mp_word) u + (mp_word) *tmpx; | ||||
| 
 | ||||
|         /* get carry */ | ||||
|         u       = (mp_digit)(r >> ((mp_word) DIGIT_BIT)); | ||||
|  | ||||
| @ -36,15 +36,15 @@ mp_montgomery_setup (mp_int * n, mp_digit * rho) | ||||
|   } | ||||
| 
 | ||||
|   x = (((b + 2) & 4) << 1) + b; /* here x*a==1 mod 2**4 */ | ||||
|   x *= 2 - b * x;               /* here x*a==1 mod 2**8 */ | ||||
|   x *= 2 - (b * x);             /* here x*a==1 mod 2**8 */ | ||||
| #if !defined(MP_8BIT) | ||||
|   x *= 2 - b * x;               /* here x*a==1 mod 2**16 */ | ||||
|   x *= 2 - (b * x);             /* here x*a==1 mod 2**16 */ | ||||
| #endif | ||||
| #if defined(MP_64BIT) || !(defined(MP_8BIT) || defined(MP_16BIT)) | ||||
|   x *= 2 - b * x;               /* here x*a==1 mod 2**32 */ | ||||
|   x *= 2 - (b * x);             /* here x*a==1 mod 2**32 */ | ||||
| #endif | ||||
| #ifdef MP_64BIT | ||||
|   x *= 2 - b * x;               /* here x*a==1 mod 2**64 */ | ||||
|   x *= 2 - (b * x);             /* here x*a==1 mod 2**64 */ | ||||
| #endif | ||||
| 
 | ||||
|   /* rho = -1/m mod b */ | ||||
|  | ||||
| @ -44,8 +44,8 @@ int mp_mul (mp_int * a, mp_int * b, mp_int * c) | ||||
| 
 | ||||
| #ifdef BN_FAST_S_MP_MUL_DIGS_C | ||||
|     if ((digs < MP_WARRAY) && | ||||
|         MIN(a->used, b->used) <=  | ||||
|         (1 << ((CHAR_BIT * sizeof (mp_word)) - (2 * DIGIT_BIT)))) { | ||||
|         (MIN(a->used, b->used) <=  | ||||
|          (1 << ((CHAR_BIT * sizeof(mp_word)) - (2 * DIGIT_BIT))))) { | ||||
|       res = fast_s_mp_mul_digs (a, b, c, digs); | ||||
|     } else  | ||||
| #endif | ||||
|  | ||||
| @ -21,7 +21,7 @@ int mp_mul_2(mp_int * a, mp_int * b) | ||||
|   int     x, res, oldused; | ||||
| 
 | ||||
|   /* grow to accomodate result */ | ||||
|   if (b->alloc < a->used + 1) { | ||||
|   if (b->alloc < (a->used + 1)) { | ||||
|     if ((res = mp_grow (b, a->used + 1)) != MP_OKAY) { | ||||
|       return res; | ||||
|     } | ||||
|  | ||||
| @ -28,8 +28,8 @@ int mp_mul_2d (mp_int * a, int b, mp_int * c) | ||||
|      } | ||||
|   } | ||||
| 
 | ||||
|   if (c->alloc < (int)(c->used + b/DIGIT_BIT + 1)) { | ||||
|      if ((res = mp_grow (c, c->used + b / DIGIT_BIT + 1)) != MP_OKAY) { | ||||
|   if (c->alloc < (int)(c->used + (b / DIGIT_BIT) + 1)) { | ||||
|      if ((res = mp_grow (c, c->used + (b / DIGIT_BIT) + 1)) != MP_OKAY) { | ||||
|        return res; | ||||
|      } | ||||
|   } | ||||
|  | ||||
| @ -24,7 +24,7 @@ mp_mul_d (mp_int * a, mp_digit b, mp_int * c) | ||||
|   int      ix, res, olduse; | ||||
| 
 | ||||
|   /* make sure c is big enough to hold a*b */ | ||||
|   if (c->alloc < a->used + 1) { | ||||
|   if (c->alloc < (a->used + 1)) { | ||||
|     if ((res = mp_grow (c, a->used + 1)) != MP_OKAY) { | ||||
|       return res; | ||||
|     } | ||||
| @ -48,7 +48,7 @@ mp_mul_d (mp_int * a, mp_digit b, mp_int * c) | ||||
|   /* compute columns */ | ||||
|   for (ix = 0; ix < a->used; ix++) { | ||||
|     /* compute product and carry sum for this term */ | ||||
|     r       = ((mp_word) u) + ((mp_word)*tmpa++) * ((mp_word)b); | ||||
|     r       = (mp_word)u + ((mp_word)*tmpa++ * (mp_word)b); | ||||
| 
 | ||||
|     /* mask off higher bits to get a single digit */ | ||||
|     *tmpc++ = (mp_digit) (r & ((mp_word) MP_MASK)); | ||||
|  | ||||
| @ -31,7 +31,7 @@ int mp_n_root_ex (mp_int * a, mp_digit b, mp_int * c, int fast) | ||||
|   int     res, neg; | ||||
| 
 | ||||
|   /* input must be positive if b is even */ | ||||
|   if ((b & 1) == 0 && a->sign == MP_NEG) { | ||||
|   if (((b & 1) == 0) && (a->sign == MP_NEG)) { | ||||
|     return MP_VAL; | ||||
|   } | ||||
| 
 | ||||
|  | ||||
| @ -31,7 +31,7 @@ int mp_prime_is_prime (mp_int * a, int t, int *result) | ||||
|   *result = MP_NO; | ||||
| 
 | ||||
|   /* valid value of t? */ | ||||
|   if (t <= 0 || t > PRIME_SIZE) { | ||||
|   if ((t <= 0) || (t > PRIME_SIZE)) { | ||||
|     return MP_VAL; | ||||
|   } | ||||
| 
 | ||||
|  | ||||
| @ -67,10 +67,10 @@ int mp_prime_miller_rabin (mp_int * a, mp_int * b, int *result) | ||||
|   } | ||||
| 
 | ||||
|   /* if y != 1 and y != n1 do */ | ||||
|   if (mp_cmp_d (&y, 1) != MP_EQ && mp_cmp (&y, &n1) != MP_EQ) { | ||||
|   if ((mp_cmp_d (&y, 1) != MP_EQ) && (mp_cmp (&y, &n1) != MP_EQ)) { | ||||
|     j = 1; | ||||
|     /* while j <= s-1 and y != n1 */ | ||||
|     while ((j <= (s - 1)) && mp_cmp (&y, &n1) != MP_EQ) { | ||||
|     while ((j <= (s - 1)) && (mp_cmp (&y, &n1) != MP_EQ)) { | ||||
|       if ((err = mp_sqrmod (&y, a, &y)) != MP_OKAY) { | ||||
|          goto LBL_Y; | ||||
|       } | ||||
|  | ||||
| @ -27,7 +27,7 @@ int mp_prime_next_prime(mp_int *a, int t, int bbs_style) | ||||
|    mp_int   b; | ||||
| 
 | ||||
|    /* ensure t is valid */ | ||||
|    if (t <= 0 || t > PRIME_SIZE) { | ||||
|    if ((t <= 0) || (t > PRIME_SIZE)) { | ||||
|       return MP_VAL; | ||||
|    } | ||||
| 
 | ||||
| @ -129,7 +129,7 @@ int mp_prime_next_prime(mp_int *a, int t, int bbs_style) | ||||
|                 y = 1; | ||||
|              } | ||||
|          } | ||||
|       } while (y == 1 && step < ((((mp_digit)1)<<DIGIT_BIT) - kstep)); | ||||
|       } while ((y == 1) && (step < ((((mp_digit)1) << DIGIT_BIT) - kstep))); | ||||
| 
 | ||||
|       /* add the step */ | ||||
|       if ((err = mp_add_d(a, step, a)) != MP_OKAY) { | ||||
| @ -137,7 +137,7 @@ int mp_prime_next_prime(mp_int *a, int t, int bbs_style) | ||||
|       } | ||||
| 
 | ||||
|       /* if didn't pass sieve and step == MAX then skip test */ | ||||
|       if (y == 1 && step >= ((((mp_digit)1)<<DIGIT_BIT) - kstep)) { | ||||
|       if ((y == 1) && (step >= ((((mp_digit)1) << DIGIT_BIT) - kstep))) { | ||||
|          continue; | ||||
|       } | ||||
| 
 | ||||
|  | ||||
| @ -36,7 +36,7 @@ int mp_prime_random_ex(mp_int *a, int t, int size, int flags, ltm_prime_callback | ||||
|    int res, err, bsize, maskOR_msb_offset; | ||||
| 
 | ||||
|    /* sanity check the input */ | ||||
|    if (size <= 1 || t <= 0) { | ||||
|    if ((size <= 1) || (t <= 0)) { | ||||
|       return MP_VAL; | ||||
|    } | ||||
| 
 | ||||
|  | ||||
| @ -25,7 +25,7 @@ int mp_radix_size (mp_int * a, int radix, int *size) | ||||
|   *size = 0; | ||||
| 
 | ||||
|   /* make sure the radix is in range */ | ||||
|   if (radix < 2 || radix > 64) { | ||||
|   if ((radix < 2) || (radix > 64)) { | ||||
|     return MP_VAL; | ||||
|   } | ||||
| 
 | ||||
| @ -36,7 +36,7 @@ int mp_radix_size (mp_int * a, int radix, int *size) | ||||
| 
 | ||||
|   /* special case for binary */ | ||||
|   if (radix == 2) { | ||||
|     *size = mp_count_bits (a) + (a->sign == MP_NEG ? 1 : 0) + 1; | ||||
|     *size = mp_count_bits (a) + ((a->sign == MP_NEG) ? 1 : 0) + 1; | ||||
|     return MP_OKAY; | ||||
|   } | ||||
| 
 | ||||
|  | ||||
| @ -25,7 +25,7 @@ int mp_read_radix (mp_int * a, const char *str, int radix) | ||||
|   mp_zero(a); | ||||
| 
 | ||||
|   /* make sure the radix is ok */ | ||||
|   if (radix < 2 || radix > 64) { | ||||
|   if ((radix < 2) || (radix > 64)) { | ||||
|     return MP_VAL; | ||||
|   } | ||||
| 
 | ||||
|  | ||||
| @ -36,9 +36,9 @@ mp_sqr (mp_int * a, mp_int * b) | ||||
|   { | ||||
| #ifdef BN_FAST_S_MP_SQR_C | ||||
|     /* can we use the fast comba multiplier? */ | ||||
|     if ((a->used * 2 + 1) < MP_WARRAY &&  | ||||
|          a->used <  | ||||
|          (1 << (sizeof(mp_word) * CHAR_BIT - 2*DIGIT_BIT - 1))) { | ||||
|     if ((((a->used * 2) + 1) < MP_WARRAY) && | ||||
|          (a->used < | ||||
|          (1 << ((sizeof(mp_word) * CHAR_BIT) - (2 * DIGIT_BIT) - 1)))) { | ||||
|       res = fast_s_mp_sqr (a, b); | ||||
|     } else | ||||
| #endif | ||||
|  | ||||
| @ -23,7 +23,7 @@ mp_sub_d (mp_int * a, mp_digit b, mp_int * c) | ||||
|   int       res, ix, oldused; | ||||
| 
 | ||||
|   /* grow c as required */ | ||||
|   if (c->alloc < a->used + 1) { | ||||
|   if (c->alloc < (a->used + 1)) { | ||||
|      if ((res = mp_grow(c, a->used + 1)) != MP_OKAY) { | ||||
|         return res; | ||||
|      } | ||||
| @ -49,7 +49,7 @@ mp_sub_d (mp_int * a, mp_digit b, mp_int * c) | ||||
|   tmpc    = c->dp; | ||||
| 
 | ||||
|   /* if a <= b simply fix the single digit */ | ||||
|   if ((a->used == 1 && a->dp[0] <= b) || a->used == 0) { | ||||
|   if (((a->used == 1) && (a->dp[0] <= b)) || (a->used == 0)) { | ||||
|      if (a->used == 1) { | ||||
|         *tmpc++ = b - *tmpa; | ||||
|      } else { | ||||
| @ -67,13 +67,13 @@ mp_sub_d (mp_int * a, mp_digit b, mp_int * c) | ||||
| 
 | ||||
|      /* subtract first digit */ | ||||
|      *tmpc    = *tmpa++ - b; | ||||
|      mu       = *tmpc >> (sizeof(mp_digit) * CHAR_BIT - 1); | ||||
|      mu       = *tmpc >> ((sizeof(mp_digit) * CHAR_BIT) - 1); | ||||
|      *tmpc++ &= MP_MASK; | ||||
| 
 | ||||
|      /* handle rest of the digits */ | ||||
|      for (ix = 1; ix < a->used; ix++) { | ||||
|         *tmpc    = *tmpa++ - mu; | ||||
|         mu       = *tmpc >> (sizeof(mp_digit) * CHAR_BIT - 1); | ||||
|         mu       = *tmpc >> ((sizeof(mp_digit) * CHAR_BIT) - 1); | ||||
|         *tmpc++ &= MP_MASK; | ||||
|      } | ||||
|   } | ||||
|  | ||||
| @ -24,7 +24,7 @@ int mp_toradix (mp_int * a, char *str, int radix) | ||||
|   char   *_s = str; | ||||
| 
 | ||||
|   /* check range of the radix */ | ||||
|   if (radix < 2 || radix > 64) { | ||||
|   if ((radix < 2) || (radix > 64)) { | ||||
|     return MP_VAL; | ||||
|   } | ||||
| 
 | ||||
|  | ||||
| @ -27,7 +27,7 @@ int mp_toradix_n(mp_int * a, char *str, int radix, int maxlen) | ||||
|   char   *_s = str; | ||||
| 
 | ||||
|   /* check range of the maxlen, radix */ | ||||
|   if (maxlen < 2 || radix < 2 || radix > 64) { | ||||
|   if ((maxlen < 2) || (radix < 2) || (radix > 64)) { | ||||
|     return MP_VAL; | ||||
|   } | ||||
| 
 | ||||
|  | ||||
| @ -19,7 +19,7 @@ | ||||
| int mp_unsigned_bin_size (mp_int * a) | ||||
| { | ||||
|   int     size = mp_count_bits (a); | ||||
|   return (size / 8 + ((size & 7) != 0 ? 1 : 0)); | ||||
|   return (size / 8) + (((size & 7) != 0) ? 1 : 0); | ||||
| } | ||||
| #endif | ||||
| 
 | ||||
|  | ||||
| @ -36,7 +36,7 @@ s_mp_add (mp_int * a, mp_int * b, mp_int * c) | ||||
|   } | ||||
| 
 | ||||
|   /* init result */ | ||||
|   if (c->alloc < max + 1) { | ||||
|   if (c->alloc < (max + 1)) { | ||||
|     if ((res = mp_grow (c, max + 1)) != MP_OKAY) { | ||||
|       return res; | ||||
|     } | ||||
|  | ||||
| @ -164,12 +164,12 @@ int s_mp_exptmod (mp_int * G, mp_int * X, mp_int * P, mp_int * Y, int redmode) | ||||
|      * in the exponent.  Technically this opt is not required but it | ||||
|      * does lower the # of trivial squaring/reductions used | ||||
|      */ | ||||
|     if (mode == 0 && y == 0) { | ||||
|     if ((mode == 0) && (y == 0)) { | ||||
|       continue; | ||||
|     } | ||||
| 
 | ||||
|     /* if the bit is zero and mode == 1 then we square */ | ||||
|     if (mode == 1 && y == 0) { | ||||
|     if ((mode == 1) && (y == 0)) { | ||||
|       if ((err = mp_sqr (&res, &res)) != MP_OKAY) { | ||||
|         goto LBL_RES; | ||||
|       } | ||||
| @ -211,7 +211,7 @@ int s_mp_exptmod (mp_int * G, mp_int * X, mp_int * P, mp_int * Y, int redmode) | ||||
|   } | ||||
| 
 | ||||
|   /* if bits remain then square/multiply */ | ||||
|   if (mode == 2 && bitcpy > 0) { | ||||
|   if ((mode == 2) && (bitcpy > 0)) { | ||||
|     /* square then multiply if the bit is set */ | ||||
|     for (x = 0; x < bitcpy; x++) { | ||||
|       if ((err = mp_sqr (&res, &res)) != MP_OKAY) { | ||||
|  | ||||
| @ -29,8 +29,8 @@ int s_mp_mul_digs (mp_int * a, mp_int * b, mp_int * c, int digs) | ||||
| 
 | ||||
|   /* can we use the fast multiplier? */ | ||||
|   if (((digs) < MP_WARRAY) && | ||||
|       MIN (a->used, b->used) <  | ||||
|           (1 << ((CHAR_BIT * sizeof (mp_word)) - (2 * DIGIT_BIT)))) { | ||||
|       (MIN (a->used, b->used) <  | ||||
|           (1 << ((CHAR_BIT * sizeof(mp_word)) - (2 * DIGIT_BIT))))) { | ||||
|     return fast_s_mp_mul_digs (a, b, c, digs); | ||||
|   } | ||||
| 
 | ||||
| @ -61,9 +61,9 @@ int s_mp_mul_digs (mp_int * a, mp_int * b, mp_int * c, int digs) | ||||
|     /* compute the columns of the output and propagate the carry */ | ||||
|     for (iy = 0; iy < pb; iy++) { | ||||
|       /* compute the column as a mp_word */ | ||||
|       r       = ((mp_word)*tmpt) + | ||||
|                 ((mp_word)tmpx) * ((mp_word)*tmpy++) + | ||||
|                 ((mp_word) u); | ||||
|       r       = (mp_word)*tmpt + | ||||
|                 ((mp_word)tmpx * (mp_word)*tmpy++) + | ||||
|                 (mp_word)u; | ||||
| 
 | ||||
|       /* the new column is the lower part of the result */ | ||||
|       *tmpt++ = (mp_digit) (r & ((mp_word) MP_MASK)); | ||||
| @ -72,7 +72,7 @@ int s_mp_mul_digs (mp_int * a, mp_int * b, mp_int * c, int digs) | ||||
|       u       = (mp_digit) (r >> ((mp_word) DIGIT_BIT)); | ||||
|     } | ||||
|     /* set carry if it is placed below digs */ | ||||
|     if (ix + iy < digs) { | ||||
|     if ((ix + iy) < digs) { | ||||
|       *tmpt = u; | ||||
|     } | ||||
|   } | ||||
|  | ||||
| @ -30,7 +30,7 @@ s_mp_mul_high_digs (mp_int * a, mp_int * b, mp_int * c, int digs) | ||||
|   /* can we use the fast multiplier? */ | ||||
| #ifdef BN_FAST_S_MP_MUL_HIGH_DIGS_C | ||||
|   if (((a->used + b->used + 1) < MP_WARRAY) | ||||
|       && MIN (a->used, b->used) < (1 << ((CHAR_BIT * sizeof (mp_word)) - (2 * DIGIT_BIT)))) { | ||||
|       && (MIN (a->used, b->used) < (1 << ((CHAR_BIT * sizeof(mp_word)) - (2 * DIGIT_BIT))))) { | ||||
|     return fast_s_mp_mul_high_digs (a, b, c, digs); | ||||
|   } | ||||
| #endif | ||||
| @ -57,9 +57,9 @@ s_mp_mul_high_digs (mp_int * a, mp_int * b, mp_int * c, int digs) | ||||
| 
 | ||||
|     for (iy = digs - ix; iy < pb; iy++) { | ||||
|       /* calculate the double precision result */ | ||||
|       r       = ((mp_word)*tmpt) + | ||||
|                 ((mp_word)tmpx) * ((mp_word)*tmpy++) + | ||||
|                 ((mp_word) u); | ||||
|       r       = (mp_word)*tmpt + | ||||
|                 ((mp_word)tmpx * (mp_word)*tmpy++) + | ||||
|                 (mp_word)u; | ||||
| 
 | ||||
|       /* get the lower part */ | ||||
|       *tmpt++ = (mp_digit) (r & ((mp_word) MP_MASK)); | ||||
|  | ||||
| @ -24,18 +24,18 @@ int s_mp_sqr (mp_int * a, mp_int * b) | ||||
|   mp_digit u, tmpx, *tmpt; | ||||
| 
 | ||||
|   pa = a->used; | ||||
|   if ((res = mp_init_size (&t, 2*pa + 1)) != MP_OKAY) { | ||||
|   if ((res = mp_init_size (&t, (2 * pa) + 1)) != MP_OKAY) { | ||||
|     return res; | ||||
|   } | ||||
| 
 | ||||
|   /* default used is maximum possible size */ | ||||
|   t.used = 2*pa + 1; | ||||
|   t.used = (2 * pa) + 1; | ||||
| 
 | ||||
|   for (ix = 0; ix < pa; ix++) { | ||||
|     /* first calculate the digit at 2*ix */ | ||||
|     /* calculate double precision result */ | ||||
|     r = ((mp_word) t.dp[2*ix]) + | ||||
|         ((mp_word)a->dp[ix])*((mp_word)a->dp[ix]); | ||||
|     r = (mp_word)t.dp[2*ix] + | ||||
|         ((mp_word)a->dp[ix] * (mp_word)a->dp[ix]); | ||||
| 
 | ||||
|     /* store lower part in result */ | ||||
|     t.dp[ix+ix] = (mp_digit) (r & ((mp_word) MP_MASK)); | ||||
| @ -47,7 +47,7 @@ int s_mp_sqr (mp_int * a, mp_int * b) | ||||
|     tmpx        = a->dp[ix]; | ||||
| 
 | ||||
|     /* alias for where to store the results */ | ||||
|     tmpt        = t.dp + (2*ix + 1); | ||||
|     tmpt        = t.dp + ((2 * ix) + 1); | ||||
|      | ||||
|     for (iy = ix + 1; iy < pa; iy++) { | ||||
|       /* first calculate the product */ | ||||
|  | ||||
| @ -54,7 +54,7 @@ s_mp_sub (mp_int * a, mp_int * b, mp_int * c) | ||||
|        * if a carry does occur it will propagate all the way to the | ||||
|        * MSB.  As a result a single shift is enough to get the carry | ||||
|        */ | ||||
|       u = *tmpc >> ((mp_digit)(CHAR_BIT * sizeof (mp_digit) - 1)); | ||||
|       u = *tmpc >> ((mp_digit)((CHAR_BIT * sizeof(mp_digit)) - 1)); | ||||
| 
 | ||||
|       /* Clear carry from T[i] */ | ||||
|       *tmpc++ &= MP_MASK; | ||||
| @ -66,7 +66,7 @@ s_mp_sub (mp_int * a, mp_int * b, mp_int * c) | ||||
|       *tmpc = *tmpa++ - u; | ||||
| 
 | ||||
|       /* U = carry bit of T[i] */ | ||||
|       u = *tmpc >> ((mp_digit)(CHAR_BIT * sizeof (mp_digit) - 1)); | ||||
|       u = *tmpc >> ((mp_digit)((CHAR_BIT * sizeof(mp_digit)) - 1)); | ||||
| 
 | ||||
|       /* Clear carry from T[i] */ | ||||
|       *tmpc++ &= MP_MASK; | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user