commit
						b505db8f48
					
				@ -42,8 +42,8 @@ int fast_mp_montgomery_reduce (mp_int * x, mp_int * n, mp_digit rho)
 | 
				
			|||||||
   * an array of double precision words W[...]
 | 
					   * an array of double precision words W[...]
 | 
				
			||||||
   */
 | 
					   */
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    register mp_word *_W;
 | 
					    mp_word *_W;
 | 
				
			||||||
    register mp_digit *tmpx;
 | 
					    mp_digit *tmpx;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* alias for the W[] array */
 | 
					    /* alias for the W[] array */
 | 
				
			||||||
    _W   = W;
 | 
					    _W   = W;
 | 
				
			||||||
@ -72,7 +72,7 @@ int fast_mp_montgomery_reduce (mp_int * x, mp_int * n, mp_digit rho)
 | 
				
			|||||||
     * by casting the value down to a mp_digit.  Note this requires
 | 
					     * by casting the value down to a mp_digit.  Note this requires
 | 
				
			||||||
     * that W[ix-1] have  the carry cleared (see after the inner loop)
 | 
					     * that W[ix-1] have  the carry cleared (see after the inner loop)
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    register mp_digit mu;
 | 
					    mp_digit mu;
 | 
				
			||||||
    mu = (mp_digit) (((W[ix] & MP_MASK) * rho) & MP_MASK);
 | 
					    mu = (mp_digit) (((W[ix] & MP_MASK) * rho) & MP_MASK);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* a = a + mu * m * b**i
 | 
					    /* a = a + mu * m * b**i
 | 
				
			||||||
@ -90,9 +90,9 @@ int fast_mp_montgomery_reduce (mp_int * x, mp_int * n, mp_digit rho)
 | 
				
			|||||||
     * first m->used words of W[] have the carries fixed
 | 
					     * first m->used words of W[] have the carries fixed
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      register int iy;
 | 
					      int iy;
 | 
				
			||||||
      register mp_digit *tmpn;
 | 
					      mp_digit *tmpn;
 | 
				
			||||||
      register mp_word *_W;
 | 
					      mp_word *_W;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      /* alias for the digits of the modulus */
 | 
					      /* alias for the digits of the modulus */
 | 
				
			||||||
      tmpn = n->dp;
 | 
					      tmpn = n->dp;
 | 
				
			||||||
@ -115,8 +115,8 @@ int fast_mp_montgomery_reduce (mp_int * x, mp_int * n, mp_digit rho)
 | 
				
			|||||||
   * significant digits we zeroed].
 | 
					   * significant digits we zeroed].
 | 
				
			||||||
   */
 | 
					   */
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    register mp_digit *tmpx;
 | 
					    mp_digit *tmpx;
 | 
				
			||||||
    register mp_word *_W, *_W1;
 | 
					    mp_word *_W, *_W1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* nox fix rest of carries */
 | 
					    /* nox fix rest of carries */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -35,7 +35,7 @@ int fast_s_mp_mul_digs (mp_int * a, mp_int * b, mp_int * c, int digs)
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
  int     olduse, res, pa, ix, iz;
 | 
					  int     olduse, res, pa, ix, iz;
 | 
				
			||||||
  mp_digit W[MP_WARRAY];
 | 
					  mp_digit W[MP_WARRAY];
 | 
				
			||||||
  register mp_word  _W;
 | 
					  mp_word  _W;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /* grow the destination as required */
 | 
					  /* grow the destination as required */
 | 
				
			||||||
  if (c->alloc < digs) {
 | 
					  if (c->alloc < digs) {
 | 
				
			||||||
@ -85,7 +85,7 @@ int fast_s_mp_mul_digs (mp_int * a, mp_int * b, mp_int * c, int digs)
 | 
				
			|||||||
  c->used = pa;
 | 
					  c->used = pa;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    register mp_digit *tmpc;
 | 
					    mp_digit *tmpc;
 | 
				
			||||||
    tmpc = c->dp;
 | 
					    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] */
 | 
					      /* now extract the previous digit [below the carry] */
 | 
				
			||||||
 | 
				
			|||||||
@ -75,7 +75,7 @@ int fast_s_mp_mul_high_digs (mp_int * a, mp_int * b, mp_int * c, int digs)
 | 
				
			|||||||
  c->used = pa;
 | 
					  c->used = pa;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    register mp_digit *tmpc;
 | 
					    mp_digit *tmpc;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    tmpc = c->dp + digs;
 | 
					    tmpc = c->dp + digs;
 | 
				
			||||||
    for (ix = digs; ix < pa; ix++) {
 | 
					    for (ix = digs; ix < pa; ix++) {
 | 
				
			||||||
 | 
				
			|||||||
@ -35,7 +35,7 @@ mp_copy (mp_int * a, mp_int * b)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  /* zero b and copy the parameters over */
 | 
					  /* zero b and copy the parameters over */
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    register mp_digit *tmpa, *tmpb;
 | 
					    mp_digit *tmpa, *tmpb;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* pointer aliases */
 | 
					    /* pointer aliases */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -30,7 +30,7 @@ int mp_div_2(mp_int * a, mp_int * b)
 | 
				
			|||||||
  oldused = b->used;
 | 
					  oldused = b->used;
 | 
				
			||||||
  b->used = a->used;
 | 
					  b->used = a->used;
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    register mp_digit r, rr, *tmpa, *tmpb;
 | 
					    mp_digit r, rr, *tmpa, *tmpb;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* source alias */
 | 
					    /* source alias */
 | 
				
			||||||
    tmpa = a->dp + b->used - 1;
 | 
					    tmpa = a->dp + b->used - 1;
 | 
				
			||||||
 | 
				
			|||||||
@ -58,7 +58,7 @@ int mp_div_2d (mp_int * a, int b, mp_int * c, mp_int * d)
 | 
				
			|||||||
  /* shift any bit count < DIGIT_BIT */
 | 
					  /* shift any bit count < DIGIT_BIT */
 | 
				
			||||||
  D = (mp_digit) (b % DIGIT_BIT);
 | 
					  D = (mp_digit) (b % DIGIT_BIT);
 | 
				
			||||||
  if (D != 0) {
 | 
					  if (D != 0) {
 | 
				
			||||||
    register mp_digit *tmpc, mask, shift;
 | 
					    mp_digit *tmpc, mask, shift;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* mask */
 | 
					    /* mask */
 | 
				
			||||||
    mask = (((mp_digit)1) << D) - 1;
 | 
					    mask = (((mp_digit)1) << D) - 1;
 | 
				
			||||||
 | 
				
			|||||||
@ -82,8 +82,8 @@ int mp_karatsuba_mul (mp_int * a, mp_int * b, mp_int * c)
 | 
				
			|||||||
  y1.used = b->used - B;
 | 
					  y1.used = b->used - B;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    register int x;
 | 
					    int x;
 | 
				
			||||||
    register mp_digit *tmpa, *tmpb, *tmpx, *tmpy;
 | 
					    mp_digit *tmpa, *tmpb, *tmpx, *tmpy;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* we copy the digits directly instead of using higher level functions
 | 
					    /* we copy the digits directly instead of using higher level functions
 | 
				
			||||||
     * since we also need to shift the digits
 | 
					     * since we also need to shift the digits
 | 
				
			||||||
 | 
				
			|||||||
@ -52,8 +52,8 @@ int mp_karatsuba_sqr (mp_int * a, mp_int * b)
 | 
				
			|||||||
    goto X0X0;
 | 
					    goto X0X0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    register int x;
 | 
					    int x;
 | 
				
			||||||
    register mp_digit *dst, *src;
 | 
					    mp_digit *dst, *src;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    src = a->dp;
 | 
					    src = a->dp;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -33,7 +33,7 @@ int mp_lshd (mp_int * a, int b)
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    register mp_digit *top, *bottom;
 | 
					    mp_digit *top, *bottom;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* increment the used by the shift amount then copy upwards */
 | 
					    /* increment the used by the shift amount then copy upwards */
 | 
				
			||||||
    a->used += b;
 | 
					    a->used += b;
 | 
				
			||||||
 | 
				
			|||||||
@ -56,9 +56,9 @@ mp_montgomery_reduce (mp_int * x, mp_int * n, mp_digit rho)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    /* a = a + mu * m * b**i */
 | 
					    /* a = a + mu * m * b**i */
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      register int iy;
 | 
					      int iy;
 | 
				
			||||||
      register mp_digit *tmpn, *tmpx, u;
 | 
					      mp_digit *tmpn, *tmpx, u;
 | 
				
			||||||
      register mp_word r;
 | 
					      mp_word r;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      /* alias for digits of the modulus */
 | 
					      /* alias for digits of the modulus */
 | 
				
			||||||
      tmpn = n->dp;
 | 
					      tmpn = n->dp;
 | 
				
			||||||
 | 
				
			|||||||
@ -31,7 +31,7 @@ int mp_mul_2(mp_int * a, mp_int * b)
 | 
				
			|||||||
  b->used = a->used;
 | 
					  b->used = a->used;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    register mp_digit r, rr, *tmpa, *tmpb;
 | 
					    mp_digit r, rr, *tmpa, *tmpb;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* alias for source */
 | 
					    /* alias for source */
 | 
				
			||||||
    tmpa = a->dp;
 | 
					    tmpa = a->dp;
 | 
				
			||||||
 | 
				
			|||||||
@ -44,8 +44,8 @@ int mp_mul_2d (mp_int * a, int b, mp_int * c)
 | 
				
			|||||||
  /* shift any bit count < DIGIT_BIT */
 | 
					  /* shift any bit count < DIGIT_BIT */
 | 
				
			||||||
  d = (mp_digit) (b % DIGIT_BIT);
 | 
					  d = (mp_digit) (b % DIGIT_BIT);
 | 
				
			||||||
  if (d != 0) {
 | 
					  if (d != 0) {
 | 
				
			||||||
    register mp_digit *tmpc, shift, mask, r, rr;
 | 
					    mp_digit *tmpc, shift, mask, r, rr;
 | 
				
			||||||
    register int x;
 | 
					    int x;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* bitmask for carries */
 | 
					    /* bitmask for carries */
 | 
				
			||||||
    mask = (((mp_digit)1) << d) - 1;
 | 
					    mask = (((mp_digit)1) << d) - 1;
 | 
				
			||||||
 | 
				
			|||||||
@ -32,7 +32,7 @@ void mp_rshd (mp_int * a, int b)
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    register mp_digit *bottom, *top;
 | 
					    mp_digit *bottom, *top;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* shift the digits down */
 | 
					    /* shift the digits down */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -47,8 +47,8 @@ s_mp_add (mp_int * a, mp_int * b, mp_int * c)
 | 
				
			|||||||
  c->used = max + 1;
 | 
					  c->used = max + 1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    register mp_digit u, *tmpa, *tmpb, *tmpc;
 | 
					    mp_digit u, *tmpa, *tmpb, *tmpc;
 | 
				
			||||||
    register int i;
 | 
					    int i;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* alias for digit pointers */
 | 
					    /* alias for digit pointers */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -35,8 +35,8 @@ s_mp_sub (mp_int * a, mp_int * b, mp_int * c)
 | 
				
			|||||||
  c->used = max;
 | 
					  c->used = max;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    register mp_digit u, *tmpa, *tmpb, *tmpc;
 | 
					    mp_digit u, *tmpa, *tmpb, *tmpc;
 | 
				
			||||||
    register int i;
 | 
					    int i;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* alias for digit pointers */
 | 
					    /* alias for digit pointers */
 | 
				
			||||||
    tmpa = a->dp;
 | 
					    tmpa = a->dp;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user