1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-02 22:46:30 +02:00

See ChangeLog: Wed Dec 8 21:58:32 CET 1999 Werner Koch

This commit is contained in:
Werner Koch 1999-12-08 21:03:03 +00:00
parent 2694bceb45
commit 4555c0be94
74 changed files with 1573 additions and 954 deletions

View file

@ -1,3 +1,13 @@
Wed Dec 8 21:58:32 CET 1999 Werner Koch <wk@gnupg.de>
* dsa.c: s/mpi_powm/gcry_mpi_powm/g
* elgamal.c: Ditto.
* primegen.c: Ditto.
* : Replaced g10_opt_verbose by g10_log_verbosity().
* Makefile.am (INCLUDES): removed intl, add ../gcrypt
Fri Nov 19 17:15:20 CET 1999 Werner Koch <wk@gnupg.de>
* dynload.c (cmp_filenames): New to replaced compare_filename() in

View file

@ -1,7 +1,7 @@
## Process this file with automake to produce Makefile.in
INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/intl
INCLUDES = -I$(top_srcdir)/gcrypt
noinst_LTLIBRARIES = libcipher.la

View file

@ -193,7 +193,7 @@ load_cipher_modules(void)
continue;
}
/* put it into the table */
if( g10_opt_verbose > 1 )
if( g10_log_verbosity( 2 ) )
log_info("loaded cipher %d (%s)\n", ct->algo, name);
ct->name = name;
ct_idx++;

View file

@ -178,7 +178,7 @@ generate( DSA_secret_key *sk, unsigned nbits, MPI **ret_factors )
do {
mpi_add_ui( h, h, 1 );
/* g = h^e mod p */
mpi_powm( g, h, e, p );
gcry_mpi_powm( g, h, e, p );
} while( !mpi_cmp_ui( g, 1 ) ); /* continue until g != 1 */
/* select a random number which has these properties:
@ -212,7 +212,7 @@ generate( DSA_secret_key *sk, unsigned nbits, MPI **ret_factors )
/* y = g^x mod p */
y = mpi_alloc( mpi_get_nlimbs(p) );
mpi_powm( y, g, x, p );
gcry_mpi_powm( y, g, x, p );
if( DBG_CIPHER ) {
progress('\n');
@ -246,7 +246,7 @@ check_secret_key( DSA_secret_key *sk )
int rc;
MPI y = mpi_alloc( mpi_get_nlimbs(sk->y) );
mpi_powm( y, sk->g, sk->x, sk->p );
gcry_mpi_powm( y, sk->g, sk->x, sk->p );
rc = !mpi_cmp( y, sk->y );
mpi_free( y );
return rc;
@ -269,7 +269,7 @@ sign(MPI r, MPI s, MPI hash, DSA_secret_key *skey )
k = gen_k( skey->q );
/* r = (a^k mod p) mod q */
mpi_powm( r, skey->g, k, skey->p );
gcry_mpi_powm( r, skey->g, k, skey->p );
mpi_fdiv_r( r, r, skey->q );
/* kinv = k^(-1) mod q */

View file

@ -270,7 +270,7 @@ load_extension( EXTLIST el )
name = (char**)addr;
#endif
if( g10_opt_verbose > 1 )
if( g10_log_verbosity( 2 ) )
log_info("%s: %s%s%s%s\n", el->name, *name,
el->hintstr? " (":"",
el->hintstr? el->hintstr:"",
@ -301,7 +301,7 @@ load_extension( EXTLIST el )
#endif
#ifdef HAVE_DL_DLOPEN
if( g10_opt_verbose > 2 ) {
if( g10_log_verbosity( 3 ) ) {
/* list the contents of the module */
while( (sym = (*el->enumfunc)(0, &seq, &class, &vers)) ) {
if( vers != 1 ) {

View file

@ -229,7 +229,7 @@ generate( ELG_secret_key *sk, unsigned nbits, MPI **ret_factors )
g10_free(rndbuf);
y = mpi_alloc(nbits/BITS_PER_MPI_LIMB);
mpi_powm( y, g, x, p );
gcry_mpi_powm( y, g, x, p );
if( DBG_CIPHER ) {
progress('\n');
@ -263,7 +263,7 @@ check_secret_key( ELG_secret_key *sk )
int rc;
MPI y = mpi_alloc( mpi_get_nlimbs(sk->y) );
mpi_powm( y, sk->g, sk->x, sk->p );
gcry_mpi_powm( y, sk->g, sk->x, sk->p );
rc = !mpi_cmp( y, sk->y );
mpi_free( y );
return rc;
@ -281,13 +281,13 @@ encrypt(MPI a, MPI b, MPI input, ELG_public_key *pkey )
*/
k = gen_k( pkey->p );
mpi_powm( a, pkey->g, k, pkey->p );
gcry_mpi_powm( a, pkey->g, k, pkey->p );
/* b = (y^k * input) mod p
* = ((y^k mod p) * (input mod p)) mod p
* and because input is < p
* = ((y^k mod p) * input) mod p
*/
mpi_powm( b, pkey->y, k, pkey->p );
gcry_mpi_powm( b, pkey->y, k, pkey->p );
mpi_mulm( b, b, input, pkey->p );
#if 0
if( DBG_CIPHER ) {
@ -312,7 +312,7 @@ decrypt(MPI output, MPI a, MPI b, ELG_secret_key *skey )
/* output = b/(a^x) mod p */
mpi_powm( t1, a, skey->x, skey->p );
gcry_mpi_powm( t1, a, skey->x, skey->p );
mpi_invm( t1, t1, skey->p );
mpi_mulm( output, b, t1, skey->p );
#if 0
@ -348,7 +348,7 @@ sign(MPI a, MPI b, MPI input, ELG_secret_key *skey )
*/
mpi_sub_ui(p_1, p_1, 1);
k = gen_k( skey->p );
mpi_powm( a, skey->g, k, skey->p );
gcry_mpi_powm( a, skey->g, k, skey->p );
mpi_mul(t, skey->x, a );
mpi_subm(t, input, t, p_1 );
while( mpi_is_neg(t) ) {
@ -397,12 +397,12 @@ verify(MPI a, MPI b, MPI input, ELG_public_key *pkey )
#if 0
/* t1 = (y^a mod p) * (a^b mod p) mod p */
mpi_powm( t1, pkey->y, a, pkey->p );
mpi_powm( t2, a, b, pkey->p );
gcry_mpi_powm( t1, pkey->y, a, pkey->p );
gcry_mpi_powm( t2, a, b, pkey->p );
mpi_mulm( t1, t1, t2, pkey->p );
/* t2 = g ^ input mod p */
mpi_powm( t2, pkey->g, input, pkey->p );
gcry_mpi_powm( t2, pkey->g, input, pkey->p );
rc = !mpi_cmp( t1, t2 );
#elif 0
@ -413,7 +413,7 @@ verify(MPI a, MPI b, MPI input, ELG_public_key *pkey )
mpi_mulpowm( t1, base, exp, pkey->p );
/* t2 = g ^ input mod p */
mpi_powm( t2, pkey->g, input, pkey->p );
gcry_mpi_powm( t2, pkey->g, input, pkey->p );
rc = !mpi_cmp( t1, t2 );
#else

View file

@ -157,7 +157,7 @@ load_digest_module( int req_algo )
continue;
}
/* put it into the list */
if( g10_opt_verbose > 1 )
if( g10_log_verbosity( 2 ) )
log_info("loaded digest %d\n", algo);
r->next = digest_list;
digest_list = r;

View file

@ -249,7 +249,7 @@ generate_elg_prime( int mode, unsigned pbits, unsigned qbits,
/*fputc('~', stderr);*/
mpi_fdiv_q(tmp, pmin1, factors[i] );
/* (no mpi_pow(), but it is okay to use this with mod prime) */
mpi_powm(b, g, tmp, prime );
gcry_mpi_powm(b, g, tmp, prime );
if( !mpi_cmp_ui(b, 1) )
break;
}
@ -334,7 +334,7 @@ gen_prime( unsigned nbits, int secret, int randomlevel )
/* do a faster Fermat test */
count2++;
mpi_sub_ui( pminus1, ptest, 1);
mpi_powm( result, val_2, pminus1, ptest );
gcry_mpi_powm( result, val_2, pminus1, ptest );
if( !mpi_cmp_ui( result, 1 ) ) { /* not composite */
/* perform stronger tests */
if( is_prime(ptest, 5, &count2 ) ) {
@ -383,7 +383,7 @@ check_prime( MPI prime, MPI val_2 )
MPI result = mpi_alloc_like( prime );
MPI pminus1 = mpi_alloc_like( prime );
mpi_sub_ui( pminus1, prime, 1);
mpi_powm( result, val_2, pminus1, prime );
gcry_mpi_powm( result, val_2, pminus1, prime );
mpi_free( pminus1 );
if( mpi_cmp_ui( result, 1 ) ) { /* if composite */
mpi_free( result );
@ -443,10 +443,10 @@ is_prime( MPI n, int steps, int *count )
}
assert( mpi_cmp( x, nminus1 ) < 0 && mpi_cmp_ui( x, 1 ) > 0 );
}
mpi_powm( y, x, q, n);
gcry_mpi_powm( y, x, q, n);
if( mpi_cmp_ui(y, 1) && mpi_cmp( y, nminus1 ) ) {
for( j=1; j < k && mpi_cmp( y, nminus1 ); j++ ) {
mpi_powm(y, y, a2, n);
gcry_mpi_powm(y, y, a2, n);
if( !mpi_cmp_ui( y, 1 ) )
goto leave; /* not a prime */
}

View file

@ -256,7 +256,7 @@ load_pubkey_modules(void)
if( !ct->verify ) ct->verify = dummy_verify;
if( !ct->get_nbits ) ct->get_nbits= dummy_get_nbits;
/* put it into the table */
if( g10_opt_verbose > 1 )
if( g10_log_verbosity( 2 ) )
log_info("loaded pubkey %d (%s)\n", ct->algo, name);
ct->name = name;
ct_idx++;

View file

@ -47,7 +47,6 @@
#endif
#include "g10lib.h"
#include "rmd.h"
#include "ttyio.h"
#include "random.h"
#include "rand-internal.h"
#include "dynload.h"

View file

@ -32,7 +32,9 @@
#include <sys/un.h>
#include "types.h"
#include "g10lib.h"
#ifndef IS_MODULE
#include "ttyio.h"
#endif
#include "dynload.h"
#include "cipher.h"
@ -141,7 +143,8 @@ gather_random( void (*add)(const void*, size_t, int), int requester,
}
}
if( fd == -1 ) {
char *name = my_make_filename( g10_opt_homedir, "entropy", NULL );
#warning Fixme: make the filename configurable
char *name = my_make_filename( "~/.gnupg-test", "entropy", NULL );
struct sockaddr_un addr;
int addr_len;

View file

@ -42,7 +42,6 @@
#endif
#include "types.h"
#include "g10lib.h"
#include "ttyio.h"
#include "dynload.h"
static int open_device( const char *name, int minor );