diff options
-rw-r--r-- | THANKS | 1 | ||||
-rw-r--r-- | cipher/ChangeLog | 4 | ||||
-rw-r--r-- | cipher/blowfish.c | 76 | ||||
-rw-r--r-- | cipher/cipher.c | 6 | ||||
-rw-r--r-- | cipher/misc.c | 21 | ||||
-rw-r--r-- | mpi/ChangeLog | 4 | ||||
-rw-r--r-- | mpi/config.links | 2 |
7 files changed, 49 insertions, 65 deletions
@@ -20,6 +20,7 @@ Peter Gutmann pgut001@cs.auckland.ac.nz Ralph Gillen gillen@theochem.uni-duesseldorf.de Thomas Roessler roessler@guug.de Tomas Fasth tomas.fasth@twinspot.net +Ulf Möller 3umoelle@informatik.uni-hamburg.de Walter Koch walterk@ddorf.rhein-ruhr.de Werner Koch werner.koch@guug.de Wim Vandeputte bunbun@reptile.rug.ac.be diff --git a/cipher/ChangeLog b/cipher/ChangeLog index e1bc0b8e..bc9261b7 100644 --- a/cipher/ChangeLog +++ b/cipher/ChangeLog @@ -1,3 +1,7 @@ +Wed Apr 8 14:57:11 1998 Werner Koch (wk@isil.d.shuttle.de) + + * misc.c (check_pubkey_algo2): New. + Tue Apr 7 18:46:49 1998 Werner Koch (wk@isil.d.shuttle.de) * cipher.c: New diff --git a/cipher/blowfish.c b/cipher/blowfish.c index 9e3c2bdc..466e8da6 100644 --- a/cipher/blowfish.c +++ b/cipher/blowfish.c @@ -396,35 +396,17 @@ blowfish_encrypt_block( BLOWFISH_context *bc, byte *outbuf, byte *inbuf ) { u32 d1, d2; - #ifdef BIG_ENDIAN_HOST - d1 = ((u32*)inbuf)[0]; /* fixme: this may not be aligned */ - d2 = ((u32*)inbuf)[1]; - #else - ((byte*)&d1)[3] = inbuf[0]; - ((byte*)&d1)[2] = inbuf[1]; - ((byte*)&d1)[1] = inbuf[2]; - ((byte*)&d1)[0] = inbuf[3]; - ((byte*)&d2)[3] = inbuf[4]; - ((byte*)&d2)[2] = inbuf[5]; - ((byte*)&d2)[1] = inbuf[6]; - ((byte*)&d2)[0] = inbuf[7]; - #endif - + d1 = inbuf[0] << 24 | inbuf[1] << 16 | inbuf[2] << 8 | inbuf[3]; + d2 = inbuf[4] << 24 | inbuf[5] << 16 | inbuf[6] << 8 | inbuf[7]; encrypt( bc, &d1, &d2 ); - - #ifdef BIG_ENDIAN_HOST - ((u32*)outbuf)[0] = d1; - ((u32*)outbuf)[1] = d2; - #else - outbuf[0] = ((byte*)&d1)[3]; - outbuf[1] = ((byte*)&d1)[2]; - outbuf[2] = ((byte*)&d1)[1]; - outbuf[3] = ((byte*)&d1)[0]; - outbuf[4] = ((byte*)&d2)[3]; - outbuf[5] = ((byte*)&d2)[2]; - outbuf[6] = ((byte*)&d2)[1]; - outbuf[7] = ((byte*)&d2)[0]; - #endif + outbuf[0] = (d1 >> 24) & 0xff; + outbuf[1] = (d1 >> 16) & 0xff; + outbuf[2] = (d1 >> 8) & 0xff; + outbuf[3] = d1 & 0xff; + outbuf[4] = (d2 >> 24) & 0xff; + outbuf[5] = (d2 >> 16) & 0xff; + outbuf[6] = (d2 >> 8) & 0xff; + outbuf[7] = d2 & 0xff; } @@ -433,35 +415,17 @@ blowfish_decrypt_block( BLOWFISH_context *bc, byte *outbuf, byte *inbuf ) { u32 d1, d2; - #ifdef BIG_ENDIAN_HOST - d1 = ((u32*)inbuf)[0]; /* fixme: this may not be aligned */ - d2 = ((u32*)inbuf)[1]; - #else - ((byte*)&d1)[3] = inbuf[0]; - ((byte*)&d1)[2] = inbuf[1]; - ((byte*)&d1)[1] = inbuf[2]; - ((byte*)&d1)[0] = inbuf[3]; - ((byte*)&d2)[3] = inbuf[4]; - ((byte*)&d2)[2] = inbuf[5]; - ((byte*)&d2)[1] = inbuf[6]; - ((byte*)&d2)[0] = inbuf[7]; - #endif - + d1 = inbuf[0] << 24 | inbuf[1] << 16 | inbuf[2] << 8 | inbuf[3]; + d2 = inbuf[4] << 24 | inbuf[5] << 16 | inbuf[6] << 8 | inbuf[7]; decrypt( bc, &d1, &d2 ); - - #ifdef BIG_ENDIAN_HOST - ((u32*)outbuf)[0] = d1; - ((u32*)outbuf)[1] = d2; - #else - outbuf[0] = ((byte*)&d1)[3]; - outbuf[1] = ((byte*)&d1)[2]; - outbuf[2] = ((byte*)&d1)[1]; - outbuf[3] = ((byte*)&d1)[0]; - outbuf[4] = ((byte*)&d2)[3]; - outbuf[5] = ((byte*)&d2)[2]; - outbuf[6] = ((byte*)&d2)[1]; - outbuf[7] = ((byte*)&d2)[0]; - #endif + outbuf[0] = (d1 >> 24) & 0xff; + outbuf[1] = (d1 >> 16) & 0xff; + outbuf[2] = (d1 >> 8) & 0xff; + outbuf[3] = d1 & 0xff; + outbuf[4] = (d2 >> 24) & 0xff; + outbuf[5] = (d2 >> 16) & 0xff; + outbuf[6] = (d2 >> 8) & 0xff; + outbuf[7] = d2 & 0xff; } diff --git a/cipher/cipher.c b/cipher/cipher.c index 6e2bcce0..1f24c6b0 100644 --- a/cipher/cipher.c +++ b/cipher/cipher.c @@ -225,8 +225,7 @@ do_cfb_encrypt( CIPHER_HANDLE c, byte *outbuf, byte *inbuf, unsigned nbytes ) if( nbytes <= c->unused ) { /* short enough to be encoded by the remaining XOR mask */ /* XOR the input with the IV and store input into IV */ - c->unused -= nbytes; - for(ivp=c->iv+STD_BLOCKSIZE - c->unused; nbytes; nbytes-- ) + for(ivp=c->iv+STD_BLOCKSIZE - c->unused; nbytes; nbytes--, c->unused-- ) *outbuf++ = (*ivp++ ^= *inbuf++); return; } @@ -271,8 +270,7 @@ do_cfb_decrypt( CIPHER_HANDLE c, byte *outbuf, byte *inbuf, unsigned nbytes ) if( nbytes <= c->unused ) { /* short enough to be encoded by the remaining XOR mask */ /* XOR the input with the IV and store input into IV */ - c->unused -= nbytes; - for(ivp=c->iv+STD_BLOCKSIZE - c->unused; nbytes; nbytes-- ) { + for(ivp=c->iv+STD_BLOCKSIZE - c->unused; nbytes; nbytes--,c->unused--){ temp = *inbuf++; *outbuf++ = *ivp ^ temp; *ivp++ = temp; diff --git a/cipher/misc.c b/cipher/misc.c index 35761e4f..3016b8e5 100644 --- a/cipher/misc.c +++ b/cipher/misc.c @@ -114,18 +114,31 @@ digest_algo_to_string( int algo ) - - int check_pubkey_algo( int algo ) { + return check_pubkey_algo2( algo, 0 ); +} + +/**************** + * a usage of 0 means: don't care + */ +int +check_pubkey_algo2( int algo, unsigned usage ) +{ switch( algo ) { - case PUBKEY_ALGO_ELGAMAL: case PUBKEY_ALGO_DSA: + if( usage & 2 ) + return G10ERR_WR_PUBKEY_ALGO; + return 0; + + case PUBKEY_ALGO_ELGAMAL: + return 0; + #ifdef HAVE_RSA_CIPHER case PUBKEY_ALGO_RSA: - #endif return 0; + #endif default: return G10ERR_PUBKEY_ALGO; } diff --git a/mpi/ChangeLog b/mpi/ChangeLog index ca01cb4d..0a967df4 100644 --- a/mpi/ChangeLog +++ b/mpi/ChangeLog @@ -1,3 +1,7 @@ +Wed Apr 8 09:44:33 1998 Werner Koch (wk@isil.d.shuttle.de) + + * config.links: Applied small fix from Ulf Möller. + Mon Apr 6 12:38:52 1998 Werner Koch (wk@isil.d.shuttle.de) * mpicoder.c (mpi_get_buffer): Removed returned leading zeroes diff --git a/mpi/config.links b/mpi/config.links index 65331777..fe9bda1c 100644 --- a/mpi/config.links +++ b/mpi/config.links @@ -111,7 +111,7 @@ esac case "${target}" in - *-*-linuxaout* | *-*-linuxoldld*) + *-*-linuxaout* | *-*-linuxoldld* | *-*-linux-gnuoldld*) needs_underscore="y" ;; *-*-linux* | *-sysv* | *-solaris* | *-gnu*) |