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/mpi-mul.c | |
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/mpi-mul.c')
-rw-r--r-- | plugins/MirOTR/libgcrypt-1.4.6/mpi/mpi-mul.c | 32 |
1 files changed, 16 insertions, 16 deletions
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); } |