1
0
mirror of git://git.gnupg.org/gnupg.git synced 2025-03-20 21:29:58 +01:00

Add Rijndael support, changes to fix an IRIX problem.

This commit is contained in:
Werner Koch 2000-10-12 14:34:01 +00:00
parent ce6cfb69d2
commit dc7cea85ba
19 changed files with 126 additions and 23 deletions

View File

@ -1,3 +1,7 @@
2000-10-09 Werner Koch <wk@gnupg.org>
* acinclude.m4: Changed wording of the faqprog.pl warning.
Wed Oct 4 15:50:18 CEST 2000 Werner Koch <wk@openit.de>
* configure.in: Set DYNLINK_MOD_CFLAGS for Irix. It seems that Irix

2
NEWS
View File

@ -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)
------------------------------------------------

4
TODO
View File

@ -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.

View File

@ -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
])

View File

@ -1,3 +1,8 @@
2000-10-12 Werner Koch <wk@gnupg.org>
* rijndael.c: New.
* cipher.c: Add Rijndael support.
Wed Oct 4 15:50:18 CEST 2000 Werner Koch <wk@openit.de>
* sha1.c (transform): Use rol() macro. Actually this is not needed

View File

@ -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 \

View File

@ -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*/

View File

@ -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,

View File

@ -39,7 +39,8 @@
#include <string.h> /* 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

View File

@ -1,3 +1,7 @@
2000-10-12 Werner Koch <wk@gnupg.org>
* keygen.c (keygen_add_std_prefs): Add Rijndael to the prefs.
2000-10-07 Werner Koch <wk@gnupg.org>
* gpgv.c: Add more stubs for ununsed code to make the binary smaller.

View File

@ -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;

View File

@ -1,3 +1,7 @@
2000-10-12 Werner Koch <wk@gnupg.org>
* mpi.h: Changed the way mpi_limb_t is defined.
Wed Sep 6 17:55:47 CEST 2000 Werner Koch <wk@openit.de>
* iobuf.c (IOBUF_FILELENGTH_LIMIT): New.

View File

@ -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 */

View File

@ -29,20 +29,34 @@
#ifndef G10_MPI_H
#define G10_MPI_H
#include <config.h>
#include <stdio.h>
#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 */

View File

@ -1,3 +1,9 @@
2000-10-12 Werner Koch <wk@gnupg.org>
* 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 <wk@>
* config.links: Support for powerpc--netbsd by Gabriel Rosenkoetter.

View File

@ -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

View File

@ -6,4 +6,5 @@ mpih-lshift.c
mpih-rshift.c
mpih-sub1.c
udiv-w-sdiv.c
mpi-asm-defs.h

View File

@ -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)

View File

@ -6,4 +6,5 @@ mpih-mul2.S
mpih-mul3.S
mpih-lshift.S
mpih-rshift.S
mpi-asm-defs.h