summaryrefslogtreecommitdiffstats
path: root/mpi
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>1999-04-18 10:18:52 +0200
committerWerner Koch <wk@gnupg.org>1999-04-18 10:18:52 +0200
commit1feae2011ccd122ffb9a8f28013a13e57fc0b4fd (patch)
tree981a2000ffe3b4349bf3f2b8dbe845a60c15c95a /mpi
parentSee ChangeLog: Fri Apr 9 12:26:25 CEST 1999 Werner Koch (diff)
downloadgnupg2-1feae2011ccd122ffb9a8f28013a13e57fc0b4fd.tar.xz
gnupg2-1feae2011ccd122ffb9a8f28013a13e57fc0b4fd.zip
See ChangeLog: Sun Apr 18 10:11:28 CEST 1999 Werner Koch
Diffstat (limited to 'mpi')
-rw-r--r--mpi/ChangeLog5
-rw-r--r--mpi/mpi-pow.c3
-rw-r--r--mpi/mpih-mul.c19
-rw-r--r--mpi/mpiutil.c8
4 files changed, 23 insertions, 12 deletions
diff --git a/mpi/ChangeLog b/mpi/ChangeLog
index c4e214e08..95f0e4055 100644
--- a/mpi/ChangeLog
+++ b/mpi/ChangeLog
@@ -1,3 +1,8 @@
+Sun Apr 18 10:11:28 CEST 1999 Werner Koch <wk@isil.d.shuttle.de>
+
+ * mpih-mul.c (mpihelp_mul_n): Fixed use of memory region.
+ (mpihelp_mul): Ditto.
+
Wed Apr 7 20:51:39 CEST 1999 Werner Koch <wk@isil.d.shuttle.de>
* Makefile.am: Explicit rules to invoke cpp on *.S
diff --git a/mpi/mpi-pow.c b/mpi/mpi-pow.c
index 96a1218d9..e8d55f9b9 100644
--- a/mpi/mpi-pow.c
+++ b/mpi/mpi-pow.c
@@ -52,7 +52,8 @@ mpi_powm( MPI res, MPI base, MPI exp, MPI mod)
mpi_ptr_t xp_marker=NULL;
int assign_rp=0;
mpi_ptr_t tspace = NULL;
- mpi_size_t tsize=0; /* to avoid compiler warning, fixme: check */
+ mpi_size_t tsize=0; /* to avoid compiler warning */
+ /* fixme: we should check that the warning is void*/
esize = exp->nlimbs;
msize = mod->nlimbs;
diff --git a/mpi/mpih-mul.c b/mpi/mpih-mul.c
index b457a0b5f..7707c0e30 100644
--- a/mpi/mpih-mul.c
+++ b/mpi/mpih-mul.c
@@ -1,6 +1,5 @@
/* mpihelp-mul.c - MPI helper functions
- * Copyright (C) 1998 Free Software Foundation, Inc.
- * Copyright (C) 1994, 1996 Free Software Foundation, Inc.
+ * Copyright (C) 1994, 1996, 1998, 1999 Free Software Foundation, Inc.
*
* This file is part of GnuPG.
*
@@ -346,14 +345,15 @@ mpih_sqr_n( mpi_ptr_t prodp, mpi_ptr_t up, mpi_size_t size, mpi_ptr_t tspace)
void
mpihelp_mul_n( mpi_ptr_t prodp, mpi_ptr_t up, mpi_ptr_t vp, mpi_size_t size)
{
- /* FIXME: mpi_alloc_limb_space, secure arg is wrong! */
+ int secure;
if( up == vp ) {
if( size < KARATSUBA_THRESHOLD )
mpih_sqr_n_basecase( prodp, up, size );
else {
mpi_ptr_t tspace;
- tspace = mpi_alloc_limb_space( 2 * size, 0 );
+ secure = m_is_secure( up );
+ tspace = mpi_alloc_limb_space( 2 * size, secure );
mpih_sqr_n( prodp, up, size, tspace );
mpi_free_limb_space( tspace );
}
@@ -363,7 +363,8 @@ mpihelp_mul_n( mpi_ptr_t prodp, mpi_ptr_t up, mpi_ptr_t vp, mpi_size_t size)
mul_n_basecase( prodp, up, vp, size );
else {
mpi_ptr_t tspace;
- tspace = mpi_alloc_limb_space( 2 * size, 0 );
+ secure = m_is_secure( up ) || m_is_secure( vp );
+ tspace = mpi_alloc_limb_space( 2 * size, secure );
mul_n (prodp, up, vp, size, tspace);
mpi_free_limb_space( tspace );
}
@@ -436,16 +437,16 @@ mpihelp_mul( mpi_ptr_t prodp, mpi_ptr_t up, mpi_size_t usize,
return cy;
}
- /* FIXME: mpi_alloc_limb_space, secure arg is wrong! */
- tspace = mpi_alloc_limb_space( 2 * vsize, 0 );
+ tspace = mpi_alloc_limb_space( 2 * vsize,
+ m_is_secure( up ) || m_is_secure( vp ) );
MPN_MUL_N_RECURSE( prodp, up, vp, vsize, tspace );
prodp += vsize;
up += vsize;
usize -= vsize;
if( usize >= vsize ) {
- /* FIXME: mpi_alloc_limb_space, secure arg is wrong! */
- mpi_ptr_t tp = mpi_alloc_limb_space( 2 * vsize, 0 );
+ mpi_ptr_t tp = mpi_alloc_limb_space( 2 * vsize, m_is_secure( up )
+ || m_is_secure( vp ) );
do {
MPN_MUL_N_RECURSE( tp, up, vp, vsize, tspace );
cy = mpihelp_add_n( prodp, prodp, tp, vsize );
diff --git a/mpi/mpiutil.c b/mpi/mpiutil.c
index d90cd4d34..82ba87112 100644
--- a/mpi/mpiutil.c
+++ b/mpi/mpiutil.c
@@ -37,7 +37,7 @@
#endif
/****************
- * fixme: It was a bad idea to use the number of limbs to allocate
+ * Note: It was a bad idea to use the number of limbs to allocate
* because on a alpha the limbs are large but we normally need
* integers of n bits - So we should chnage this to bits (or bytes).
*
@@ -159,7 +159,11 @@ mpi_resize( MPI a, unsigned nlimbs )
{
if( nlimbs <= a->alloced )
return; /* no need to do it */
- /* FIXME: add realloc_secure based on a->secure */
+ /* Note: a->secure is not used - instead the realloc functions
+ * take care of it. Maybe we should drop a->secure completely
+ * and rely on a mpi_is_secure function, which would be
+ * a wrapper around m_is_secure
+ */
#ifdef M_DEBUG
if( a->d )
a->d = m_debug_realloc(a->d, nlimbs * sizeof(mpi_limb_t), info );