diff --git a/ChangeLog b/ChangeLog index 0155064ce..1c808e26f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2000-10-09 Werner Koch + + * acinclude.m4: Changed wording of the faqprog.pl warning. + Wed Oct 4 15:50:18 CEST 2000 Werner Koch * configure.in: Set DYNLINK_MOD_CFLAGS for Irix. It seems that Irix diff --git a/NEWS b/NEWS index af07aa7bf..346bcd332 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,8 @@ * New utility gpgv which is a stripped down version of gpg to be used to verify signatures against a list of trusted keys. + * Rijndael (AES) is now supported and listed as first preference. + Noteworthy changes in version 1.0.3 (2000-09-18) ------------------------------------------------ diff --git a/TODO b/TODO index 4af19a07f..40def8820 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,8 @@ + * option to set the signature expiration time for key sigs. + + * Option to warn when a non MDC message is decrypted? + * If there is no secure memory, allocate more memory for the secure memory block or do it in all cases. diff --git a/acinclude.m4 b/acinclude.m4 index a8303671b..76b3dd46a 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -63,10 +63,11 @@ AC_DEFUN(GNUPG_CHECK_FAQPROG, if test $working_faqprog = no; then AC_MSG_WARN([[ *** -*** It seems that the faqprog.pl program is not installed. -*** Unless you do not change the source of the FAQs it is not required. -*** The working version of this utility should be available at: -*** ftp://ftp.gnupg.org/pub/gcrypt/contrib/faqprog.pl +*** It seems that the faqprog.pl program is not installed; +*** however it is only needed if you want to change the FAQ. +*** (faqprog.pl should be available at: +*** ftp://ftp.gnupg.org/pub/gcrypt/contrib/faqprog.pl ) +*** No need to worry about this warning. ***]]) fi ]) diff --git a/cipher/ChangeLog b/cipher/ChangeLog index 0c94910f4..c3fd15414 100644 --- a/cipher/ChangeLog +++ b/cipher/ChangeLog @@ -1,3 +1,8 @@ +2000-10-12 Werner Koch + + * rijndael.c: New. + * cipher.c: Add Rijndael support. + Wed Oct 4 15:50:18 CEST 2000 Werner Koch * sha1.c (transform): Use rol() macro. Actually this is not needed diff --git a/cipher/Makefile.am b/cipher/Makefile.am index 81bc77c30..2fefe0904 100644 --- a/cipher/Makefile.am +++ b/cipher/Makefile.am @@ -41,6 +41,7 @@ libcipher_a_SOURCES = cipher.c \ blowfish.h \ cast5.c \ cast5.h \ + rijndael.c \ elgamal.c \ elgamal.h \ rsa.c rsa.h \ diff --git a/cipher/blowfish.h b/cipher/blowfish.h index 7c34bab3c..bed034c73 100644 --- a/cipher/blowfish.h +++ b/cipher/blowfish.h @@ -41,4 +41,14 @@ twofish_get_info( int algo, size_t *keylen, void (**decryptf)( void *c, byte *outbuf, byte *inbuf ) ); +/* this is just a kludge for the time we have not yet chnaged the cipher + * stuff to the scheme we use for random and digests */ +const char * +rijndael_get_info( int algo, size_t *keylen, + size_t *blocksize, size_t *contextsize, + int (**setkeyf)( void *c, byte *key, unsigned keylen ), + void (**encryptf)( void *c, byte *outbuf, byte *inbuf ), + void (**decryptf)( void *c, byte *outbuf, byte *inbuf ) + ); + #endif /*G10_BLOWFISH_H*/ diff --git a/cipher/cipher.c b/cipher/cipher.c index 990671fc5..870e854cc 100644 --- a/cipher/cipher.c +++ b/cipher/cipher.c @@ -34,7 +34,7 @@ #define MAX_BLOCKSIZE 16 -#define TABLE_SIZE 10 +#define TABLE_SIZE 14 struct cipher_table_s { const char *name; @@ -84,6 +84,39 @@ setup_cipher_table(void) int i; i = 0; + cipher_table[i].algo = CIPHER_ALGO_RIJNDAEL; + cipher_table[i].name = rijndael_get_info( cipher_table[i].algo, + &cipher_table[i].keylen, + &cipher_table[i].blocksize, + &cipher_table[i].contextsize, + &cipher_table[i].setkey, + &cipher_table[i].encrypt, + &cipher_table[i].decrypt ); + if( !cipher_table[i].name ) + BUG(); + i++; + cipher_table[i].algo = CIPHER_ALGO_RIJNDAEL192; + cipher_table[i].name = rijndael_get_info( cipher_table[i].algo, + &cipher_table[i].keylen, + &cipher_table[i].blocksize, + &cipher_table[i].contextsize, + &cipher_table[i].setkey, + &cipher_table[i].encrypt, + &cipher_table[i].decrypt ); + if( !cipher_table[i].name ) + BUG(); + i++; + cipher_table[i].algo = CIPHER_ALGO_RIJNDAEL256; + cipher_table[i].name = rijndael_get_info( cipher_table[i].algo, + &cipher_table[i].keylen, + &cipher_table[i].blocksize, + &cipher_table[i].contextsize, + &cipher_table[i].setkey, + &cipher_table[i].encrypt, + &cipher_table[i].decrypt ); + if( !cipher_table[i].name ) + BUG(); + i++; cipher_table[i].algo = CIPHER_ALGO_TWOFISH; cipher_table[i].name = twofish_get_info( cipher_table[i].algo, &cipher_table[i].keylen, diff --git a/cipher/rijndael.c b/cipher/rijndael.c index 238866bfc..0284989c3 100644 --- a/cipher/rijndael.c +++ b/cipher/rijndael.c @@ -39,7 +39,8 @@ #include /* for memcmp() */ #include "types.h" /* for byte and u32 typedefs */ -#include "g10lib.h" +#include "util.h" +#include "errors.h" #include "dynload.h" #define MAXKC (256/32) @@ -1726,7 +1727,7 @@ rijndael_setkey (RIJNDAEL_context *ctx, const byte *key, const unsigned keylen) fprintf(stderr, "%s\n", selftest_failed ); } if( selftest_failed ) - return GCRYERR_SELFTEST; + return G10ERR_SELFTEST_FAILED; if( keylen == 128/8 ) { ROUNDS = 10; @@ -1741,7 +1742,7 @@ rijndael_setkey (RIJNDAEL_context *ctx, const byte *key, const unsigned keylen) KC = 8; } else - return GCRYERR_INV_KEYLEN; + return G10ERR_WRONG_KEYLEN; ctx->ROUNDS = ROUNDS; ctx->decryption_prepared = 0; @@ -2121,9 +2122,8 @@ rijndael_get_info (int algo, size_t *keylen, } -#ifndef IS_MODULE +#ifdef IS_MODULE static -#endif const char * const gnupgext_version = "RIJNDAEL ($Revision$)"; static struct { @@ -2155,9 +2155,7 @@ static struct { * version = interface version of the function/pointer * (currently this is 1 for all functions) */ -#ifndef IS_MODULE static -#endif void * gnupgext_enum_func ( int what, int *sequence, int *class, int *vers ) { @@ -2186,7 +2184,7 @@ gnupgext_enum_func ( int what, int *sequence, int *class, int *vers ) *sequence = i; return ret; } - +#endif diff --git a/g10/ChangeLog b/g10/ChangeLog index 7a8d4d7b8..7d4595ea2 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,3 +1,7 @@ +2000-10-12 Werner Koch + + * keygen.c (keygen_add_std_prefs): Add Rijndael to the prefs. + 2000-10-07 Werner Koch * gpgv.c: Add more stubs for ununsed code to make the binary smaller. diff --git a/g10/keygen.c b/g10/keygen.c index 0fc838c4f..51cdbd611 100644 --- a/g10/keygen.c +++ b/g10/keygen.c @@ -135,10 +135,11 @@ keygen_add_std_prefs( PKT_signature *sig, void *opaque ) keygen_add_key_expire( sig, opaque ); - buf[0] = CIPHER_ALGO_TWOFISH; - buf[1] = CIPHER_ALGO_CAST5; - buf[2] = CIPHER_ALGO_BLOWFISH; - build_sig_subpkt( sig, SIGSUBPKT_PREF_SYM, buf, 3 ); + buf[0] = CIPHER_ALGO_RIJNDAEL; + buf[1] = CIPHER_ALGO_TWOFISH; + buf[2] = CIPHER_ALGO_CAST5; + buf[3] = CIPHER_ALGO_BLOWFISH; + build_sig_subpkt( sig, SIGSUBPKT_PREF_SYM, buf, 4 ); buf[0] = DIGEST_ALGO_RMD160; buf[1] = DIGEST_ALGO_SHA1; diff --git a/include/ChangeLog b/include/ChangeLog index ed61159fe..7f6d87f80 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,3 +1,7 @@ +2000-10-12 Werner Koch + + * mpi.h: Changed the way mpi_limb_t is defined. + Wed Sep 6 17:55:47 CEST 2000 Werner Koch * iobuf.c (IOBUF_FILELENGTH_LIMIT): New. diff --git a/include/cipher.h b/include/cipher.h index bf2010fe0..8299e0438 100644 --- a/include/cipher.h +++ b/include/cipher.h @@ -33,6 +33,9 @@ #define CIPHER_ALGO_BLOWFISH 4 /* blowfish 128 bit key */ #define CIPHER_ALGO_SAFER_SK128 5 #define CIPHER_ALGO_DES_SK 6 +#define CIPHER_ALGO_RIJNDAEL 7 +#define CIPHER_ALGO_RIJNDAEL192 8 +#define CIPHER_ALGO_RIJNDAEL256 9 #define CIPHER_ALGO_TWOFISH 10 /* twofish 256 bit */ #define CIPHER_ALGO_SKIPJACK 101 /* experimental: skipjack */ #define CIPHER_ALGO_TWOFISH_OLD 102 /* experimental: twofish 128 bit */ diff --git a/include/mpi.h b/include/mpi.h index 2293af8fd..77e6c48ca 100644 --- a/include/mpi.h +++ b/include/mpi.h @@ -29,20 +29,34 @@ #ifndef G10_MPI_H #define G10_MPI_H +#include #include #include "iobuf.h" #include "types.h" #include "memory.h" +#include "../mpi/mpi-asm-defs.h" + +#if BYTES_PER_MPI_LIMB == SIZEOF_UNSIGNED_INT + typedef unsigned int mpi_limb_t; + typedef signed int mpi_limb_signed_t; +#elif BYTES_PER_MPI_LIMB == SIZEOF_UNSIGNED_LONG + typedef unsigned long int mpi_limb_t; + typedef signed long int mpi_limb_signed_t; +#elif BYTES_PER_MPI_LIMB == SIZEOF_UNSIGNED_LONG_LONG + typedef unsigned long long int mpi_limb_t; + typedef signed long long int mpi_limb_signed_t; +#elif BYTES_PER_MPI_LIMB == SIZEOF_UNSIGNED_SHORT + typedef unsigned short int mpi_limb_t; + typedef signed short int mpi_limb_signed_t; +#else + #error BYTES_PER_MPI_LIMB does not match any C type +#endif +#define BITS_PER_MPI_LIMB (8*BYTES_PER_MPI_LIMB) #define DBG_MPI mpi_debug_mode int mpi_debug_mode; -#define BITS_PER_MPI_LIMB (8*SIZEOF_UNSIGNED_LONG) -#define BYTES_PER_MPI_LIMB SIZEOF_UNSIGNED_LONG -typedef unsigned long int mpi_limb_t; -typedef signed long int mpi_limb_signed_t; - struct gcry_mpi { int alloced; /* array size (# of allocated limbs) */ int nlimbs; /* number of valid limbs */ diff --git a/mpi/ChangeLog b/mpi/ChangeLog index c1bb7f072..2160034bb 100644 --- a/mpi/ChangeLog +++ b/mpi/ChangeLog @@ -1,3 +1,9 @@ +2000-10-12 Werner Koch + + * generic/mpi-asm-defs.h: New. + * mips3/mpi-asm-defs.h: New. + * config.links: Create a link to one of the above files. + Wed Jul 19 11:26:43 CEST 2000 Werner Koch * config.links: Support for powerpc--netbsd by Gabriel Rosenkoetter. diff --git a/mpi/config.links b/mpi/config.links index 71906a06d..18cf9040a 100644 --- a/mpi/config.links +++ b/mpi/config.links @@ -277,3 +277,13 @@ for fn in $mpi_ln_modules ; do done done +# Same thing for the file which defines the limb size +path="$path generic" +for dir in $path ; do + rm -f $srcdir/mpi/mpi-asm-defs.h + if test -f $srcdir/mpi/$dir/mpi-asm-defs.h ; then + mpi_ln_src="$mpi_ln_src mpi/$dir/mpi-asm-defs.h" + mpi_ln_dst="$mpi_ln_dst mpi/mpi-asm-defs.h" + break; + fi +done diff --git a/mpi/generic/distfiles b/mpi/generic/distfiles index 0bf4600fb..649e829b7 100644 --- a/mpi/generic/distfiles +++ b/mpi/generic/distfiles @@ -6,4 +6,5 @@ mpih-lshift.c mpih-rshift.c mpih-sub1.c udiv-w-sdiv.c +mpi-asm-defs.h diff --git a/mpi/generic/mpi-asm-defs.h b/mpi/generic/mpi-asm-defs.h index c25f966a9..13424e280 100644 --- a/mpi/generic/mpi-asm-defs.h +++ b/mpi/generic/mpi-asm-defs.h @@ -1,7 +1,8 @@ /* This file defines some basic constants for the MPI machinery. We * need to define the types on a per-CPU basis, so it is done with * this file here. */ -#define BYTES_PER_MPI_LIMB (sizeof unsigned long) +#define BYTES_PER_MPI_LIMB (SIZEOF_UNSIGNED_LONG) + diff --git a/mpi/mips3/distfiles b/mpi/mips3/distfiles index b88f4f869..85260fc8e 100644 --- a/mpi/mips3/distfiles +++ b/mpi/mips3/distfiles @@ -6,4 +6,5 @@ mpih-mul2.S mpih-mul3.S mpih-lshift.S mpih-rshift.S +mpi-asm-defs.h