diff options
author | Werner Koch <wk@gnupg.org> | 1999-12-31 14:02:40 +0100 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 1999-12-31 14:02:40 +0100 |
commit | 704eb738c063d420fa9643bad9d6f692869603a5 (patch) | |
tree | 8333b53eeb0d7b003b89a598b3531a81086ad4f9 /mpi | |
parent | See ChangeLog: Fri Dec 31 12:48:31 CET 1999 Werner Koch (diff) | |
download | gnupg2-704eb738c063d420fa9643bad9d6f692869603a5.tar.xz gnupg2-704eb738c063d420fa9643bad9d6f692869603a5.zip |
See ChangeLog: Fri Dec 31 14:06:56 CET 1999 Werner Koch
Diffstat (limited to 'mpi')
-rw-r--r-- | mpi/ChangeLog | 11 | ||||
-rw-r--r-- | mpi/mpi-bit.c | 5 | ||||
-rw-r--r-- | mpi/mpiutil.c | 41 |
3 files changed, 52 insertions, 5 deletions
diff --git a/mpi/ChangeLog b/mpi/ChangeLog index 2a85de0e2..125fa1a68 100644 --- a/mpi/ChangeLog +++ b/mpi/ChangeLog @@ -1,3 +1,14 @@ +Fri Dec 31 14:06:56 CET 1999 Werner Koch <wk@gnupg.de> + + * mpi-bit.c (gcry_mpi_get_nbits): New. + + * mpiutil.c (mpi_set_secure): made static. + (gcry_mpi_get_flag): New. + (gcry_mpi_set_flag): New. + (gcry_mpi_clear_flag): New. + (mpi_set_opaque): renamed to gcry_mpi_set_opaque. + (mpi_get_opaque): renamed to gcry_mpi_get_opaque. + Fri Dec 31 12:48:31 CET 1999 Werner Koch <wk@gnupg.de> * mpicoder.c (mpi_read_from_buffer): Made static. diff --git a/mpi/mpi-bit.c b/mpi/mpi-bit.c index 45ca029ed..b79505f48 100644 --- a/mpi/mpi-bit.c +++ b/mpi/mpi-bit.c @@ -90,6 +90,11 @@ mpi_get_nbits( MPI a ) return n; } +unsigned int +gcry_mpi_get_nbits( MPI a ) +{ + return mpi_get_nbits( a ); +} /**************** * Test whether bit N is set. diff --git a/mpi/mpiutil.c b/mpi/mpiutil.c index 381db4804..58d06970d 100644 --- a/mpi/mpiutil.c +++ b/mpi/mpiutil.c @@ -159,7 +159,7 @@ mpi_free( MPI a ) g10_free(a); } -void +static void mpi_set_secure( MPI a ) { mpi_ptr_t ap, bp; @@ -180,7 +180,7 @@ mpi_set_secure( MPI a ) MPI -mpi_set_opaque( MPI a, void *p, unsigned int nbits ) +gcry_mpi_set_opaque( MPI a, void *p, unsigned int nbits ) { if( !a ) { a = mpi_alloc(0); @@ -202,7 +202,7 @@ mpi_set_opaque( MPI a, void *p, unsigned int nbits ) void * -mpi_get_opaque( MPI a, unsigned int *nbits ) +gcry_mpi_get_opaque( MPI a, unsigned int *nbits ) { if( !(a->flags & 4) ) log_bug("mpi_get_opaque on normal mpi\n"); @@ -226,7 +226,7 @@ mpi_copy( MPI a ) void *p = g10_is_secure(a->d)? g10_xmalloc_secure( (a->sign+7)/8 ) : g10_xmalloc( (a->sign+7)/8 ); memcpy( p, a->d, (a->sign+7)/8 ); - b = mpi_set_opaque( NULL, p, a->sign ); + b = gcry_mpi_set_opaque( NULL, p, a->sign ); } else if( a ) { b = mpi_is_secure(a)? mpi_alloc_secure( a->nlimbs ) @@ -258,7 +258,7 @@ mpi_alloc_like( MPI a ) void *p = g10_is_secure(a->d)? g10_malloc_secure( n ) : g10_malloc( n ); memcpy( p, a->d, n ); - b = mpi_set_opaque( NULL, p, a->sign ); + b = gcry_mpi_set_opaque( NULL, p, a->sign ); } else if( a ) { b = mpi_is_secure(a)? mpi_alloc_secure( a->nlimbs ) @@ -389,3 +389,34 @@ gcry_mpi_randomize( GCRY_MPI w, } +void +gcry_mpi_set_flag( GCRY_MPI a, enum gcry_mpi_flag flag ) +{ + switch( flag ) { + case GCRYMPI_FLAG_SECURE: mpi_set_secure(a); break; + case GCRYMPI_FLAG_OPAQUE: + default: log_bug("invalid flag value\n"); + } +} + +void +gcry_mpi_clear_flag( GCRY_MPI a, enum gcry_mpi_flag flag ) +{ + switch( flag ) { + case GCRYMPI_FLAG_SECURE: + case GCRYMPI_FLAG_OPAQUE: + default: log_bug("invalid flag value\n"); + } +} + +int +gcry_mpi_get_flag( GCRY_MPI a, enum gcry_mpi_flag flag ) +{ + switch( flag ) { + case GCRYMPI_FLAG_SECURE: return (a->flags & 1); + case GCRYMPI_FLAG_OPAQUE: return (a->flags & 4); + default: log_bug("invalid flag value\n"); + } +} + + |