diff options
author | Werner Koch <[email protected]> | 1998-04-09 11:19:09 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 1998-04-09 11:19:09 +0000 |
commit | 3c7368a33d5fe4f7e865e5e320d2d628db4f845b (patch) | |
tree | 8fdd05880ed9547ea7166e4b9b93ad336da61d72 /mpi | |
parent | test release (diff) | |
download | gnupg-3c7368a33d5fe4f7e865e5e320d2d628db4f845b.tar.gz gnupg-3c7368a33d5fe4f7e865e5e320d2d628db4f845b.zip |
new releaseV0-2-15
Diffstat (limited to 'mpi')
-rw-r--r-- | mpi/ChangeLog | 4 | ||||
-rw-r--r-- | mpi/mpicoder.c | 20 |
2 files changed, 21 insertions, 3 deletions
diff --git a/mpi/ChangeLog b/mpi/ChangeLog index 0a967df48..a39884d8d 100644 --- a/mpi/ChangeLog +++ b/mpi/ChangeLog @@ -1,3 +1,7 @@ +Thu Apr 9 11:31:36 1998 Werner Koch ([email protected]) + + * mpicoder.c (mpi_get_secure_buffer): New. + Wed Apr 8 09:44:33 1998 Werner Koch ([email protected]) * config.links: Applied small fix from Ulf M�ller. diff --git a/mpi/mpicoder.c b/mpi/mpicoder.c index 9362aff65..a4b1c2095 100644 --- a/mpi/mpicoder.c +++ b/mpi/mpicoder.c @@ -268,8 +268,8 @@ mpi_get_keyid( MPI a, u32 *keyid ) * set to zero if the value of A is zero. If sign is not NULL, it will * be set to the sign of the A. */ -byte * -mpi_get_buffer( MPI a, unsigned *nbytes, int *sign ) +static byte * +do_get_buffer( MPI a, unsigned *nbytes, int *sign, int force_secure ) { byte *p, *buffer; mpi_limb_t alimb; @@ -278,7 +278,8 @@ mpi_get_buffer( MPI a, unsigned *nbytes, int *sign ) if( sign ) *sign = a->sign; *nbytes = a->nlimbs * BYTES_PER_MPI_LIMB; - p = buffer = a->secure ? m_alloc_secure( *nbytes) : m_alloc( *nbytes ); + p = buffer = force_secure || a->secure ? m_alloc_secure( *nbytes) + : m_alloc( *nbytes ); for(i=a->nlimbs-1; i >= 0; i-- ) { alimb = a->d[i]; @@ -310,6 +311,19 @@ mpi_get_buffer( MPI a, unsigned *nbytes, int *sign ) return buffer; } + +byte * +mpi_get_buffer( MPI a, unsigned *nbytes, int *sign ) +{ + return do_get_buffer( a, nbytes, sign, 0 ); +} + +byte * +mpi_get_secure_buffer( MPI a, unsigned *nbytes, int *sign ) +{ + return do_get_buffer( a, nbytes, sign, 1 ); +} + /**************** * Use BUFFER to update MPI. */ |