1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-02 22:46:30 +02: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,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