diff options
author | George Hazan <george.hazan@gmail.com> | 2012-06-02 20:55:18 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-06-02 20:55:18 +0000 |
commit | 78c0815c4118fe24ab78cce2dc48a6232dcd824a (patch) | |
tree | 8512c50df70b8dd80c919e88ade3419207c95956 /plugins/MirOTR/libgcrypt-1.4.6/mpi | |
parent | ce816d83a8c75808e0eb06832592bffefe4a8dc4 (diff) |
- code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@270 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/MirOTR/libgcrypt-1.4.6/mpi')
-rw-r--r-- | plugins/MirOTR/libgcrypt-1.4.6/mpi/mpi-add.c | 32 | ||||
-rw-r--r-- | plugins/MirOTR/libgcrypt-1.4.6/mpi/mpi-bit.c | 22 | ||||
-rw-r--r-- | plugins/MirOTR/libgcrypt-1.4.6/mpi/mpi-cmp.c | 10 | ||||
-rw-r--r-- | plugins/MirOTR/libgcrypt-1.4.6/mpi/mpi-div.c | 46 | ||||
-rw-r--r-- | plugins/MirOTR/libgcrypt-1.4.6/mpi/mpi-inline.h | 28 | ||||
-rw-r--r-- | plugins/MirOTR/libgcrypt-1.4.6/mpi/mpi-internal.h | 24 | ||||
-rw-r--r-- | plugins/MirOTR/libgcrypt-1.4.6/mpi/mpi-inv.c | 38 | ||||
-rw-r--r-- | plugins/MirOTR/libgcrypt-1.4.6/mpi/mpi-mpow.c | 24 | ||||
-rw-r--r-- | plugins/MirOTR/libgcrypt-1.4.6/mpi/mpi-mul.c | 32 | ||||
-rw-r--r-- | plugins/MirOTR/libgcrypt-1.4.6/mpi/mpi-pow.c | 2 | ||||
-rw-r--r-- | plugins/MirOTR/libgcrypt-1.4.6/mpi/mpi-scan.c | 32 | ||||
-rw-r--r-- | plugins/MirOTR/libgcrypt-1.4.6/mpi/mpicoder.c | 8 | ||||
-rw-r--r-- | plugins/MirOTR/libgcrypt-1.4.6/mpi/mpih-div.c | 76 | ||||
-rw-r--r-- | plugins/MirOTR/libgcrypt-1.4.6/mpi/mpih-mul.c | 86 | ||||
-rw-r--r-- | plugins/MirOTR/libgcrypt-1.4.6/mpi/mpiutil.c | 14 |
15 files changed, 237 insertions, 237 deletions
diff --git a/plugins/MirOTR/libgcrypt-1.4.6/mpi/mpi-add.c b/plugins/MirOTR/libgcrypt-1.4.6/mpi/mpi-add.c index ada257ae1e..a5cbc0f0fe 100644 --- a/plugins/MirOTR/libgcrypt-1.4.6/mpi/mpi-add.c +++ b/plugins/MirOTR/libgcrypt-1.4.6/mpi/mpi-add.c @@ -48,18 +48,18 @@ gcry_mpi_add_ui(gcry_mpi_t w, gcry_mpi_t u, unsigned long v ) /* If not space for W (and possible carry), increase space. */ wsize = usize + 1; - if( w->alloced < wsize ) + if ( w->alloced < wsize ) mpi_resize(w, wsize); /* These must be after realloc (U may be the same as W). */ up = u->d; wp = w->d; - if( !usize ) { /* simple */ + if ( !usize ) { /* simple */ wp[0] = v; wsize = v? 1:0; } - else if( !usign ) { /* mpi is not negative */ + else if ( !usign ) { /* mpi is not negative */ mpi_limb_t cy; cy = _gcry_mpih_add_1(wp, up, usize, v); wp[usize] = cy; @@ -67,7 +67,7 @@ gcry_mpi_add_ui(gcry_mpi_t w, gcry_mpi_t u, unsigned long v ) } else { /* The signs are different. Need exact comparison to determine * which operand to subtract from which. */ - if( usize == 1 && up[0] < v ) { + if ( usize == 1 && up[0] < v ) { wp[0] = v - up[0]; wsize = 1; } @@ -91,7 +91,7 @@ gcry_mpi_add(gcry_mpi_t w, gcry_mpi_t u, gcry_mpi_t v) mpi_size_t usize, vsize, wsize; int usign, vsign, wsign; - if( u->nlimbs < v->nlimbs ) { /* Swap U and V. */ + if ( u->nlimbs < v->nlimbs ) { /* Swap U and V. */ usize = v->nlimbs; usign = v->sign; vsize = u->nlimbs; @@ -116,31 +116,31 @@ gcry_mpi_add(gcry_mpi_t w, gcry_mpi_t u, gcry_mpi_t v) wp = w->d; wsign = 0; - if( !vsize ) { /* simple */ + if ( !vsize ) { /* simple */ MPN_COPY(wp, up, usize ); wsize = usize; wsign = usign; } - else if( usign != vsign ) { /* different sign */ + else if ( usign != vsign ) { /* different sign */ /* This test is right since USIZE >= VSIZE */ - if( usize != vsize ) { + if ( usize != vsize ) { _gcry_mpih_sub(wp, up, usize, vp, vsize); wsize = usize; MPN_NORMALIZE(wp, wsize); wsign = usign; } - else if( _gcry_mpih_cmp(up, vp, usize) < 0 ) { + else if ( _gcry_mpih_cmp(up, vp, usize) < 0 ) { _gcry_mpih_sub_n(wp, vp, up, usize); wsize = usize; MPN_NORMALIZE(wp, wsize); - if( !usign ) + if ( !usign ) wsign = 1; } else { _gcry_mpih_sub_n(wp, up, vp, usize); wsize = usize; MPN_NORMALIZE(wp, wsize); - if( usign ) + if ( usign ) wsign = 1; } } @@ -148,7 +148,7 @@ gcry_mpi_add(gcry_mpi_t w, gcry_mpi_t u, gcry_mpi_t v) mpi_limb_t cy = _gcry_mpih_add(wp, up, usize, vp, vsize); wp[usize] = cy; wsize = usize + cy; - if( usign ) + if ( usign ) wsign = 1; } @@ -174,19 +174,19 @@ gcry_mpi_sub_ui(gcry_mpi_t w, gcry_mpi_t u, unsigned long v ) /* If not space for W (and possible carry), increase space. */ wsize = usize + 1; - if( w->alloced < wsize ) + if ( w->alloced < wsize ) mpi_resize(w, wsize); /* These must be after realloc (U may be the same as W). */ up = u->d; wp = w->d; - if( !usize ) { /* simple */ + if ( !usize ) { /* simple */ wp[0] = v; wsize = v? 1:0; wsign = 1; } - else if( usign ) { /* mpi and v are negative */ + else if ( usign ) { /* mpi and v are negative */ mpi_limb_t cy; cy = _gcry_mpih_add_1(wp, up, usize, v); wp[usize] = cy; @@ -194,7 +194,7 @@ gcry_mpi_sub_ui(gcry_mpi_t w, gcry_mpi_t u, unsigned long v ) } else { /* The signs are different. Need exact comparison to determine * which operand to subtract from which. */ - if( usize == 1 && up[0] < v ) { + if ( usize == 1 && up[0] < v ) { wp[0] = v - up[0]; wsize = 1; wsign = 1; diff --git a/plugins/MirOTR/libgcrypt-1.4.6/mpi/mpi-bit.c b/plugins/MirOTR/libgcrypt-1.4.6/mpi/mpi-bit.c index 32c820c291..5aeedbbf6d 100644 --- a/plugins/MirOTR/libgcrypt-1.4.6/mpi/mpi-bit.c +++ b/plugins/MirOTR/libgcrypt-1.4.6/mpi/mpi-bit.c @@ -54,10 +54,10 @@ _gcry_clz_tab[] = void _gcry_mpi_normalize( gcry_mpi_t a ) { - if( mpi_is_opaque(a) ) + if ( mpi_is_opaque(a) ) return; - for( ; a->nlimbs && !a->d[a->nlimbs-1]; a->nlimbs-- ) + for ( ; a->nlimbs && !a->d[a->nlimbs-1]; a->nlimbs-- ) ; } @@ -71,14 +71,14 @@ gcry_mpi_get_nbits( gcry_mpi_t a ) { unsigned n; - if( mpi_is_opaque(a) ) { + if ( mpi_is_opaque(a) ) { return a->sign; /* which holds the number of bits */ } _gcry_mpi_normalize( a ); - if( a->nlimbs ) { + if ( a->nlimbs ) { mpi_limb_t alimb = a->d[a->nlimbs-1]; - if( alimb ) + if ( alimb ) count_leading_zeros( n, alimb ); else n = BITS_PER_MPI_LIMB; @@ -102,7 +102,7 @@ gcry_mpi_test_bit( gcry_mpi_t a, unsigned int n ) limbno = n / BITS_PER_MPI_LIMB; bitno = n % BITS_PER_MPI_LIMB; - if( limbno >= a->nlimbs ) + if ( limbno >= a->nlimbs ) return 0; /* too far left: this is a 0 */ limb = a->d[limbno]; return (limb & (A_LIMB_1 << bitno))? 1: 0; @@ -161,11 +161,11 @@ gcry_mpi_clear_highbit( gcry_mpi_t a, unsigned int n ) limbno = n / BITS_PER_MPI_LIMB; bitno = n % BITS_PER_MPI_LIMB; - if( limbno >= a->nlimbs ) + if ( limbno >= a->nlimbs ) return; /* not allocated, therefore no need to clear bits :-) */ - for( ; bitno < BITS_PER_MPI_LIMB; bitno++ ) + for ( ; bitno < BITS_PER_MPI_LIMB; bitno++ ) a->d[limbno] &= ~(A_LIMB_1 << bitno); a->nlimbs = limbno+1; } @@ -181,7 +181,7 @@ gcry_mpi_clear_bit( gcry_mpi_t a, unsigned int n ) limbno = n / BITS_PER_MPI_LIMB; bitno = n % BITS_PER_MPI_LIMB; - if( limbno >= a->nlimbs ) + if ( limbno >= a->nlimbs ) return; /* don't need to clear this bit, it's to far to left */ a->d[limbno] &= ~(A_LIMB_1 << bitno); } @@ -198,12 +198,12 @@ _gcry_mpi_rshift_limbs( gcry_mpi_t a, unsigned int count ) mpi_size_t n = a->nlimbs; unsigned int i; - if( count >= n ) { + if ( count >= n ) { a->nlimbs = 0; return; } - for( i = 0; i < n - count; i++ ) + for ( i = 0; i < n - count; i++ ) ap[i] = ap[i+count]; ap[i] = 0; a->nlimbs -= count; diff --git a/plugins/MirOTR/libgcrypt-1.4.6/mpi/mpi-cmp.c b/plugins/MirOTR/libgcrypt-1.4.6/mpi/mpi-cmp.c index 9dd10830b0..eb62885e21 100644 --- a/plugins/MirOTR/libgcrypt-1.4.6/mpi/mpi-cmp.c +++ b/plugins/MirOTR/libgcrypt-1.4.6/mpi/mpi-cmp.c @@ -75,15 +75,15 @@ gcry_mpi_cmp (gcry_mpi_t u, gcry_mpi_t v) /* U and V are either both positive or both negative. */ - if( usize != vsize && !u->sign && !v->sign ) + if ( usize != vsize && !u->sign && !v->sign ) return usize - vsize; - if( usize != vsize && u->sign && v->sign ) + if ( usize != vsize && u->sign && v->sign ) return vsize + usize; - if( !usize ) + if ( !usize ) return 0; - if( !(cmp = _gcry_mpih_cmp( u->d, v->d, usize )) ) + if ( !(cmp = _gcry_mpih_cmp( u->d, v->d, usize )) ) return 0; - if( (cmp < 0?1:0) == (u->sign?1:0)) + if ( (cmp < 0?1:0) == (u->sign?1:0)) return 1; return -1; diff --git a/plugins/MirOTR/libgcrypt-1.4.6/mpi/mpi-div.c b/plugins/MirOTR/libgcrypt-1.4.6/mpi/mpi-div.c index 0d8a2d1688..690a7e3885 100644 --- a/plugins/MirOTR/libgcrypt-1.4.6/mpi/mpi-div.c +++ b/plugins/MirOTR/libgcrypt-1.4.6/mpi/mpi-div.c @@ -42,17 +42,17 @@ _gcry_mpi_fdiv_r( gcry_mpi_t rem, gcry_mpi_t dividend, gcry_mpi_t divisor ) /* We need the original value of the divisor after the remainder has been * preliminary calculated. We have to copy it to temporary space if it's * the same variable as REM. */ - if( rem == divisor ) { + if ( rem == divisor ) { temp_divisor = mpi_copy( divisor ); divisor = temp_divisor; } _gcry_mpi_tdiv_r( rem, dividend, divisor ); - if( ((divisor_sign?1:0) ^ (dividend->sign?1:0)) && rem->nlimbs ) + if ( ((divisor_sign?1:0) ^ (dividend->sign?1:0)) && rem->nlimbs ) gcry_mpi_add( rem, rem, divisor); - if( temp_divisor ) + if ( temp_divisor ) mpi_free(temp_divisor); } @@ -70,10 +70,10 @@ _gcry_mpi_fdiv_r_ui( gcry_mpi_t rem, gcry_mpi_t dividend, ulong divisor ) mpi_limb_t rlimb; rlimb = _gcry_mpih_mod_1( dividend->d, dividend->nlimbs, divisor ); - if( rlimb && dividend->sign ) + if ( rlimb && dividend->sign ) rlimb = divisor - rlimb; - if( rem ) { + if ( rem ) { rem->d[0] = rlimb; rem->nlimbs = rlimb? 1:0; } @@ -95,19 +95,19 @@ _gcry_mpi_fdiv_qr( gcry_mpi_t quot, gcry_mpi_t rem, gcry_mpi_t dividend, gcry_mp int divisor_sign = divisor->sign; gcry_mpi_t temp_divisor = NULL; - if( quot == divisor || rem == divisor ) { + if ( quot == divisor || rem == divisor ) { temp_divisor = mpi_copy( divisor ); divisor = temp_divisor; } _gcry_mpi_tdiv_qr( quot, rem, dividend, divisor ); - if( (divisor_sign ^ dividend->sign) && rem->nlimbs ) { + if ( (divisor_sign ^ dividend->sign) && rem->nlimbs ) { gcry_mpi_sub_ui( quot, quot, 1 ); gcry_mpi_add( rem, rem, divisor); } - if( temp_divisor ) + if ( temp_divisor ) mpi_free(temp_divisor); } @@ -148,13 +148,13 @@ _gcry_mpi_tdiv_qr( gcry_mpi_t quot, gcry_mpi_t rem, gcry_mpi_t num, gcry_mpi_t d mpi_resize( rem, rsize); qsize = rsize - dsize; /* qsize cannot be bigger than this. */ - if( qsize <= 0 ) { - if( num != rem ) { + if ( qsize <= 0 ) { + if ( num != rem ) { rem->nlimbs = num->nlimbs; rem->sign = num->sign; MPN_COPY(rem->d, num->d, nsize); } - if( quot ) { + if ( quot ) { /* This needs to follow the assignment to rem, in case the * numerator and quotient are the same. */ quot->nlimbs = 0; @@ -163,7 +163,7 @@ _gcry_mpi_tdiv_qr( gcry_mpi_t quot, gcry_mpi_t rem, gcry_mpi_t num, gcry_mpi_t d return; } - if( quot ) + if ( quot ) mpi_resize( quot, qsize); /* Read pointers here, when reallocation is finished. */ @@ -172,9 +172,9 @@ _gcry_mpi_tdiv_qr( gcry_mpi_t quot, gcry_mpi_t rem, gcry_mpi_t num, gcry_mpi_t d rp = rem->d; /* Optimize division by a single-limb divisor. */ - if( dsize == 1 ) { + if ( dsize == 1 ) { mpi_limb_t rlimb; - if( quot ) { + if ( quot ) { qp = quot->d; rlimb = _gcry_mpih_divmod_1( qp, np, nsize, dp[0] ); qsize -= qp[qsize - 1] == 0; @@ -191,7 +191,7 @@ _gcry_mpi_tdiv_qr( gcry_mpi_t quot, gcry_mpi_t rem, gcry_mpi_t num, gcry_mpi_t d } - if( quot ) { + if ( quot ) { qp = quot->d; /* Make sure QP and NP point to different objects. Otherwise the * numerator would be gradually overwritten by the quotient limbs. */ @@ -211,7 +211,7 @@ _gcry_mpi_tdiv_qr( gcry_mpi_t quot, gcry_mpi_t rem, gcry_mpi_t num, gcry_mpi_t d * shifting it NORMALIZATION_STEPS bits to the left. Also shift the * numerator the same number of steps (to keep the quotient the same!). */ - if( normalization_steps ) { + if ( normalization_steps ) { mpi_ptr_t tp; mpi_limb_t nlimb; @@ -227,7 +227,7 @@ _gcry_mpi_tdiv_qr( gcry_mpi_t quot, gcry_mpi_t rem, gcry_mpi_t num, gcry_mpi_t d * significant word. Move the shifted numerator in the remainder * meanwhile. */ nlimb = _gcry_mpih_lshift(rp, np, nsize, normalization_steps); - if( nlimb ) { + if ( nlimb ) { rp[nsize] = nlimb; rsize = nsize + 1; } @@ -237,7 +237,7 @@ _gcry_mpi_tdiv_qr( gcry_mpi_t quot, gcry_mpi_t rem, gcry_mpi_t num, gcry_mpi_t d else { /* The denominator is already normalized, as required. Copy it to * temporary space if it overlaps with the quotient or remainder. */ - if( dp == rp || (quot && (dp == qp))) { + if ( dp == rp || (quot && (dp == qp))) { mpi_ptr_t tp; marker_nlimbs[markidx] = dsize; @@ -248,7 +248,7 @@ _gcry_mpi_tdiv_qr( gcry_mpi_t quot, gcry_mpi_t rem, gcry_mpi_t num, gcry_mpi_t d } /* Move the numerator to the remainder. */ - if( rp != np ) + if ( rp != np ) MPN_COPY(rp, np, nsize); rsize = nsize; @@ -256,7 +256,7 @@ _gcry_mpi_tdiv_qr( gcry_mpi_t quot, gcry_mpi_t rem, gcry_mpi_t num, gcry_mpi_t d q_limb = _gcry_mpih_divrem( qp, 0, rp, rsize, dp, dsize ); - if( quot ) { + if ( quot ) { qsize = rsize - dsize; if(q_limb) { qp[qsize] = q_limb; @@ -270,7 +270,7 @@ _gcry_mpi_tdiv_qr( gcry_mpi_t quot, gcry_mpi_t rem, gcry_mpi_t num, gcry_mpi_t d rsize = dsize; MPN_NORMALIZE (rp, rsize); - if( normalization_steps && rsize ) { + if ( normalization_steps && rsize ) { _gcry_mpih_rshift(rp, rp, rsize, normalization_steps); rsize -= rp[rsize - 1] == 0?1:0; } @@ -293,7 +293,7 @@ _gcry_mpi_tdiv_q_2exp( gcry_mpi_t w, gcry_mpi_t u, unsigned int count ) usize = u->nlimbs; limb_cnt = count / BITS_PER_MPI_LIMB; wsize = usize - limb_cnt; - if( limb_cnt >= usize ) + if ( limb_cnt >= usize ) w->nlimbs = 0; else { mpi_ptr_t wp; @@ -304,7 +304,7 @@ _gcry_mpi_tdiv_q_2exp( gcry_mpi_t w, gcry_mpi_t u, unsigned int count ) up = u->d; count %= BITS_PER_MPI_LIMB; - if( count ) { + if ( count ) { _gcry_mpih_rshift( wp, up + limb_cnt, wsize, count ); wsize -= !wp[wsize - 1]; } diff --git a/plugins/MirOTR/libgcrypt-1.4.6/mpi/mpi-inline.h b/plugins/MirOTR/libgcrypt-1.4.6/mpi/mpi-inline.h index 88d9f56c41..fb43951b1d 100644 --- a/plugins/MirOTR/libgcrypt-1.4.6/mpi/mpi-inline.h +++ b/plugins/MirOTR/libgcrypt-1.4.6/mpi/mpi-inline.h @@ -41,20 +41,20 @@ _gcry_mpih_add_1( mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, x = *s1_ptr++; s2_limb += x; *res_ptr++ = s2_limb; - if( s2_limb < x ) { /* sum is less than the left operand: handle carry */ + if ( s2_limb < x ) { /* sum is less than the left operand: handle carry */ while( --s1_size ) { x = *s1_ptr++ + 1; /* add carry */ *res_ptr++ = x; /* and store */ - if( x ) /* not 0 (no overflow): we can stop */ + if ( x ) /* not 0 (no overflow): we can stop */ goto leave; } return 1; /* return carry (size of s1 to small) */ } leave: - if( res_ptr != s1_ptr ) { /* not the same variable */ + if ( res_ptr != s1_ptr ) { /* not the same variable */ mpi_size_t i; /* copy the rest */ - for( i=0; i < s1_size-1; i++ ) + for ( i=0; i < s1_size-1; i++ ) res_ptr[i] = s1_ptr[i]; } return 0; /* no carry */ @@ -68,10 +68,10 @@ _gcry_mpih_add(mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, mpi_size_t s1_size, { mpi_limb_t cy = 0; - if( s2_size ) + if ( s2_size ) cy = _gcry_mpih_add_n( res_ptr, s1_ptr, s2_ptr, s2_size ); - if( s1_size - s2_size ) + if ( s1_size - s2_size ) cy = _gcry_mpih_add_1( res_ptr + s2_size, s1_ptr + s2_size, s1_size - s2_size, cy); return cy; @@ -87,20 +87,20 @@ _gcry_mpih_sub_1(mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, x = *s1_ptr++; s2_limb = x - s2_limb; *res_ptr++ = s2_limb; - if( s2_limb > x ) { + if ( s2_limb > x ) { while( --s1_size ) { x = *s1_ptr++; *res_ptr++ = x - 1; - if( x ) + if ( x ) goto leave; } return 1; } leave: - if( res_ptr != s1_ptr ) { + if ( res_ptr != s1_ptr ) { mpi_size_t i; - for( i=0; i < s1_size-1; i++ ) + for ( i=0; i < s1_size-1; i++ ) res_ptr[i] = s1_ptr[i]; } return 0; @@ -114,10 +114,10 @@ _gcry_mpih_sub( mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, mpi_size_t s1_size, { mpi_limb_t cy = 0; - if( s2_size ) + if ( s2_size ) cy = _gcry_mpih_sub_n(res_ptr, s1_ptr, s2_ptr, s2_size); - if( s1_size - s2_size ) + if ( s1_size - s2_size ) cy = _gcry_mpih_sub_1(res_ptr + s2_size, s1_ptr + s2_size, s1_size - s2_size, cy); return cy; @@ -135,10 +135,10 @@ _gcry_mpih_cmp( mpi_ptr_t op1_ptr, mpi_ptr_t op2_ptr, mpi_size_t size ) mpi_size_t i; mpi_limb_t op1_word, op2_word; - for( i = size - 1; i >= 0 ; i--) { + for ( i = size - 1; i >= 0 ; i--) { op1_word = op1_ptr[i]; op2_word = op2_ptr[i]; - if( op1_word != op2_word ) + if ( op1_word != op2_word ) goto diff; } return 0; diff --git a/plugins/MirOTR/libgcrypt-1.4.6/mpi/mpi-internal.h b/plugins/MirOTR/libgcrypt-1.4.6/mpi/mpi-internal.h index f9c1f9d4db..c560e5691f 100644 --- a/plugins/MirOTR/libgcrypt-1.4.6/mpi/mpi-internal.h +++ b/plugins/MirOTR/libgcrypt-1.4.6/mpi/mpi-internal.h @@ -76,7 +76,7 @@ typedef int mpi_size_t; /* (must be a signed type) */ #define MAX(h,i) ((h) > (i) ? (h) : (i)) #define RESIZE_IF_NEEDED(a,b) \ do { \ - if( (a)->alloced < (b) ) \ + if ( (a)->alloced < (b) ) \ mpi_resize((a), (b)); \ } while(0) @@ -84,21 +84,21 @@ typedef int mpi_size_t; /* (must be a signed type) */ #define MPN_COPY( d, s, n) \ do { \ mpi_size_t _i; \ - for( _i = 0; _i < (n); _i++ ) \ + for ( _i = 0; _i < (n); _i++ ) \ (d)[_i] = (s)[_i]; \ } while(0) #define MPN_COPY_INCR( d, s, n) \ do { \ mpi_size_t _i; \ - for( _i = 0; _i < (n); _i++ ) \ + for ( _i = 0; _i < (n); _i++ ) \ (d)[_i] = (d)[_i]; \ } while (0) #define MPN_COPY_DECR( d, s, n ) \ do { \ mpi_size_t _i; \ - for( _i = (n)-1; _i >= 0; _i--) \ + for ( _i = (n)-1; _i >= 0; _i--) \ (d)[_i] = (s)[_i]; \ } while(0) @@ -106,14 +106,14 @@ typedef int mpi_size_t; /* (must be a signed type) */ #define MPN_ZERO(d, n) \ do { \ int _i; \ - for( _i = 0; _i < (n); _i++ ) \ + for ( _i = 0; _i < (n); _i++ ) \ (d)[_i] = 0; \ } while (0) #define MPN_NORMALIZE(d, n) \ do { \ while( (n) > 0 ) { \ - if( (d)[(n)-1] ) \ + if ( (d)[(n)-1] ) \ break; \ (n)--; \ } \ @@ -121,8 +121,8 @@ typedef int mpi_size_t; /* (must be a signed type) */ #define MPN_NORMALIZE_NOT_ZERO(d, n) \ do { \ - for(;;) { \ - if( (d)[(n)-1] ) \ + for (;;) { \ + if ( (d)[(n)-1] ) \ break; \ (n)--; \ } \ @@ -130,7 +130,7 @@ typedef int mpi_size_t; /* (must be a signed type) */ #define MPN_MUL_N_RECURSE(prodp, up, vp, size, tspace) \ do { \ - if( (size) < KARATSUBA_THRESHOLD ) \ + if ( (size) < KARATSUBA_THRESHOLD ) \ mul_n_basecase (prodp, up, vp, size); \ else \ mul_n (prodp, up, vp, size, tspace); \ @@ -151,15 +151,15 @@ typedef int mpi_size_t; /* (must be a signed type) */ _q += (nh); /* DI is 2**BITS_PER_MPI_LIMB too small */ \ umul_ppmm (_xh, _xl, _q, (d)); \ sub_ddmmss (_xh, _r, (nh), (nl), _xh, _xl); \ - if( _xh ) { \ + if ( _xh ) { \ sub_ddmmss (_xh, _r, _xh, _r, 0, (d)); \ _q++; \ - if( _xh) { \ + if ( _xh) { \ sub_ddmmss (_xh, _r, _xh, _r, 0, (d)); \ _q++; \ } \ } \ - if( _r >= (d) ) { \ + if ( _r >= (d) ) { \ _r -= (d); \ _q++; \ } \ diff --git a/plugins/MirOTR/libgcrypt-1.4.6/mpi/mpi-inv.c b/plugins/MirOTR/libgcrypt-1.4.6/mpi/mpi-inv.c index 5d269466e0..530f8fa4ff 100644 --- a/plugins/MirOTR/libgcrypt-1.4.6/mpi/mpi-inv.c +++ b/plugins/MirOTR/libgcrypt-1.4.6/mpi/mpi-inv.c @@ -98,7 +98,7 @@ gcry_mpi_invm( gcry_mpi_t x, gcry_mpi_t a, gcry_mpi_t n ) v1 = mpi_copy(v); /* !-- used as const 1 */ v2 = mpi_alloc( mpi_get_nlimbs(u) ); mpi_sub( v2, u1, u ); v3 = mpi_copy(v); - if( mpi_test_bit(u, 0) ) { /* u is odd */ + if ( mpi_test_bit(u, 0) ) { /* u is odd */ t1 = mpi_alloc_set_ui(0); t2 = mpi_alloc_set_ui(1); t2->sign = 1; t3 = mpi_copy(v); t3->sign = !t3->sign; @@ -111,7 +111,7 @@ gcry_mpi_invm( gcry_mpi_t x, gcry_mpi_t a, gcry_mpi_t n ) } do { do { - if( mpi_test_bit(t1, 0) || mpi_test_bit(t2, 0) ) { /* one is odd */ + if ( mpi_test_bit(t1, 0) || mpi_test_bit(t2, 0) ) { /* one is odd */ mpi_add(t1, t1, v); mpi_sub(t2, t2, u); } @@ -122,7 +122,7 @@ gcry_mpi_invm( gcry_mpi_t x, gcry_mpi_t a, gcry_mpi_t n ) ; } while( !mpi_test_bit( t3, 0 ) ); /* while t3 is even */ - if( !t3->sign ) { + if ( !t3->sign ) { mpi_set(u1, t1); mpi_set(u2, t2); mpi_set(u3, t3); @@ -139,7 +139,7 @@ gcry_mpi_invm( gcry_mpi_t x, gcry_mpi_t a, gcry_mpi_t n ) mpi_sub(t1, u1, v1); mpi_sub(t2, u2, v2); mpi_sub(t3, u3, v3); - if( t1->sign ) { + if ( t1->sign ) { mpi_add(t1, t1, v); mpi_sub(t2, t2, u); } @@ -175,18 +175,18 @@ gcry_mpi_invm( gcry_mpi_t x, gcry_mpi_t a, gcry_mpi_t n ) odd = mpi_test_bit(v,0); u1 = mpi_alloc_set_ui(1); - if( !odd ) + if ( !odd ) u2 = mpi_alloc_set_ui(0); u3 = mpi_copy(u); v1 = mpi_copy(v); - if( !odd ) { + if ( !odd ) { v2 = mpi_alloc( mpi_get_nlimbs(u) ); mpi_sub( v2, u1, u ); /* U is used as const 1 */ } v3 = mpi_copy(v); - if( mpi_test_bit(u, 0) ) { /* u is odd */ + if ( mpi_test_bit(u, 0) ) { /* u is odd */ t1 = mpi_alloc_set_ui(0); - if( !odd ) { + if ( !odd ) { t2 = mpi_alloc_set_ui(1); t2->sign = 1; } t3 = mpi_copy(v); t3->sign = !t3->sign; @@ -194,14 +194,14 @@ gcry_mpi_invm( gcry_mpi_t x, gcry_mpi_t a, gcry_mpi_t n ) } else { t1 = mpi_alloc_set_ui(1); - if( !odd ) + if ( !odd ) t2 = mpi_alloc_set_ui(0); t3 = mpi_copy(u); } do { do { - if( !odd ) { - if( mpi_test_bit(t1, 0) || mpi_test_bit(t2, 0) ) { /* one is odd */ + if ( !odd ) { + if ( mpi_test_bit(t1, 0) || mpi_test_bit(t2, 0) ) { /* one is odd */ mpi_add(t1, t1, v); mpi_sub(t2, t2, u); } @@ -210,7 +210,7 @@ gcry_mpi_invm( gcry_mpi_t x, gcry_mpi_t a, gcry_mpi_t n ) mpi_rshift(t3, t3, 1); } else { - if( mpi_test_bit(t1, 0) ) + if ( mpi_test_bit(t1, 0) ) mpi_add(t1, t1, v); mpi_rshift(t1, t1, 1); mpi_rshift(t3, t3, 1); @@ -219,16 +219,16 @@ gcry_mpi_invm( gcry_mpi_t x, gcry_mpi_t a, gcry_mpi_t n ) ; } while( !mpi_test_bit( t3, 0 ) ); /* while t3 is even */ - if( !t3->sign ) { + if ( !t3->sign ) { mpi_set(u1, t1); - if( !odd ) + if ( !odd ) mpi_set(u2, t2); mpi_set(u3, t3); } else { mpi_sub(v1, v, t1); sign = u->sign; u->sign = !u->sign; - if( !odd ) + if ( !odd ) mpi_sub(v2, u, t2); u->sign = sign; sign = t3->sign; t3->sign = !t3->sign; @@ -236,12 +236,12 @@ gcry_mpi_invm( gcry_mpi_t x, gcry_mpi_t a, gcry_mpi_t n ) t3->sign = sign; } mpi_sub(t1, u1, v1); - if( !odd ) + if ( !odd ) mpi_sub(t2, u2, v2); mpi_sub(t3, u3, v3); - if( t1->sign ) { + if ( t1->sign ) { mpi_add(t1, t1, v); - if( !odd ) + if ( !odd ) mpi_sub(t2, t2, u); } } while( mpi_cmp_ui( t3, 0 ) ); /* while t3 != 0 */ @@ -251,7 +251,7 @@ gcry_mpi_invm( gcry_mpi_t x, gcry_mpi_t a, gcry_mpi_t n ) mpi_free(u1); mpi_free(v1); mpi_free(t1); - if( !odd ) { + if ( !odd ) { mpi_free(u2); mpi_free(v2); mpi_free(t2); diff --git a/plugins/MirOTR/libgcrypt-1.4.6/mpi/mpi-mpow.c b/plugins/MirOTR/libgcrypt-1.4.6/mpi/mpi-mpow.c index 131c5b67b2..33b9d393c5 100644 --- a/plugins/MirOTR/libgcrypt-1.4.6/mpi/mpi-mpow.c +++ b/plugins/MirOTR/libgcrypt-1.4.6/mpi/mpi-mpow.c @@ -52,7 +52,7 @@ build_index( gcry_mpi_t *exparray, int k, int i, int t ) bitno = t-i; for(j=k-1; j >= 0; j-- ) { idx <<= 1; - if( mpi_test_bit( exparray[j], bitno ) ) + if ( mpi_test_bit( exparray[j], bitno ) ) idx |= 1; } /*log_debug("t=%d i=%d idx=%d\n", t, i, idx );*/ @@ -81,7 +81,7 @@ _gcry_mpi_mulpowm( gcry_mpi_t res, gcry_mpi_t *basearray, gcry_mpi_t *exparray, for(t=0, i=0; (tmp=exparray[i]); i++ ) { /*log_mpidump("exp: ", tmp );*/ j = mpi_get_nbits(tmp); - if( j > t ) + if ( j > t ) t = j; } /*log_mpidump("mod: ", m );*/ @@ -101,20 +101,20 @@ _gcry_mpi_mulpowm( gcry_mpi_t res, gcry_mpi_t *basearray, gcry_mpi_t *exparray, barrett_r1, barrett_r2 ); idx = build_index( exparray, k, i, t ); gcry_assert (idx >= 0 && idx < (1<<k)); - if( !G[idx] ) { - if( !idx ) + if ( !G[idx] ) { + if ( !idx ) G[0] = mpi_alloc_set_ui( 1 ); else { for(j=0; j < k; j++ ) { - if( (idx & (1<<j) ) ) { - if( !G[idx] ) + if ( (idx & (1<<j) ) ) { + if ( !G[idx] ) G[idx] = mpi_copy( basearray[j] ); else barrett_mulm( G[idx], G[idx], basearray[j], m, barrett_y, barrett_k, barrett_r1, barrett_r2 ); } } - if( !G[idx] ) + if ( !G[idx] ) G[idx] = mpi_alloc(0); } } @@ -140,7 +140,7 @@ static void barrett_mulm( gcry_mpi_t w, gcry_mpi_t u, gcry_mpi_t v, gcry_mpi_t m, gcry_mpi_t y, int k, gcry_mpi_t r1, gcry_mpi_t r2 ) { mpi_mul(w, u, v); - if( calc_barrett( w, w, m, y, k, r1, r2 ) ) + if ( calc_barrett( w, w, m, y, k, r1, r2 ) ) mpi_fdiv_r( w, w, m ); } @@ -178,7 +178,7 @@ calc_barrett( gcry_mpi_t r, gcry_mpi_t x, gcry_mpi_t m, gcry_mpi_t y, int k, gcr int xx = k > 3 ? k-3:0; mpi_normalize( x ); - if( mpi_get_nlimbs(x) > 2*k ) + if ( mpi_get_nlimbs(x) > 2*k ) return 1; /* can't do it */ /* 1. q1 = floor( x / b^k-1) @@ -197,14 +197,14 @@ calc_barrett( gcry_mpi_t r, gcry_mpi_t x, gcry_mpi_t m, gcry_mpi_t y, int k, gcr * 3. if r < 0 then r = r + b^k+1 */ mpi_set( r1, x ); - if( r1->nlimbs > k+1 ) /* quick modulo operation */ + if ( r1->nlimbs > k+1 ) /* quick modulo operation */ r1->nlimbs = k+1; mpi_mul( r2, r2, m ); - if( r2->nlimbs > k+1 ) /* quick modulo operation */ + if ( r2->nlimbs > k+1 ) /* quick modulo operation */ r2->nlimbs = k+1; mpi_sub( r, r1, r2 ); - if( mpi_is_neg( r ) ) { + if ( mpi_is_neg( r ) ) { gcry_mpi_t tmp; tmp = mpi_alloc( k + 2 ); diff --git a/plugins/MirOTR/libgcrypt-1.4.6/mpi/mpi-mul.c b/plugins/MirOTR/libgcrypt-1.4.6/mpi/mpi-mul.c index 25aeaa0a2c..7ad9dd594b 100644 --- a/plugins/MirOTR/libgcrypt-1.4.6/mpi/mpi-mul.c +++ b/plugins/MirOTR/libgcrypt-1.4.6/mpi/mpi-mul.c @@ -41,19 +41,19 @@ gcry_mpi_mul_ui( gcry_mpi_t prod, gcry_mpi_t mult, unsigned long small_mult ) size = mult->nlimbs; sign = mult->sign; - if( !size || !small_mult ) { + if ( !size || !small_mult ) { prod->nlimbs = 0; prod->sign = 0; return; } prod_size = size + 1; - if( prod->alloced < prod_size ) + if ( prod->alloced < prod_size ) mpi_resize( prod, prod_size ); prod_ptr = prod->d; cy = _gcry_mpih_mul_1( prod_ptr, mult->d, size, (mpi_limb_t)small_mult ); - if( cy ) + if ( cy ) prod_ptr[size++] = cy; prod->nlimbs = size; prod->sign = sign; @@ -71,7 +71,7 @@ gcry_mpi_mul_2exp( gcry_mpi_t w, gcry_mpi_t u, unsigned long cnt) usize = u->nlimbs; usign = u->sign; - if( !usize ) { + if ( !usize ) { w->nlimbs = 0; w->sign = 0; return; @@ -79,16 +79,16 @@ gcry_mpi_mul_2exp( gcry_mpi_t w, gcry_mpi_t u, unsigned long cnt) limb_cnt = cnt / BITS_PER_MPI_LIMB; wsize = usize + limb_cnt + 1; - if( w->alloced < wsize ) + if ( w->alloced < wsize ) mpi_resize(w, wsize ); wp = w->d; wsize = usize + limb_cnt; wsign = usign; cnt %= BITS_PER_MPI_LIMB; - if( cnt ) { + if ( cnt ) { wlimb = _gcry_mpih_lshift( wp + limb_cnt, u->d, usize, cnt ); - if( wlimb ) { + if ( wlimb ) { wp[wsize] = wlimb; wsize++; } @@ -117,7 +117,7 @@ gcry_mpi_mul( gcry_mpi_t w, gcry_mpi_t u, gcry_mpi_t v) mpi_ptr_t tmp_limb=NULL; unsigned int tmp_limb_nlimbs = 0; - if( u->nlimbs < v->nlimbs ) { /* Swap U and V. */ + if ( u->nlimbs < v->nlimbs ) { /* Swap U and V. */ usize = v->nlimbs; usign = v->sign; usecure = mpi_is_secure(v); @@ -150,8 +150,8 @@ gcry_mpi_mul( gcry_mpi_t w, gcry_mpi_t u, gcry_mpi_t v) assign_wp = 2; /* mark it as 2 so that we can later copy it back to * mormal memory */ } - else if( w->alloced < wsize ) { - if( wp == up || wp == vp ) { + else if ( w->alloced < wsize ) { + if ( wp == up || wp == vp ) { wp = mpi_alloc_limb_space( wsize, mpi_is_secure(w) ); assign_wp = 1; } @@ -161,17 +161,17 @@ gcry_mpi_mul( gcry_mpi_t w, gcry_mpi_t u, gcry_mpi_t v) } } else { /* Make U and V not overlap with W. */ - if( wp == up ) { + if ( wp == up ) { /* W and U are identical. Allocate temporary space for U. */ tmp_limb_nlimbs = usize; up = tmp_limb = mpi_alloc_limb_space( usize, usecure ); /* Is V identical too? Keep it identical with U. */ - if( wp == vp ) + if ( wp == vp ) vp = up; /* Copy to the temporary space. */ MPN_COPY( up, wp, usize ); } - else if( wp == vp ) { + else if ( wp == vp ) { /* W and V are identical. Allocate temporary space for V. */ tmp_limb_nlimbs = vsize; vp = tmp_limb = mpi_alloc_limb_space( vsize, vsecure ); @@ -180,14 +180,14 @@ gcry_mpi_mul( gcry_mpi_t w, gcry_mpi_t u, gcry_mpi_t v) } } - if( !vsize ) + if ( !vsize ) wsize = 0; else { cy = _gcry_mpih_mul( wp, up, usize, vp, vsize ); wsize -= cy? 0:1; } - if( assign_wp ) { + if ( assign_wp ) { if (assign_wp == 2) { /* copy the temp wp from secure memory back to normal memory */ mpi_ptr_t tmp_wp = mpi_alloc_limb_space (wsize, 0); @@ -199,7 +199,7 @@ gcry_mpi_mul( gcry_mpi_t w, gcry_mpi_t u, gcry_mpi_t v) } w->nlimbs = wsize; w->sign = sign_product; - if( tmp_limb ) + if ( tmp_limb ) _gcry_mpi_free_limb_space (tmp_limb, tmp_limb_nlimbs); } diff --git a/plugins/MirOTR/libgcrypt-1.4.6/mpi/mpi-pow.c b/plugins/MirOTR/libgcrypt-1.4.6/mpi/mpi-pow.c index ca7ead0285..23e9f8eae1 100644 --- a/plugins/MirOTR/libgcrypt-1.4.6/mpi/mpi-pow.c +++ b/plugins/MirOTR/libgcrypt-1.4.6/mpi/mpi-pow.c @@ -234,7 +234,7 @@ gcry_mpi_powm (gcry_mpi_t res, if ( (mpi_limb_signed_t)e < 0 ) { /*mpih_mul( xp, rp, rsize, bp, bsize );*/ - if( bsize < KARATSUBA_THRESHOLD ) + if ( bsize < KARATSUBA_THRESHOLD ) _gcry_mpih_mul ( xp, rp, rsize, bp, bsize ); else _gcry_mpih_mul_karatsuba_case (xp, rp, rsize, bp, bsize, diff --git a/plugins/MirOTR/libgcrypt-1.4.6/mpi/mpi-scan.c b/plugins/MirOTR/libgcrypt-1.4.6/mpi/mpi-scan.c index 90699cdd69..e06d990150 100644 --- a/plugins/MirOTR/libgcrypt-1.4.6/mpi/mpi-scan.c +++ b/plugins/MirOTR/libgcrypt-1.4.6/mpi/mpi-scan.c @@ -42,8 +42,8 @@ _gcry_mpi_getbyte( gcry_mpi_t a, unsigned idx ) ap = a->d; for(n=0,i=0; i < a->nlimbs; i++ ) { limb = ap[i]; - for( j=0; j < BYTES_PER_MPI_LIMB; j++, n++ ) - if( n == idx ) + for ( j=0; j < BYTES_PER_MPI_LIMB; j++, n++ ) + if ( n == idx ) return (limb >> j*8) & 0xff; } return -1; @@ -65,38 +65,38 @@ _gcry_mpi_putbyte( gcry_mpi_t a, unsigned idx, int xc ) ap = a->d; for(n=0,i=0; i < a->alloced; i++ ) { limb = ap[i]; - for( j=0; j < BYTES_PER_MPI_LIMB; j++, n++ ) - if( n == idx ) { + for ( j=0; j < BYTES_PER_MPI_LIMB; j++, n++ ) + if ( n == idx ) { #if BYTES_PER_MPI_LIMB == 4 - if( j == 0 ) + if ( j == 0 ) limb = (limb & 0xffffff00) | c; - else if( j == 1 ) + else if ( j == 1 ) limb = (limb & 0xffff00ff) | (c<<8); - else if( j == 2 ) + else if ( j == 2 ) limb = (limb & 0xff00ffff) | (c<<16); else limb = (limb & 0x00ffffff) | (c<<24); #elif BYTES_PER_MPI_LIMB == 8 - if( j == 0 ) + if ( j == 0 ) limb = (limb & 0xffffffffffffff00) | c; - else if( j == 1 ) + else if ( j == 1 ) limb = (limb & 0xffffffffffff00ff) | (c<<8); - else if( j == 2 ) + else if ( j == 2 ) limb = (limb & 0xffffffffff00ffff) | (c<<16); - else if( j == 3 ) + else if ( j == 3 ) limb = (limb & 0xffffffff00ffffff) | (c<<24); - else if( j == 4 ) + else if ( j == 4 ) limb = (limb & 0xffffff00ffffffff) | (c<<32); - else if( j == 5 ) + else if ( j == 5 ) limb = (limb & 0xffff00ffffffffff) | (c<<40); - else if( j == 6 ) + else if ( j == 6 ) limb = (limb & 0xff00ffffffffffff) | (c<<48); else limb = (limb & 0x00ffffffffffffff) | (c<<56); #else #error please enhance this function, its ugly - i know. #endif - if( a->nlimbs <= i ) + if ( a->nlimbs <= i ) a->nlimbs = i+1; ap[i] = limb; return; @@ -115,7 +115,7 @@ _gcry_mpi_trailing_zeros( gcry_mpi_t a ) unsigned n, count = 0; for(n=0; n < a->nlimbs; n++ ) { - if( a->d[n] ) { + if ( a->d[n] ) { unsigned nn; mpi_limb_t alimb = a->d[n]; diff --git a/plugins/MirOTR/libgcrypt-1.4.6/mpi/mpicoder.c b/plugins/MirOTR/libgcrypt-1.4.6/mpi/mpicoder.c index 8f0c76f144..63e589438c 100644 --- a/plugins/MirOTR/libgcrypt-1.4.6/mpi/mpicoder.c +++ b/plugins/MirOTR/libgcrypt-1.4.6/mpi/mpicoder.c @@ -46,7 +46,7 @@ mpi_read_from_buffer (const unsigned char *buffer, unsigned *ret_nread, /* log_debug ("mpi too large (%u bits)\n", nbits); */ goto leave; } - else if( !nbits ) + else if ( !nbits ) { /* log_debug ("an mpi of size 0 is not allowed\n"); */ goto leave; @@ -160,9 +160,9 @@ mpi_fromstr (gcry_mpi_t val, const char *str) c <<= 4; if ( c2 >= '0' && c2 <= '9' ) c |= c2 - '0'; - else if( c2 >= 'a' && c2 <= 'f' ) + else if ( c2 >= 'a' && c2 <= 'f' ) c |= c2 - 'a' + 10; - else if( c2 >= 'A' && c2 <= 'F' ) + else if ( c2 >= 'A' && c2 <= 'F' ) c |= c2 - 'A' + 10; else { @@ -601,7 +601,7 @@ gcry_mpi_print (enum gcry_mpi_format format, unsigned int n = (nbits + 7)/8; /* The PGP format can only handle unsigned integers. */ - if( a->sign ) + if ( a->sign ) return gcry_error (GPG_ERR_INV_ARG); if (buffer && n+2 > len) diff --git a/plugins/MirOTR/libgcrypt-1.4.6/mpi/mpih-div.c b/plugins/MirOTR/libgcrypt-1.4.6/mpi/mpih-div.c index e41e205e1d..f151b8b17b 100644 --- a/plugins/MirOTR/libgcrypt-1.4.6/mpi/mpih-div.c +++ b/plugins/MirOTR/libgcrypt-1.4.6/mpi/mpih-div.c @@ -51,7 +51,7 @@ _gcry_mpih_mod_1(mpi_ptr_t dividend_ptr, mpi_size_t dividend_size, int dummy; /* Botch: Should this be handled at all? Rely on callers? */ - if( !dividend_size ) + if ( !dividend_size ) return 0; /* If multiplication is much faster than division, and the @@ -62,12 +62,12 @@ _gcry_mpih_mod_1(mpi_ptr_t dividend_ptr, mpi_size_t dividend_size, * Does it ever help to use udiv_qrnnd_preinv? * && Does what we save compensate for the inversion overhead? */ - if( UDIV_TIME > (2 * UMUL_TIME + 6) + if ( UDIV_TIME > (2 * UMUL_TIME + 6) && (UDIV_TIME - (2 * UMUL_TIME + 6)) * dividend_size > UDIV_TIME ) { int normalization_steps; count_leading_zeros( normalization_steps, divisor_limb ); - if( normalization_steps ) { + if ( normalization_steps ) { mpi_limb_t divisor_limb_inverted; divisor_limb <<= normalization_steps; @@ -78,7 +78,7 @@ _gcry_mpih_mod_1(mpi_ptr_t dividend_ptr, mpi_size_t dividend_size, * * Special case for DIVISOR_LIMB == 100...000. */ - if( !(divisor_limb << 1) ) + if ( !(divisor_limb << 1) ) divisor_limb_inverted = ~(mpi_limb_t)0; else udiv_qrnnd(divisor_limb_inverted, dummy, @@ -93,7 +93,7 @@ _gcry_mpih_mod_1(mpi_ptr_t dividend_ptr, mpi_size_t dividend_size, * | (dividend_ptr[dividend_size - 2] >> ...))) * ...one division less... */ - for( i = dividend_size - 2; i >= 0; i--) { + for ( i = dividend_size - 2; i >= 0; i--) { n0 = dividend_ptr[i]; UDIV_QRNND_PREINV(dummy, r, r, ((n1 << normalization_steps) @@ -115,7 +115,7 @@ _gcry_mpih_mod_1(mpi_ptr_t dividend_ptr, mpi_size_t dividend_size, * * Special case for DIVISOR_LIMB == 100...000. */ - if( !(divisor_limb << 1) ) + if ( !(divisor_limb << 1) ) divisor_limb_inverted = ~(mpi_limb_t)0; else udiv_qrnnd(divisor_limb_inverted, dummy, @@ -124,12 +124,12 @@ _gcry_mpih_mod_1(mpi_ptr_t dividend_ptr, mpi_size_t dividend_size, i = dividend_size - 1; r = dividend_ptr[i]; - if( r >= divisor_limb ) + if ( r >= divisor_limb ) r = 0; else i--; - for( ; i >= 0; i--) { + for ( ; i >= 0; i--) { n0 = dividend_ptr[i]; UDIV_QRNND_PREINV(dummy, r, r, n0, divisor_limb, divisor_limb_inverted); @@ -138,11 +138,11 @@ _gcry_mpih_mod_1(mpi_ptr_t dividend_ptr, mpi_size_t dividend_size, } } else { - if( UDIV_NEEDS_NORMALIZATION ) { + if ( UDIV_NEEDS_NORMALIZATION ) { int normalization_steps; count_leading_zeros(normalization_steps, divisor_limb); - if( normalization_steps ) { + if ( normalization_steps ) { divisor_limb <<= normalization_steps; n1 = dividend_ptr[dividend_size - 1]; @@ -178,7 +178,7 @@ _gcry_mpih_mod_1(mpi_ptr_t dividend_ptr, mpi_size_t dividend_size, else i--; - for(; i >= 0; i--) { + for (; i >= 0; i--) { n0 = dividend_ptr[i]; udiv_qrnnd (dummy, r, r, n0, divisor_limb); } @@ -225,17 +225,17 @@ _gcry_mpih_divrem( mpi_ptr_t qp, mpi_size_t qextra_limbs, d = dp[0]; n1 = np[nsize - 1]; - if( n1 >= d ) { + if ( n1 >= d ) { n1 -= d; most_significant_q_limb = 1; } qp += qextra_limbs; - for( i = nsize - 2; i >= 0; i--) + for ( i = nsize - 2; i >= 0; i--) udiv_qrnnd( qp[i], n1, n1, np[i], d ); qp -= qextra_limbs; - for( i = qextra_limbs - 1; i >= 0; i-- ) + for ( i = qextra_limbs - 1; i >= 0; i-- ) udiv_qrnnd (qp[i], n1, n1, 0, d); np[0] = n1; @@ -254,28 +254,28 @@ _gcry_mpih_divrem( mpi_ptr_t qp, mpi_size_t qextra_limbs, n1 = np[1]; n0 = np[0]; - if( n1 >= d1 && (n1 > d1 || n0 >= d0) ) { + if ( n1 >= d1 && (n1 > d1 || n0 >= d0) ) { sub_ddmmss (n1, n0, n1, n0, d1, d0); most_significant_q_limb = 1; } - for( i = qextra_limbs + nsize - 2 - 1; i >= 0; i-- ) { + for ( i = qextra_limbs + nsize - 2 - 1; i >= 0; i-- ) { mpi_limb_t q; mpi_limb_t r; - if( i >= qextra_limbs ) + if ( i >= qextra_limbs ) np--; else np[0] = 0; - if( n1 == d1 ) { + if ( n1 == d1 ) { /* Q should be either 111..111 or 111..110. Need special * treatment of this rare case as normal division would * give overflow. */ q = ~(mpi_limb_t)0; r = n0 + d1; - if( r < d1 ) { /* Carry in the addition? */ + if ( r < d1 ) { /* Carry in the addition? */ add_ssaaaa( n1, n0, r - d0, np[0], 0, d0 ); qp[i] = q; continue; @@ -290,12 +290,12 @@ _gcry_mpih_divrem( mpi_ptr_t qp, mpi_size_t qextra_limbs, n2 = np[0]; q_test: - if( n1 > r || (n1 == r && n0 > n2) ) { + if ( n1 > r || (n1 == r && n0 > n2) ) { /* The estimated Q was too large. */ q--; sub_ddmmss (n1, n0, n1, n0, 0, d0); r += d1; - if( r >= d1 ) /* If not carry, test Q again. */ + if ( r >= d1 ) /* If not carry, test Q again. */ goto q_test; } @@ -317,7 +317,7 @@ _gcry_mpih_divrem( mpi_ptr_t qp, mpi_size_t qextra_limbs, d1 = dp[dsize - 2]; n0 = np[dsize - 1]; - if( n0 >= dX ) { + if ( n0 >= dX ) { if(n0 > dX || _gcry_mpih_cmp(np, dp, dsize - 1) >= 0 ) { _gcry_mpih_sub_n(np, np, dp, dsize); n0 = np[dsize - 1]; @@ -325,12 +325,12 @@ _gcry_mpih_divrem( mpi_ptr_t qp, mpi_size_t qextra_limbs, } } - for( i = qextra_limbs + nsize - dsize - 1; i >= 0; i--) { + for ( i = qextra_limbs + nsize - dsize - 1; i >= 0; i--) { mpi_limb_t q; mpi_limb_t n1, n2; mpi_limb_t cy_limb; - if( i >= qextra_limbs ) { + if ( i >= qextra_limbs ) { np--; n2 = np[dsize]; } @@ -340,7 +340,7 @@ _gcry_mpih_divrem( mpi_ptr_t qp, mpi_size_t qextra_limbs, np[0] = 0; } - if( n0 == dX ) { + if ( n0 == dX ) { /* This might over-estimate q, but it's probably not worth * the extra code here to find out. */ q = ~(mpi_limb_t)0; @@ -354,7 +354,7 @@ _gcry_mpih_divrem( mpi_ptr_t qp, mpi_size_t qextra_limbs, while( n1 > r || (n1 == r && n0 > np[dsize - 2])) { q--; r += dX; - if( r < dX ) /* I.e. "carry in previous addition?" */ + if ( r < dX ) /* I.e. "carry in previous addition?" */ break; n1 -= n0 < d1; n0 -= d1; @@ -366,7 +366,7 @@ _gcry_mpih_divrem( mpi_ptr_t qp, mpi_size_t qextra_limbs, * could make this loop make two iterations less. */ cy_limb = _gcry_mpih_submul_1(np, dp, dsize, q); - if( n2 != cy_limb ) { + if ( n2 != cy_limb ) { _gcry_mpih_add_n(np, np, dp, dsize); q--; } @@ -399,7 +399,7 @@ _gcry_mpih_divmod_1( mpi_ptr_t quot_ptr, mpi_limb_t n1, n0, r; int dummy; - if( !dividend_size ) + if ( !dividend_size ) return 0; /* If multiplication is much faster than division, and the @@ -410,12 +410,12 @@ _gcry_mpih_divmod_1( mpi_ptr_t quot_ptr, * Does it ever help to use udiv_qrnnd_preinv? * && Does what we save compensate for the inversion overhead? */ - if( UDIV_TIME > (2 * UMUL_TIME + 6) + if ( UDIV_TIME > (2 * UMUL_TIME + 6) && (UDIV_TIME - (2 * UMUL_TIME + 6)) * dividend_size > UDIV_TIME ) { int normalization_steps; count_leading_zeros( normalization_steps, divisor_limb ); - if( normalization_steps ) { + if ( normalization_steps ) { mpi_limb_t divisor_limb_inverted; divisor_limb <<= normalization_steps; @@ -425,7 +425,7 @@ _gcry_mpih_divmod_1( mpi_ptr_t quot_ptr, * most significant bit (with weight 2**N) implicit. */ /* Special case for DIVISOR_LIMB == 100...000. */ - if( !(divisor_limb << 1) ) + if ( !(divisor_limb << 1) ) divisor_limb_inverted = ~(mpi_limb_t)0; else udiv_qrnnd(divisor_limb_inverted, dummy, @@ -440,7 +440,7 @@ _gcry_mpih_divmod_1( mpi_ptr_t quot_ptr, * | (dividend_ptr[dividend_size - 2] >> ...))) * ...one division less... */ - for( i = dividend_size - 2; i >= 0; i--) { + for ( i = dividend_size - 2; i >= 0; i--) { n0 = dividend_ptr[i]; UDIV_QRNND_PREINV( quot_ptr[i + 1], r, r, ((n1 << normalization_steps) @@ -461,7 +461,7 @@ _gcry_mpih_divmod_1( mpi_ptr_t quot_ptr, * most significant bit (with weight 2**N) implicit. */ /* Special case for DIVISOR_LIMB == 100...000. */ - if( !(divisor_limb << 1) ) + if ( !(divisor_limb << 1) ) divisor_limb_inverted = ~(mpi_limb_t) 0; else udiv_qrnnd(divisor_limb_inverted, dummy, @@ -470,12 +470,12 @@ _gcry_mpih_divmod_1( mpi_ptr_t quot_ptr, i = dividend_size - 1; r = dividend_ptr[i]; - if( r >= divisor_limb ) + if ( r >= divisor_limb ) r = 0; else quot_ptr[i--] = 0; - for( ; i >= 0; i-- ) { + for ( ; i >= 0; i-- ) { n0 = dividend_ptr[i]; UDIV_QRNND_PREINV( quot_ptr[i], r, r, n0, divisor_limb, divisor_limb_inverted); @@ -488,7 +488,7 @@ _gcry_mpih_divmod_1( mpi_ptr_t quot_ptr, int normalization_steps; count_leading_zeros (normalization_steps, divisor_limb); - if( normalization_steps ) { + if ( normalization_steps ) { divisor_limb <<= normalization_steps; n1 = dividend_ptr[dividend_size - 1]; @@ -500,7 +500,7 @@ _gcry_mpih_divmod_1( mpi_ptr_t quot_ptr, * | (dividend_ptr[dividend_size - 2] >> ...))) * ...one division less... */ - for( i = dividend_size - 2; i >= 0; i--) { + for ( i = dividend_size - 2; i >= 0; i--) { n0 = dividend_ptr[i]; udiv_qrnnd (quot_ptr[i + 1], r, r, ((n1 << normalization_steps) @@ -524,7 +524,7 @@ _gcry_mpih_divmod_1( mpi_ptr_t quot_ptr, else quot_ptr[i--] = 0; - for(; i >= 0; i--) { + for (; i >= 0; i--) { n0 = dividend_ptr[i]; udiv_qrnnd( quot_ptr[i], r, r, n0, divisor_limb ); } diff --git a/plugins/MirOTR/libgcrypt-1.4.6/mpi/mpih-mul.c b/plugins/MirOTR/libgcrypt-1.4.6/mpi/mpih-mul.c index e1f6f58eb5..d412b693fd 100644 --- a/plugins/MirOTR/libgcrypt-1.4.6/mpi/mpih-mul.c +++ b/plugins/MirOTR/libgcrypt-1.4.6/mpi/mpih-mul.c @@ -35,7 +35,7 @@ #define MPN_MUL_N_RECURSE(prodp, up, vp, size, tspace) \ do { \ - if( (size) < KARATSUBA_THRESHOLD ) \ + if ( (size) < KARATSUBA_THRESHOLD ) \ mul_n_basecase (prodp, up, vp, size); \ else \ mul_n (prodp, up, vp, size, tspace); \ @@ -80,8 +80,8 @@ mul_n_basecase( mpi_ptr_t prodp, mpi_ptr_t up, /* Multiply by the first limb in V separately, as the result can be * stored (not added) to PROD. We also avoid a loop for zeroing. */ v_limb = vp[0]; - if( v_limb <= 1 ) { - if( v_limb == 1 ) + if ( v_limb <= 1 ) { + if ( v_limb == 1 ) MPN_COPY( prodp, up, size ); else MPN_ZERO( prodp, size ); @@ -95,11 +95,11 @@ mul_n_basecase( mpi_ptr_t prodp, mpi_ptr_t up, /* For each iteration in the outer loop, multiply one limb from * U with one limb from V, and add it to PROD. */ - for( i = 1; i < size; i++ ) { + for ( i = 1; i < size; i++ ) { v_limb = vp[i]; - if( v_limb <= 1 ) { + if ( v_limb <= 1 ) { cy = 0; - if( v_limb == 1 ) + if ( v_limb == 1 ) cy = _gcry_mpih_add_n(prodp, prodp, up, size); } else @@ -117,7 +117,7 @@ static void mul_n( mpi_ptr_t prodp, mpi_ptr_t up, mpi_ptr_t vp, mpi_size_t size, mpi_ptr_t tspace ) { - if( size & 1 ) { + if ( size & 1 ) { /* The size is odd, and the code below doesn't handle that. * Multiply the least significant (size - 1) limbs with a recursive * call, and handle the most significant limb of S1 and S2 @@ -167,7 +167,7 @@ mul_n( mpi_ptr_t prodp, mpi_ptr_t up, mpi_ptr_t vp, /* Product M. ________________ * |_(U1-U0)(V0-V1)_| */ - if( _gcry_mpih_cmp(up + hsize, up, hsize) >= 0 ) { + if ( _gcry_mpih_cmp(up + hsize, up, hsize) >= 0 ) { _gcry_mpih_sub_n(prodp, up + hsize, up, hsize); negflg = 0; } @@ -175,7 +175,7 @@ mul_n( mpi_ptr_t prodp, mpi_ptr_t up, mpi_ptr_t vp, _gcry_mpih_sub_n(prodp, up, up + hsize, hsize); negflg = 1; } - if( _gcry_mpih_cmp(vp + hsize, vp, hsize) >= 0 ) { + if ( _gcry_mpih_cmp(vp + hsize, vp, hsize) >= 0 ) { _gcry_mpih_sub_n(prodp + hsize, vp + hsize, vp, hsize); negflg ^= 1; } @@ -211,12 +211,12 @@ mul_n( mpi_ptr_t prodp, mpi_ptr_t up, mpi_ptr_t vp, /* Add/copy Product L (twice) */ cy += _gcry_mpih_add_n(prodp + hsize, prodp + hsize, tspace, size); - if( cy ) + if ( cy ) _gcry_mpih_add_1(prodp + hsize + size, prodp + hsize + size, hsize, cy); MPN_COPY(prodp, tspace, hsize); cy = _gcry_mpih_add_n(prodp + hsize, prodp + hsize, tspace + hsize, hsize); - if( cy ) + if ( cy ) _gcry_mpih_add_1(prodp + size, prodp + size, size, 1); } } @@ -232,8 +232,8 @@ _gcry_mpih_sqr_n_basecase( mpi_ptr_t prodp, mpi_ptr_t up, mpi_size_t size ) /* Multiply by the first limb in V separately, as the result can be * stored (not added) to PROD. We also avoid a loop for zeroing. */ v_limb = up[0]; - if( v_limb <= 1 ) { - if( v_limb == 1 ) + if ( v_limb <= 1 ) { + if ( v_limb == 1 ) MPN_COPY( prodp, up, size ); else MPN_ZERO(prodp, size); @@ -247,11 +247,11 @@ _gcry_mpih_sqr_n_basecase( mpi_ptr_t prodp, mpi_ptr_t up, mpi_size_t size ) /* For each iteration in the outer loop, multiply one limb from * U with one limb from V, and add it to PROD. */ - for( i=1; i < size; i++) { + for ( i=1; i < size; i++) { v_limb = up[i]; - if( v_limb <= 1 ) { + if ( v_limb <= 1 ) { cy_limb = 0; - if( v_limb == 1 ) + if ( v_limb == 1 ) cy_limb = _gcry_mpih_add_n(prodp, prodp, up, size); } else @@ -267,7 +267,7 @@ void _gcry_mpih_sqr_n( mpi_ptr_t prodp, mpi_ptr_t up, mpi_size_t size, mpi_ptr_t tspace) { - if( size & 1 ) { + if ( size & 1 ) { /* The size is odd, and the code below doesn't handle that. * Multiply the least significant (size - 1) limbs with a recursive * call, and handle the most significant limb of S1 and S2 @@ -302,7 +302,7 @@ _gcry_mpih_sqr_n( mpi_ptr_t prodp, /* Product M. ________________ * |_(U1-U0)(U0-U1)_| */ - if( _gcry_mpih_cmp( up + hsize, up, hsize) >= 0 ) + if ( _gcry_mpih_cmp( up + hsize, up, hsize) >= 0 ) _gcry_mpih_sub_n( prodp, up + hsize, up, hsize); else _gcry_mpih_sub_n (prodp, up, up + hsize, hsize); @@ -329,13 +329,13 @@ _gcry_mpih_sqr_n( mpi_ptr_t prodp, /* Add/copy Product L (twice). */ cy += _gcry_mpih_add_n (prodp + hsize, prodp + hsize, tspace, size); - if( cy ) + if ( cy ) _gcry_mpih_add_1(prodp + hsize + size, prodp + hsize + size, hsize, cy); MPN_COPY(prodp, tspace, hsize); cy = _gcry_mpih_add_n (prodp + hsize, prodp + hsize, tspace + hsize, hsize); - if( cy ) + if ( cy ) _gcry_mpih_add_1 (prodp + size, prodp + size, size, 1); } } @@ -348,8 +348,8 @@ _gcry_mpih_mul_n( mpi_ptr_t prodp, { int secure; - if( up == vp ) { - if( size < KARATSUBA_THRESHOLD ) + if ( up == vp ) { + if ( size < KARATSUBA_THRESHOLD ) _gcry_mpih_sqr_n_basecase( prodp, up, size ); else { mpi_ptr_t tspace; @@ -360,7 +360,7 @@ _gcry_mpih_mul_n( mpi_ptr_t prodp, } } else { - if( size < KARATSUBA_THRESHOLD ) + if ( size < KARATSUBA_THRESHOLD ) mul_n_basecase( prodp, up, vp, size ); else { mpi_ptr_t tspace; @@ -382,8 +382,8 @@ _gcry_mpih_mul_karatsuba_case( mpi_ptr_t prodp, { mpi_limb_t cy; - if( !ctx->tspace || ctx->tspace_size < vsize ) { - if( ctx->tspace ) + if ( !ctx->tspace || ctx->tspace_size < vsize ) { + if ( ctx->tspace ) _gcry_mpi_free_limb_space( ctx->tspace, ctx->tspace_nlimbs ); ctx->tspace_nlimbs = 2 * vsize; ctx->tspace = mpi_alloc_limb_space( 2 * vsize, @@ -397,9 +397,9 @@ _gcry_mpih_mul_karatsuba_case( mpi_ptr_t prodp, prodp += vsize; up += vsize; usize -= vsize; - if( usize >= vsize ) { - if( !ctx->tp || ctx->tp_size < vsize ) { - if( ctx->tp ) + if ( usize >= vsize ) { + if ( !ctx->tp || ctx->tp_size < vsize ) { + if ( ctx->tp ) _gcry_mpi_free_limb_space( ctx->tp, ctx->tp_nlimbs ); ctx->tp_nlimbs = 2 * vsize; ctx->tp = mpi_alloc_limb_space( 2 * vsize, gcry_is_secure( up ) @@ -417,12 +417,12 @@ _gcry_mpih_mul_karatsuba_case( mpi_ptr_t prodp, } while( usize >= vsize ); } - if( usize ) { - if( usize < KARATSUBA_THRESHOLD ) { + if ( usize ) { + if ( usize < KARATSUBA_THRESHOLD ) { _gcry_mpih_mul( ctx->tspace, vp, vsize, up, usize ); } else { - if( !ctx->next ) { + if ( !ctx->next ) { ctx->next = gcry_xcalloc( 1, sizeof *ctx ); } _gcry_mpih_mul_karatsuba_case( ctx->tspace, @@ -442,15 +442,15 @@ _gcry_mpih_release_karatsuba_ctx( struct karatsuba_ctx *ctx ) { struct karatsuba_ctx *ctx2; - if( ctx->tp ) + if ( ctx->tp ) _gcry_mpi_free_limb_space( ctx->tp, ctx->tp_nlimbs ); - if( ctx->tspace ) + if ( ctx->tspace ) _gcry_mpi_free_limb_space( ctx->tspace, ctx->tspace_nlimbs ); - for( ctx=ctx->next; ctx; ctx = ctx2 ) { + for ( ctx=ctx->next; ctx; ctx = ctx2 ) { ctx2 = ctx->next; - if( ctx->tp ) + if ( ctx->tp ) _gcry_mpi_free_limb_space( ctx->tp, ctx->tp_nlimbs ); - if( ctx->tspace ) + if ( ctx->tspace ) _gcry_mpi_free_limb_space( ctx->tspace, ctx->tspace_nlimbs ); gcry_free( ctx ); } @@ -479,18 +479,18 @@ _gcry_mpih_mul( mpi_ptr_t prodp, mpi_ptr_t up, mpi_size_t usize, mpi_limb_t cy; struct karatsuba_ctx ctx; - if( vsize < KARATSUBA_THRESHOLD ) { + if ( vsize < KARATSUBA_THRESHOLD ) { mpi_size_t i; mpi_limb_t v_limb; - if( !vsize ) + if ( !vsize ) return 0; /* Multiply by the first limb in V separately, as the result can be * stored (not added) to PROD. We also avoid a loop for zeroing. */ v_limb = vp[0]; - if( v_limb <= 1 ) { - if( v_limb == 1 ) + if ( v_limb <= 1 ) { + if ( v_limb == 1 ) MPN_COPY( prodp, up, usize ); else MPN_ZERO( prodp, usize ); @@ -504,11 +504,11 @@ _gcry_mpih_mul( mpi_ptr_t prodp, mpi_ptr_t up, mpi_size_t usize, /* For each iteration in the outer loop, multiply one limb from * U with one limb from V, and add it to PROD. */ - for( i = 1; i < vsize; i++ ) { + for ( i = 1; i < vsize; i++ ) { v_limb = vp[i]; - if( v_limb <= 1 ) { + if ( v_limb <= 1 ) { cy = 0; - if( v_limb == 1 ) + if ( v_limb == 1 ) cy = _gcry_mpih_add_n(prodp, prodp, up, usize); } else diff --git a/plugins/MirOTR/libgcrypt-1.4.6/mpi/mpiutil.c b/plugins/MirOTR/libgcrypt-1.4.6/mpi/mpiutil.c index 4dc5211360..dcff1e8a0a 100644 --- a/plugins/MirOTR/libgcrypt-1.4.6/mpi/mpiutil.c +++ b/plugins/MirOTR/libgcrypt-1.4.6/mpi/mpiutil.c @@ -211,7 +211,7 @@ gcry_mpi_set_opaque( gcry_mpi_t a, void *p, unsigned int nbits ) if (!a) a = mpi_alloc(0); - if( a->flags & 4 ) + if ( a->flags & 4 ) gcry_free( a->d ); else _gcry_mpi_free_limb_space (a->d, a->alloced); @@ -228,9 +228,9 @@ gcry_mpi_set_opaque( gcry_mpi_t a, void *p, unsigned int nbits ) void * gcry_mpi_get_opaque( gcry_mpi_t a, unsigned int *nbits ) { - if( !(a->flags & 4) ) + if ( !(a->flags & 4) ) log_bug("mpi_get_opaque on normal mpi\n"); - if( nbits ) + if ( nbits ) *nbits = a->sign; return a->d; } @@ -246,13 +246,13 @@ gcry_mpi_copy( gcry_mpi_t a ) int i; gcry_mpi_t b; - if( a && (a->flags & 4) ) { + if ( a && (a->flags & 4) ) { void *p = gcry_is_secure(a->d)? gcry_xmalloc_secure( (a->sign+7)/8 ) : gcry_xmalloc( (a->sign+7)/8 ); memcpy( p, a->d, (a->sign+7)/8 ); b = gcry_mpi_set_opaque( NULL, p, a->sign ); } - else if( a ) { + else if ( a ) { b = mpi_is_secure(a)? mpi_alloc_secure( a->nlimbs ) : mpi_alloc( a->nlimbs ); b->nlimbs = a->nlimbs; @@ -277,14 +277,14 @@ _gcry_mpi_alloc_like( gcry_mpi_t a ) { gcry_mpi_t b; - if( a && (a->flags & 4) ) { + if ( a && (a->flags & 4) ) { int n = (a->sign+7)/8; void *p = gcry_is_secure(a->d)? gcry_malloc_secure( n ) : gcry_malloc( n ); memcpy( p, a->d, n ); b = gcry_mpi_set_opaque( NULL, p, a->sign ); } - else if( a ) { + else if ( a ) { b = mpi_is_secure(a)? mpi_alloc_secure( a->nlimbs ) : mpi_alloc( a->nlimbs ); b->nlimbs = 0; |