summaryrefslogtreecommitdiffstats
path: root/cipher
diff options
context:
space:
mode:
Diffstat (limited to 'cipher')
-rw-r--r--cipher/ChangeLog10
-rw-r--r--cipher/Makefile.am2
-rw-r--r--cipher/cipher.c2
-rw-r--r--cipher/dsa.c8
-rw-r--r--cipher/dynload.c4
-rw-r--r--cipher/elgamal.c20
-rw-r--r--cipher/md.c2
-rw-r--r--cipher/primegen.c10
-rw-r--r--cipher/pubkey.c2
-rw-r--r--cipher/random.c1
-rw-r--r--cipher/rndegd.c5
-rw-r--r--cipher/rndlinux.c1
12 files changed, 39 insertions, 28 deletions
diff --git a/cipher/ChangeLog b/cipher/ChangeLog
index bfe180d9f..df0eeee12 100644
--- a/cipher/ChangeLog
+++ b/cipher/ChangeLog
@@ -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
diff --git a/cipher/Makefile.am b/cipher/Makefile.am
index 23142d9cb..aa766bbc4 100644
--- a/cipher/Makefile.am
+++ b/cipher/Makefile.am
@@ -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
diff --git a/cipher/cipher.c b/cipher/cipher.c
index 1a7a65845..7808d8769 100644
--- a/cipher/cipher.c
+++ b/cipher/cipher.c
@@ -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++;
diff --git a/cipher/dsa.c b/cipher/dsa.c
index 903625c11..1f132ae0c 100644
--- a/cipher/dsa.c
+++ b/cipher/dsa.c
@@ -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 */
diff --git a/cipher/dynload.c b/cipher/dynload.c
index 262325c71..d2c40b3f5 100644
--- a/cipher/dynload.c
+++ b/cipher/dynload.c
@@ -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 ) {
diff --git a/cipher/elgamal.c b/cipher/elgamal.c
index f88aa91d3..02995e02e 100644
--- a/cipher/elgamal.c
+++ b/cipher/elgamal.c
@@ -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
diff --git a/cipher/md.c b/cipher/md.c
index bc9c6e867..bc0a6c30d 100644
--- a/cipher/md.c
+++ b/cipher/md.c
@@ -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;
diff --git a/cipher/primegen.c b/cipher/primegen.c
index cb7327a4a..1ad163332 100644
--- a/cipher/primegen.c
+++ b/cipher/primegen.c
@@ -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 */
}
diff --git a/cipher/pubkey.c b/cipher/pubkey.c
index 49f4773e2..4b2c55e41 100644
--- a/cipher/pubkey.c
+++ b/cipher/pubkey.c
@@ -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++;
diff --git a/cipher/random.c b/cipher/random.c
index 78c9ecdaa..38991a182 100644
--- a/cipher/random.c
+++ b/cipher/random.c
@@ -47,7 +47,6 @@
#endif
#include "g10lib.h"
#include "rmd.h"
-#include "ttyio.h"
#include "random.h"
#include "rand-internal.h"
#include "dynload.h"
diff --git a/cipher/rndegd.c b/cipher/rndegd.c
index 36c8b4e3d..4d5f0ef3a 100644
--- a/cipher/rndegd.c
+++ b/cipher/rndegd.c
@@ -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;
diff --git a/cipher/rndlinux.c b/cipher/rndlinux.c
index d25abcd31..bca596fd1 100644
--- a/cipher/rndlinux.c
+++ b/cipher/rndlinux.c
@@ -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 );