diff options
author | Werner Koch <[email protected]> | 1999-01-07 17:05:48 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 1999-01-07 17:05:48 +0000 |
commit | 7d0efec7cf5ae110c99511abc32587ff0c45b14f (patch) | |
tree | c25f43c0b175ca31c84da4e9a256b259ea070fc7 /mpi/mpi-bit.c | |
parent | See ChangeLog: Sun Jan 3 15:28:44 CET 1999 Werner Koch (diff) | |
download | gnupg-7d0efec7cf5ae110c99511abc32587ff0c45b14f.tar.gz gnupg-7d0efec7cf5ae110c99511abc32587ff0c45b14f.zip |
See ChangeLog: Thu Jan 7 18:00:58 CET 1999 Werner Koch
Diffstat (limited to 'mpi/mpi-bit.c')
-rw-r--r-- | mpi/mpi-bit.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/mpi/mpi-bit.c b/mpi/mpi-bit.c index 8ca5c57dd..227a929bb 100644 --- a/mpi/mpi-bit.c +++ b/mpi/mpi-bit.c @@ -48,7 +48,19 @@ __clz_tab[] = #define A_LIMB_1 ((mpi_limb_t)1) +/**************** + * Sometimes we have MSL (most significant limbs) which are 0; + * this is for some reasons not good, so this function removes them. + */ +void +mpi_normalize( MPI a ) +{ + if( mpi_is_protected(a) ) + return; + for( ; a->nlimbs && !a->d[a->nlimbs-1]; a->nlimbs-- ) + ; +} @@ -67,6 +79,7 @@ mpi_get_nbits( MPI a ) return n; } + mpi_normalize( a ); if( a->nlimbs ) { mpi_limb_t alimb = a->d[a->nlimbs-1]; if( alimb ) |