diff options
Diffstat (limited to 'g10')
-rw-r--r-- | g10/ChangeLog | 4 | ||||
-rw-r--r-- | g10/Makefile.am | 1 | ||||
-rw-r--r-- | g10/Makefile.in | 2 | ||||
-rw-r--r-- | g10/encode.c | 4 | ||||
-rw-r--r-- | g10/g10.c | 6 | ||||
-rw-r--r-- | g10/options.h | 1 | ||||
-rw-r--r-- | g10/packet.h | 16 | ||||
-rw-r--r-- | g10/pubkey-enc.c | 10 | ||||
-rw-r--r-- | g10/sign.c | 9 |
9 files changed, 27 insertions, 26 deletions
diff --git a/g10/ChangeLog b/g10/ChangeLog index 9b42cb3d8..a10527cf1 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,3 +1,7 @@ +Wed Jun 10 07:22:02 1998 Werner Koch,mobil,,, (wk@tobold) + + * g10.c ("load-extension"): New option. + Mon Jun 8 22:23:37 1998 Werner Koch ([email protected]) * seckey-cert.c (do_check): Removed cipher constants diff --git a/g10/Makefile.am b/g10/Makefile.am index fdf5f28b8..3e20a48c2 100644 --- a/g10/Makefile.am +++ b/g10/Makefile.am @@ -3,6 +3,7 @@ INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/intl -I../intl EXTRA_DIST = OPTIONS pubring.asc OMIT_DEPENDENCIES = zlib.h zconf.h +LDFLAGS = -rdynamic needed_libs = ../cipher/libcipher.a ../mpi/libmpi.a ../util/libutil.a noinst_PROGRAMS = gpgd diff --git a/g10/Makefile.in b/g10/Makefile.in index bc306754b..eba874517 100644 --- a/g10/Makefile.in +++ b/g10/Makefile.in @@ -93,6 +93,7 @@ l = @l@ INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/intl -I../intl EXTRA_DIST = OPTIONS pubring.asc OMIT_DEPENDENCIES = zlib.h zconf.h +LDFLAGS = -rdynamic needed_libs = ../cipher/libcipher.a ../mpi/libmpi.a ../util/libutil.a noinst_PROGRAMS = gpgd @@ -170,7 +171,6 @@ PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS) DEFS = @DEFS@ -I. -I$(srcdir) -I.. CPPFLAGS = @CPPFLAGS@ -LDFLAGS = @LDFLAGS@ LIBS = @LIBS@ gpg_OBJECTS = g10.o build-packet.o compress.o free-packet.o getkey.o \ pkclist.o skclist.o ringedit.o kbnode.o mainproc.o armor.o mdfilter.o \ diff --git a/g10/encode.c b/g10/encode.c index 142ffeac2..d3d88ca7b 100644 --- a/g10/encode.c +++ b/g10/encode.c @@ -89,7 +89,7 @@ encode_simple( const char *filename, int mode ) cfx.dek = NULL; if( mode ) { s2k = m_alloc_clear( sizeof *s2k ); - s2k->mode = 1; + s2k->mode = opt.rfc1991? 0:1; s2k->hash_algo = opt.def_digest_algo ? opt.def_digest_algo : DEFAULT_DIGEST_ALGO; cfx.dek = passphrase_to_dek( NULL, opt.def_cipher_algo, s2k, 2 ); @@ -116,7 +116,7 @@ encode_simple( const char *filename, int mode ) write_comment( out, "#created by GNUPG v" VERSION " (" PRINTABLE_OS_NAME ")"); - if( s2k ) { + if( s2k && !opt.rfc1991 ) { PKT_symkey_enc *enc = m_alloc_clear( sizeof *enc ); enc->version = 4; enc->cipher_algo = cfx.dek->algo; @@ -111,6 +111,8 @@ static ARGPARSE_OPTS opts[] = { { 534, "no-comment", 0, N_("do not write comment packets")}, { 535, "completes-needed", 1, N_("(default is 1)")}, { 536, "marginals-needed", 1, N_("(default is 3)")}, + { 560, "load-extension" ,2, N_("|file|load extension module")}, + { 561, "rfc1991", 0, N_("emulate the mode described in RFC1991")}, #ifdef IS_G10 { 527, "cipher-algo", 2 , N_("|NAME|use cipher algorithm NAME")}, { 528, "pubkey-algo", 2 , N_("|NAME|use public key algorithm NAME")}, @@ -427,7 +429,7 @@ main( int argc, char **argv ) orig_argv = argv; pargs.argc = &argc; pargs.argv = &argv; - pargs.flags= 1; /* do not remove the args */ + pargs.flags= 1|(1<<6); /* do not remove the args, ignore version */ while( arg_parse( &pargs, opts) ) { if( pargs.r_opt == 510 || pargs.r_opt == 511 ) parse_debug++; @@ -586,6 +588,8 @@ main( int argc, char **argv ) case 557: opt.compress_keys = 1; break; case 558: set_cmd( &cmd, aListSecretKeys); break; case 559: opt.always_trust = 1; break; + case 560: register_cipher_extension(pargs.r.ret_str); break; + case 561: opt.rfc1991 = 1; break; default : errors++; pargs.err = configfp? 1:2; break; } } diff --git a/g10/options.h b/g10/options.h index 8bc30eeba..4b32b524c 100644 --- a/g10/options.h +++ b/g10/options.h @@ -47,6 +47,7 @@ struct { int skip_verify; int compress_keys; int always_trust; + int rfc1991; } opt; diff --git a/g10/packet.h b/g10/packet.h index 3fc1ea280..cb9740cc6 100644 --- a/g10/packet.h +++ b/g10/packet.h @@ -27,12 +27,6 @@ #include "cipher.h" #include "filter.h" -#ifndef HAVE_RSA_CIPHER -/* although we don't have RSA we need these structures to handle keyrings */ -typedef struct { MPI e, n; } RSA_public_key; -typedef struct { MPI e, n, p, q, d, u; } RSA_secret_key; -#endif - typedef enum { PKT_NONE =0, PKT_PUBKEY_ENC =1, /* public key encrypted packet */ @@ -74,14 +68,8 @@ typedef struct { u32 keyid[2]; /* 64 bit keyid */ byte version; byte pubkey_algo; /* algorithm used for public key scheme */ - union { - struct { - MPI a, b; /* integers with the encrypteded DEK */ - } elg; - struct { - MPI rsa_integer; /* integer containing the DEK */ - } rsa; - } d; + int mpi_count; /* 1 for rsa, 2 for ELG */ + MPI material[2]; /* (ELG needs 2) } PKT_pubkey_enc; diff --git a/g10/pubkey-enc.c b/g10/pubkey-enc.c index 8f15057ec..8b48255dc 100644 --- a/g10/pubkey-enc.c +++ b/g10/pubkey-enc.c @@ -46,10 +46,11 @@ get_session_key( PKT_pubkey_enc *k, DEK *dek ) u16 csum, csum2; PKT_secret_cert *skc = m_alloc_clear( sizeof *skc ); - #ifndef HAVE_RSA_CIPHER - if( is_RSA(k->pubkey_algo) ) + if( is_RSA(k->pubkey_algo) ) /* warn about that */ write_status(STATUS_RSA_OR_IDEA); - #endif + rc=check_pubkey_algo( k->pubkey_algo ); + if( rc ) + goto leave; skc->pubkey_algo = k->pubkey_algo; /* we want a pubkey with this algo*/ if( (rc = get_seckey( skc, k->keyid )) ) @@ -63,7 +64,6 @@ get_session_key( PKT_pubkey_enc *k, DEK *dek ) plain_dek = mpi_alloc_secure( mpi_get_nlimbs(skc->d.elg.p) ); elg_decrypt( plain_dek, k->d.elg.a, k->d.elg.b, &skc->d.elg ); } - #ifdef HAVE_RSA_CIPHER else if( is_RSA(k->pubkey_algo) ) { if( DBG_CIPHER ) log_mpidump("Encr DEK frame:", k->d.rsa.rsa_integer ); @@ -71,8 +71,8 @@ get_session_key( PKT_pubkey_enc *k, DEK *dek ) plain_dek = mpi_alloc_secure( mpi_get_nlimbs(skc->d.rsa.n) ); rsa_secret( plain_dek, k->d.rsa.rsa_integer, &skc->d.rsa ); } - #endif/*HAVE_RSA_CIPHER*/ else { + log_info("need some glue code for pubkey algo %d\n", k->pubkey_algo); rc = G10ERR_PUBKEY_ALGO; /* unsupported algorithm */ goto leave; } diff --git a/g10/sign.c b/g10/sign.c index 598f60998..bd435a7c9 100644 --- a/g10/sign.c +++ b/g10/sign.c @@ -183,7 +183,7 @@ sign_file( STRLIST filenames, int detached, STRLIST locusr, iobuf_push_filter( out, compress_filter, &zfx ); - if( !detached ) { + if( !detached && !opt.rfc1991 ) { /* loop over the secret certificates and build headers */ for( skc_rover = skc_list; skc_rover; skc_rover = skc_rover->next ) { PKT_secret_cert *skc; @@ -254,6 +254,8 @@ sign_file( STRLIST filenames, int detached, STRLIST locusr, * data, it is not possible to know the used length * without a double read of the file - to avoid that * we simple use partial length packets. + * FIXME: We have to do the double read when opt.rfc1991 + * is active. */ if( opt.textmode && !outfile ) filesize = 0; @@ -449,9 +451,10 @@ clearsign_file( const char *fname, STRLIST locusr, const char *outfile ) goto leave; } - /* FIXME: This stuff is not correct if mutliplehash algos are used*/ + /* FIXME: This stuff is not correct if mutliple hash algos are used*/ iobuf_writestr(out, "-----BEGIN PGP SIGNED MESSAGE-----\n" ); - if( (opt.def_digest_algo?opt.def_digest_algo:DEFAULT_DIGEST_ALGO) + if( opt.rfc1991 + || (opt.def_digest_algo?opt.def_digest_algo:DEFAULT_DIGEST_ALGO) == DIGEST_ALGO_MD5 ) iobuf_writestr(out, "\n" ); else { |