summaryrefslogtreecommitdiffstats
path: root/mpi
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>1998-07-06 12:23:57 +0200
committerWerner Koch <wk@gnupg.org>1998-07-06 12:23:57 +0200
commita9ec668cbe5b3335f5db0f05b8e9e88e29ada52c (patch)
treee159c79b615fcdcb65f31ee5d1d0a2b1ba84e9aa /mpi
parentpartly added creation of OP partial length headers (diff)
downloadgnupg2-a9ec668cbe5b3335f5db0f05b8e9e88e29ada52c.tar.xz
gnupg2-a9ec668cbe5b3335f5db0f05b8e9e88e29ada52c.zip
intermediate release
Diffstat (limited to 'mpi')
-rw-r--r--mpi/ChangeLog6
-rw-r--r--mpi/mpi-inv.c1
-rw-r--r--mpi/mpiutil.c10
3 files changed, 14 insertions, 3 deletions
diff --git a/mpi/ChangeLog b/mpi/ChangeLog
index a52381d05..babbabdf9 100644
--- a/mpi/ChangeLog
+++ b/mpi/ChangeLog
@@ -1,3 +1,9 @@
+Sat Jul 4 10:11:11 1998 Werner Koch (wk@isil.d.shuttle.de)
+
+ * mpiutil.c (mpi_clear): Reset flags.
+ (mpi_set): Ditto.
+ (mpi_alloc_secure): Set flag to 1 and not ored the 1 in, tsss..
+
Fri Jun 26 11:19:06 1998 Werner Koch (wk@isil.d.shuttle.de)
* mpiutil.c (mpi_alloc): set nbits to 0.
diff --git a/mpi/mpi-inv.c b/mpi/mpi-inv.c
index 2cea72811..25efbd979 100644
--- a/mpi/mpi-inv.c
+++ b/mpi/mpi-inv.c
@@ -167,6 +167,7 @@ mpi_invm( MPI x, MPI a, MPI n )
u = mpi_copy(a);
v = mpi_copy(n);
+
for(k=0; !mpi_test_bit(u,0) && !mpi_test_bit(v,0); k++ ) {
mpi_rshift(u, u, 1);
mpi_rshift(v, v, 1);
diff --git a/mpi/mpiutil.c b/mpi/mpiutil.c
index 231e5d578..c9af50561 100644
--- a/mpi/mpiutil.c
+++ b/mpi/mpiutil.c
@@ -94,7 +94,7 @@ mpi_alloc_secure( unsigned nlimbs )
a->d = nlimbs? mpi_alloc_limb_space( nlimbs, 1 ) : NULL;
#endif
a->alloced = nlimbs;
- a->flags |= 1;
+ a->flags = 1;
a->nlimbs = 0;
a->sign = 0;
a->nbits = 0;
@@ -178,6 +178,7 @@ mpi_clear( MPI a )
{
a->nlimbs = 0;
a->nbits = 0;
+ a->flags = 0;
}
@@ -197,7 +198,8 @@ mpi_free( MPI a )
#else
mpi_free_limb_space(a->d);
#endif
-
+ if( a->flags & ~3 )
+ log_bug("invalid flag value in mpi\n");
m_free(a);
}
@@ -231,7 +233,7 @@ mpi_set_secure( MPI a )
/****************
- * Note: This copy function shpould not interpret the MPI
+ * Note: This copy function should not interpret the MPI
* but copy it transparently.
*/
MPI
@@ -278,6 +280,7 @@ mpi_set( MPI w, MPI u)
MPN_COPY( wp, up, usize );
w->nlimbs = usize;
w->nbits = u->nbits;
+ w->flags = u->flags;
w->sign = usign;
}
@@ -290,6 +293,7 @@ mpi_set_ui( MPI w, unsigned long u)
w->nlimbs = u? 1:0;
w->sign = 0;
w->nbits = 0;
+ w->flags = 0;
}