mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
See ChangeLog: Fri Dec 31 14:06:56 CET 1999 Werner Koch
This commit is contained in:
parent
ed0b0e09d3
commit
704eb738c0
@ -596,7 +596,7 @@ main( int argc, char **argv )
|
||||
log_set_name("gpg");
|
||||
/* check that the libraries are suitable. Do it here because
|
||||
* the option parse may need services of the library */
|
||||
if ( !gcry_check_version ( "1.1.1" ) ) {
|
||||
if ( !gcry_check_version ( "1.1.0a" ) ) {
|
||||
log_fatal(_("libgcrypt is too old (need %s, have %s)\n"),
|
||||
VERSION, gcry_check_version(NULL) );
|
||||
}
|
||||
|
@ -330,7 +330,7 @@ protect_secret_key( PKT_secret_key *sk, DEK *dek )
|
||||
csum += checksum_mpi( sk->skey[i] );
|
||||
buffer = mpi_get_buffer( sk->skey[i], &nbytes, NULL );
|
||||
gcry_cipher_sync( cipher_hd );
|
||||
assert( !mpi_is_opaque(sk->skey[i]) );
|
||||
assert( !gcry_mpi_get_flag( sk->skey[i], GCRYMPI_FLAG_OPAQUE ) );
|
||||
gcry_cipher_encrypt( cipher_hd, buffer, nbytes, NULL, 0 );
|
||||
mpi_set_buffer( sk->skey[i], buffer, nbytes, 0 );
|
||||
m_free( buffer );
|
||||
|
@ -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.
|
||||
|
@ -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.
|
||||
|
@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -38,7 +38,7 @@
|
||||
#include "util.h"
|
||||
|
||||
/* FXIME: ugly hack. Need a prototype here but can't include g10lib.h */
|
||||
int g10_private_is_secure( void *p );
|
||||
int g10_private_is_secure( const void *p );
|
||||
|
||||
|
||||
#define MAGIC_NOR_BYTE 0x55
|
||||
|
Loading…
x
Reference in New Issue
Block a user