summaryrefslogtreecommitdiffstats
path: root/cipher
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>1998-06-15 17:41:04 +0200
committerWerner Koch <wk@gnupg.org>1998-06-15 17:41:04 +0200
commit6e1ca6b80fb50ff5e1c065b7ac12635487b4a6d2 (patch)
tree7c4a888893a91b59753b3d89e59832f8c24ba039 /cipher
parentgnupg extension are now working (diff)
downloadgnupg2-6e1ca6b80fb50ff5e1c065b7ac12635487b4a6d2.tar.xz
gnupg2-6e1ca6b80fb50ff5e1c065b7ac12635487b4a6d2.zip
extensions are now working and fixed a lot of bugs
Diffstat (limited to 'cipher')
-rw-r--r--cipher/ChangeLog4
-rw-r--r--cipher/Makefile.am4
-rw-r--r--cipher/cipher.c2
-rw-r--r--cipher/des.c8
-rw-r--r--cipher/des.h37
-rw-r--r--cipher/dsa.c3
-rw-r--r--cipher/dsa.h3
-rw-r--r--cipher/dynload.c6
-rw-r--r--cipher/dynload.h3
-rw-r--r--cipher/elgamal.c3
-rw-r--r--cipher/elgamal.h3
-rw-r--r--cipher/g10c.c1
-rw-r--r--cipher/md.c35
-rw-r--r--cipher/md.h1
-rw-r--r--cipher/pubkey.c14
-rw-r--r--cipher/tiger.c12
-rw-r--r--cipher/tiger.h44
17 files changed, 45 insertions, 138 deletions
diff --git a/cipher/ChangeLog b/cipher/ChangeLog
index 760f52d40..354206462 100644
--- a/cipher/ChangeLog
+++ b/cipher/ChangeLog
@@ -1,3 +1,7 @@
+Mon Jun 15 14:40:48 1998 Werner Koch (wk@isil.d.shuttle.de)
+
+ * tiger.c: Removed from dis, will reappear as dynload module
+
Sat Jun 13 14:16:57 1998 Werner Koch (wk@isil.d.shuttle.de)
* pubkey.c: Major changes to allow extensions. Changed the inteface
diff --git a/cipher/Makefile.am b/cipher/Makefile.am
index 04d1ef8ed..2cb4ddc41 100644
--- a/cipher/Makefile.am
+++ b/cipher/Makefile.am
@@ -2,6 +2,7 @@
INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/intl -I../intl
+EXTRA_DIST = tiger.c
noinst_LIBRARIES = libcipher.a
@@ -15,7 +16,6 @@ libcipher_a_SOURCES = cipher.c \
blowfish.h \
cast5.c \
cast5.h \
- des.h \
elgamal.c \
elgamal.h \
md5.c \
@@ -29,8 +29,6 @@ libcipher_a_SOURCES = cipher.c \
rand-dummy.c \
rmd.h \
rmd160.c \
- tiger.h \
- tiger.c \
sha1.h \
sha1.c \
dsa.h \
diff --git a/cipher/cipher.c b/cipher/cipher.c
index 064947865..cedcb37af 100644
--- a/cipher/cipher.c
+++ b/cipher/cipher.c
@@ -31,7 +31,6 @@
#include "cipher.h"
#include "blowfish.h"
#include "cast5.h"
-#include "des.h"
#include "dynload.h"
@@ -64,7 +63,6 @@ struct cipher_handle_s {
};
-
static void
dummy_setkey( void *c, byte *key, unsigned keylen ) { }
static void
diff --git a/cipher/des.c b/cipher/des.c
index 53afbc3ca..3864b2214 100644
--- a/cipher/des.c
+++ b/cipher/des.c
@@ -25,7 +25,13 @@
#include <assert.h>
#include "util.h"
#include "types.h"
-#include "des.h"
+
+#define DES_BLOCKSIZE 8
+#define DES_ROUNDS 16
+
+typedef struct {
+ int tripledes;
+} DES_context;
static const int IP[64] = {
diff --git a/cipher/des.h b/cipher/des.h
deleted file mode 100644
index 55a927703..000000000
--- a/cipher/des.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* des.h
- * Copyright (C) 1998 Free Software Foundation, Inc.
- *
- * This file is part of GNUPG.
- *
- * GNUPG is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GNUPG is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
-#ifndef G10_DES_H
-#define G10_DES_H
-
-#include "types.h"
-
-#define DES_BLOCKSIZE 8
-#define DES_ROUNDS 16
-
-typedef struct {
- int tripledes;
-} DES_context;
-
-void des_setkey( DES_context *c, byte *key, unsigned keylen );
-void des_3des_setkey( DES_context *c, byte *key, unsigned keylen );
-void des_encrypt_block( DES_context *bc, byte *outbuf, byte *inbuf );
-void des_decrypt_block( DES_context *bc, byte *outbuf, byte *inbuf );
-
-#endif /*G10_DES_H*/
diff --git a/cipher/dsa.c b/cipher/dsa.c
index 20011da38..19a59d909 100644
--- a/cipher/dsa.c
+++ b/cipher/dsa.c
@@ -359,7 +359,8 @@ dsa_sign( int algo, MPI *resarr, MPI data, MPI *skey )
}
int
-dsa_verify( int algo, MPI hash, MPI *data, MPI *pkey )
+dsa_verify( int algo, MPI hash, MPI *data, MPI *pkey,
+ int (*cmp)(void *, MPI), void *opaquev )
{
DSA_public_key pk;
diff --git a/cipher/dsa.h b/cipher/dsa.h
index fe977a645..dda32bd6d 100644
--- a/cipher/dsa.h
+++ b/cipher/dsa.h
@@ -23,7 +23,8 @@
int dsa_generate( int algo, unsigned nbits, MPI *skey, MPI **retfactors );
int dsa_check_secret_key( int algo, MPI *skey );
int dsa_sign( int algo, MPI *resarr, MPI data, MPI *skey );
-int dsa_verify( int algo, MPI hash, MPI *data, MPI *pkey );
+int dsa_verify( int algo, MPI hash, MPI *data, MPI *pkey,
+ int (*cmp)(void *, MPI), void *opaquev );
unsigned dsa_get_nbits( int algo, MPI *pkey );
const char *dsa_get_info( int algo, int *npkey, int *nskey,
int *nenc, int *nsig, int *usage );
diff --git a/cipher/dynload.c b/cipher/dynload.c
index e0b2e77e3..71f0d1959 100644
--- a/cipher/dynload.c
+++ b/cipher/dynload.c
@@ -221,7 +221,8 @@ enum_gnupgext_pubkeys( void **enum_context, int *algo,
int (**encrypt)( int algo, MPI *resarr, MPI data, MPI *pkey ),
int (**decrypt)( int algo, MPI *result, MPI *data, MPI *skey ),
int (**sign)( int algo, MPI *resarr, MPI data, MPI *skey ),
- int (**verify)( int algo, MPI hash, MPI *data, MPI *pkey ),
+ int (**verify)( int algo, MPI hash, MPI *data, MPI *pkey,
+ int (*cmp)(void *, MPI), void *opaquev ),
unsigned (**get_nbits)( int algo, MPI *pkey ) )
{
EXTLIST r;
@@ -232,7 +233,8 @@ enum_gnupgext_pubkeys( void **enum_context, int *algo,
int (**)( int, MPI *, MPI , MPI * ),
int (**)( int, MPI *, MPI *, MPI * ),
int (**)( int, MPI *, MPI , MPI * ),
- int (**)( int, MPI , MPI *, MPI * ),
+ int (**)( int, MPI , MPI *, MPI *,
+ int (*)(void*,MPI), void *),
unsigned (**)( int , MPI * ) );
if( !*enum_context ) { /* init context */
diff --git a/cipher/dynload.h b/cipher/dynload.h
index 69b5d8fa9..2d829c717 100644
--- a/cipher/dynload.h
+++ b/cipher/dynload.h
@@ -36,7 +36,8 @@ enum_gnupgext_pubkeys( void **enum_context, int *algo,
int (**encrypt)( int algo, MPI *resarr, MPI data, MPI *pkey ),
int (**decrypt)( int algo, MPI *result, MPI *data, MPI *skey ),
int (**sign)( int algo, MPI *resarr, MPI data, MPI *skey ),
- int (**verify)( int algo, MPI hash, MPI *data, MPI *pkey ),
+ int (**verify)( int algo, MPI hash, MPI *data, MPI *pkey,
+ int (*cmp)(void *, MPI), void *opaquev ),
unsigned (**get_nbits)( int algo, MPI *pkey ) );
#endif /*G10_CIPHER_DYNLOAD_H*/
diff --git a/cipher/elgamal.c b/cipher/elgamal.c
index b37c756cf..bcaaa20ba 100644
--- a/cipher/elgamal.c
+++ b/cipher/elgamal.c
@@ -476,7 +476,8 @@ elg_sign( int algo, MPI *resarr, MPI data, MPI *skey )
}
int
-elg_verify( int algo, MPI hash, MPI *data, MPI *pkey )
+elg_verify( int algo, MPI hash, MPI *data, MPI *pkey,
+ int (*cmp)(void *, MPI), void *opaquev )
{
ELG_public_key pk;
diff --git a/cipher/elgamal.h b/cipher/elgamal.h
index a4668ff9d..672f07704 100644
--- a/cipher/elgamal.h
+++ b/cipher/elgamal.h
@@ -25,7 +25,8 @@ int elg_check_secret_key( int algo, MPI *skey );
int elg_encrypt( int algo, MPI *resarr, MPI data, MPI *pkey );
int elg_decrypt( int algo, MPI *result, MPI *data, MPI *skey );
int elg_sign( int algo, MPI *resarr, MPI data, MPI *skey );
-int elg_verify( int algo, MPI hash, MPI *data, MPI *pkey );
+int elg_verify( int algo, MPI hash, MPI *data, MPI *pkey,
+ int (*cmp)(void *, MPI), void *opaquev );
unsigned elg_get_nbits( int algo, MPI *pkey );
const char *elg_get_info( int algo, int *npkey, int *nskey,
int *nenc, int *nsig, int *usage );
diff --git a/cipher/g10c.c b/cipher/g10c.c
index c6f94022b..5bf0eb61f 100644
--- a/cipher/g10c.c
+++ b/cipher/g10c.c
@@ -27,6 +27,7 @@
#define _g10lib_INTERNAL 1
#include "g10lib.h"
+const char *g10c_revision_string(int dummy) { return "$Revision$"; }
MPI
g10c_generate_secret_prime( unsigned nbits )
diff --git a/cipher/md.c b/cipher/md.c
index 30d7e255d..b116dd975 100644
--- a/cipher/md.c
+++ b/cipher/md.c
@@ -38,7 +38,6 @@ static struct { const char *name; int algo;} digest_names[] = {
{ "RMD160", DIGEST_ALGO_RMD160 },
{ "RMD-160", DIGEST_ALGO_RMD160 },
{ "RIPE-MD-160", DIGEST_ALGO_RMD160 },
- { "TIGER", DIGEST_ALGO_TIGER },
{NULL} };
@@ -79,9 +78,6 @@ int
check_digest_algo( int algo )
{
switch( algo ) {
- #ifdef WITH_TIGER_HASH
- case DIGEST_ALGO_TIGER:
- #endif
case DIGEST_ALGO_MD5:
case DIGEST_ALGO_RMD160:
case DIGEST_ALGO_SHA1:
@@ -134,13 +130,6 @@ md_enable( MD_HANDLE h, int algo )
sha1_init( &h->sha1 );
h->use_sha1 = 1;
}
- #ifdef WITH_TIGER_HASH
- else if( algo == DIGEST_ALGO_TIGER ) {
- if( !h->use_tiger )
- tiger_init( &h->tiger );
- h->use_tiger = 1;
- }
- #endif
else
log_bug("md_enable(%d)", algo );
}
@@ -186,12 +175,6 @@ md_write( MD_HANDLE a, byte *inbuf, size_t inlen)
sha1_write( &a->sha1, a->buffer, a->bufcount );
sha1_write( &a->sha1, inbuf, inlen );
}
- #ifdef WITH_TIGER_HASH
- if( a->use_tiger ) {
- tiger_write( &a->tiger, a->buffer, a->bufcount );
- tiger_write( &a->tiger, inbuf, inlen );
- }
- #endif
if( a->use_md5 ) {
md5_write( &a->md5, a->buffer, a->bufcount );
md5_write( &a->md5, inbuf, inlen );
@@ -210,10 +193,6 @@ md_final(MD_HANDLE a)
rmd160_final( &a->rmd160 );
if( a->use_sha1 )
sha1_final( &a->sha1 );
- #ifdef WITH_TIGER_HASH
- if( a->use_tiger )
- tiger_final( &a->tiger );
- #endif
if( a->use_md5 )
md5_final( &a->md5 );
}
@@ -230,10 +209,6 @@ md_read( MD_HANDLE a, int algo )
return rmd160_read( &a->rmd160 );
if( a->use_sha1 )
return sha1_read( &a->sha1 );
- #ifdef WITH_TIGER_HASH
- if( a->use_tiger )
- return tiger_read( &a->tiger );
- #endif
if( a->use_md5 )
return md5_read( &a->md5 );
}
@@ -242,10 +217,6 @@ md_read( MD_HANDLE a, int algo )
return rmd160_read( &a->rmd160 );
if( algo == DIGEST_ALGO_SHA1 )
return sha1_read( &a->sha1 );
- #ifdef WITH_TIGER_HASH
- if( algo == DIGEST_ALGO_TIGER )
- return tiger_read( &a->tiger );
- #endif
if( algo == DIGEST_ALGO_MD5 )
return md5_read( &a->md5 );
}
@@ -259,10 +230,6 @@ md_get_algo( MD_HANDLE a )
return DIGEST_ALGO_RMD160;
if( a->use_sha1 )
return DIGEST_ALGO_SHA1;
- #ifdef WITH_TIGER_HASH
- if( a->use_tiger )
- return DIGEST_ALGO_TIGER;
- #endif
if( a->use_md5 )
return DIGEST_ALGO_MD5;
return 0;
@@ -275,8 +242,6 @@ int
md_digest_length( int algo )
{
switch( algo ) {
- case DIGEST_ALGO_TIGER:
- return 24;
case DIGEST_ALGO_RMD160:
case DIGEST_ALGO_SHA1:
return 20;
diff --git a/cipher/md.h b/cipher/md.h
index 2d45a1273..b4d690793 100644
--- a/cipher/md.h
+++ b/cipher/md.h
@@ -25,7 +25,6 @@
#include "rmd.h"
#include "sha1.h"
#include "md5.h"
-#include "tiger.h"
#define MD_BUFFER_SIZE 512
diff --git a/cipher/pubkey.c b/cipher/pubkey.c
index 3357ae12c..b18f1c316 100644
--- a/cipher/pubkey.c
+++ b/cipher/pubkey.c
@@ -28,6 +28,8 @@
#include "errors.h"
#include "mpi.h"
#include "cipher.h"
+#include "elgamal.h"
+#include "dsa.h"
#include "dynload.h"
@@ -46,7 +48,8 @@ struct pubkey_table_s {
int (*encrypt)( int algo, MPI *resarr, MPI data, MPI *pkey );
int (*decrypt)( int algo, MPI *result, MPI *data, MPI *skey );
int (*sign)( int algo, MPI *resarr, MPI data, MPI *skey );
- int (*verify)( int algo, MPI hash, MPI *data, MPI *pkey );
+ int (*verify)( int algo, MPI hash, MPI *data, MPI *pkey,
+ int (*cmp)(void *, MPI), void *opaquev );
unsigned (*get_nbits)( int algo, MPI *pkey );
};
@@ -75,7 +78,8 @@ dummy_sign( int algo, MPI *resarr, MPI data, MPI *skey )
{ log_bug("no sign() for %d\n", algo ); return G10ERR_PUBKEY_ALGO; }
static int
-dummy_verify( int algo, MPI hash, MPI *data, MPI *pkey )
+dummy_verify( int algo, MPI hash, MPI *data, MPI *pkey,
+ int (*cmp)(void *, MPI), void *opaquev )
{ log_bug("no verify() for %d\n", algo ); return G10ERR_PUBKEY_ALGO; }
static unsigned
@@ -523,7 +527,8 @@ pubkey_sign( int algo, MPI *resarr, MPI data, MPI *skey )
* Return 0 if the signature is good
*/
int
-pubkey_verify( int algo, MPI hash, MPI *data, MPI *pkey )
+pubkey_verify( int algo, MPI hash, MPI *data, MPI *pkey,
+ int (*cmp)(void *, MPI), void *opaquev )
{
int i, rc;
@@ -531,7 +536,8 @@ pubkey_verify( int algo, MPI hash, MPI *data, MPI *pkey )
do {
for(i=0; pubkey_table[i].name; i++ )
if( pubkey_table[i].algo == algo ) {
- rc = (*pubkey_table[i].verify)( algo, hash, data, pkey );
+ rc = (*pubkey_table[i].verify)( algo, hash, data, pkey,
+ cmp, opaquev );
goto ready;
}
} while( load_pubkey_modules() );
diff --git a/cipher/tiger.c b/cipher/tiger.c
index c43226445..11c11b461 100644
--- a/cipher/tiger.c
+++ b/cipher/tiger.c
@@ -25,9 +25,15 @@
#include <assert.h>
#include "util.h"
#include "memory.h"
-#include "tiger.h"
-#ifdef WITH_TIGER_HASH
+
+typedef struct {
+ u64 a, b, c;
+ u32 nblocks;
+ byte buf[64];
+ int count;
+} TIGER_CONTEXT;
+
/*********************************
* Okay, okay, this is not the fastest code - improvements are welcome.
@@ -845,5 +851,3 @@ tiger_final( TIGER_CONTEXT *hd )
#undef X
}
-#endif /* WITH_TIGER_HASH */
-
diff --git a/cipher/tiger.h b/cipher/tiger.h
deleted file mode 100644
index 906909269..000000000
--- a/cipher/tiger.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/* tiger.h - TIGER hash function
- * Copyright (C) 1998 Free Software Foundation, Inc.
- *
- * This file is part of GNUPG.
- *
- * GNUPG is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GNUPG is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
-#ifndef G10_TIGER_H
-#define G10_TIGER_H
-
-#include "types.h"
-
-#ifdef HAVE_U64_TYPEDEF
-
-#define WITH_TIGER_HASH 1
-
-typedef struct {
- u64 a, b, c;
- u32 nblocks;
- byte buf[64];
- int count;
-} TIGER_CONTEXT;
-
-
-void tiger_init( TIGER_CONTEXT *c );
-void tiger_write( TIGER_CONTEXT *hd, byte *inbuf, size_t inlen);
-void tiger_final(TIGER_CONTEXT *hd);
-#define tiger_read(h) ( (h)->buf )
-
-#endif /* HAVE_TIGER_HASH */
-
-#endif /*G10_TIGER_H*/