diff options
author | Werner Koch <wk@gnupg.org> | 1999-06-01 16:08:57 +0200 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 1999-06-01 16:08:57 +0200 |
commit | 3dddf602dd95863dab344486534874b4b561bd3d (patch) | |
tree | 322e4f944eb596a22af9fc4d98f2f000117672a7 /mpi | |
parent | See ChangeLog: Mon May 31 19:41:10 CEST 1999 Werner Koch (diff) | |
download | gnupg2-3dddf602dd95863dab344486534874b4b561bd3d.tar.xz gnupg2-3dddf602dd95863dab344486534874b4b561bd3d.zip |
See ChangeLog: Tue Jun 1 16:01:46 CEST 1999 Werner Koch
Diffstat (limited to 'mpi')
-rw-r--r-- | mpi/ChangeLog | 4 | ||||
-rw-r--r-- | mpi/config.links | 4 | ||||
-rw-r--r-- | mpi/mpiutil.c | 58 |
3 files changed, 62 insertions, 4 deletions
diff --git a/mpi/ChangeLog b/mpi/ChangeLog index db2d7025e..959f3b48c 100644 --- a/mpi/ChangeLog +++ b/mpi/ChangeLog @@ -1,3 +1,7 @@ +Tue Jun 1 16:01:46 CEST 1999 Werner Koch <wk@isil.d.shuttle.de> + + * config.links (i[56]86*-*-freebsdelf*): New. + Sun May 23 14:20:22 CEST 1999 Werner Koch <wk@isil.d.shuttle.de> * config.links (sysdep.h): Not any more conditionally created. diff --git a/mpi/config.links b/mpi/config.links index 4caf2b8d6..376d42b71 100644 --- a/mpi/config.links +++ b/mpi/config.links @@ -12,12 +12,12 @@ echo '/* created by config.links - do not edit */' >./mpi/asm-syntax.h if test "$try_asm_modules" = "yes" ; then case "${target}" in - i[34]86*-*-freebsd*-elf | i[34]86*-*-freebsd[34]*) + i[34]86*-*-freebsd*-elf | i[34]86*-*-freebsd[34]* | i[34]86*-*-freebsdelf*) echo '#define ELF_SYNTAX' >>./mpi/asm-syntax.h cat $srcdir/mpi/i386/syntax.h >>./mpi/asm-syntax.h path="i386" ;; - i[56]86*-*-freebsd*-elf | i[56]86*-*-freebsd[34]*) + i[56]86*-*-freebsd*-elf | i[56]86*-*-freebsd[34]* | i[56]86*-*-freebsdelf*) echo '#define ELF_SYNTAX' >>./mpi/asm-syntax.h cat $srcdir/mpi/i386/syntax.h >>./mpi/asm-syntax.h path="i586 i386" diff --git a/mpi/mpiutil.c b/mpi/mpiutil.c index cbbe10d25..62cb882d6 100644 --- a/mpi/mpiutil.c +++ b/mpi/mpiutil.c @@ -103,6 +103,12 @@ mpi_alloc_secure( unsigned nlimbs ) } +#if 0 +static void *unused_limbs_5; +static void *unused_limbs_32; +static void *unused_limbs_64; +#endif + mpi_ptr_t #ifdef M_DEBUG mpi_debug_alloc_limb_space( unsigned nlimbs, int secure, const char *info ) @@ -111,14 +117,37 @@ mpi_alloc_limb_space( unsigned nlimbs, int secure ) #endif { size_t len = nlimbs * sizeof(mpi_limb_t); + mpi_ptr_t p; if( DBG_MEMORY ) log_debug("mpi_alloc_limb_space(%u)\n", (unsigned)len*8 ); + #if 0 + if( !secure ) { + if( nlimbs == 5 && unused_limbs_5 ) { /* DSA 160 bits */ + p = unused_limbs_5; + unused_limbs_5 = *p; + return p; + } + else if( nlimbs == 32 && unused_limbs_32 ) { /* DSA 1024 bits */ + p = unused_limbs_32; + unused_limbs_32 = *p; + return p; + } + else if( nlimbs == 64 && unused_limbs_64 ) { /* DSA 2*1024 bits */ + p = unused_limbs_64; + unused_limbs_64 = *p; + return p; + } + } + #endif + #ifdef M_DEBUG - return secure? m_debug_alloc_secure(len, info):m_debug_alloc( len, info ); + p = secure? m_debug_alloc_secure(len, info):m_debug_alloc( len, info ); #else - return secure? m_alloc_secure( len ):m_alloc( len ); + p = secure? m_alloc_secure( len ):m_alloc( len ); #endif + + return p; } void @@ -132,6 +161,31 @@ mpi_free_limb_space( mpi_ptr_t a ) return; if( DBG_MEMORY ) log_debug("mpi_free_limb_space of size %lu\n", (ulong)m_size(a)*8 ); + + #if 0 + if( !m_is_secure(a) ) { + size_t nlimbs = m_size(a) / 4 ; + void *p = a; + + if( nlimbs == 5 ) { /* DSA 160 bits */ + *a = unused_limbs_5; + unused_limbs_5 = a; + return; + } + else if( nlimbs == 32 ) { /* DSA 1024 bits */ + *a = unused_limbs_32; + unused_limbs_32 = a; + return; + } + else if( nlimbs == 64 ) { /* DSA 2*1024 bits */ + *a = unused_limbs_64; + unused_limbs_64 = a; + return; + } + } + #endif + + m_free(a); } |