diff options
Diffstat (limited to 'cipher')
-rw-r--r-- | cipher/ChangeLog | 14 | ||||
-rw-r--r-- | cipher/blowfish.c | 12 | ||||
-rw-r--r-- | cipher/cast5.c | 13 | ||||
-rw-r--r-- | cipher/des.c | 13 | ||||
-rw-r--r-- | cipher/md5.c | 8 | ||||
-rw-r--r-- | cipher/rmd160.c | 8 | ||||
-rw-r--r-- | cipher/sha1.c | 4 | ||||
-rw-r--r-- | cipher/tiger.c | 8 | ||||
-rw-r--r-- | cipher/twofish.c | 27 |
9 files changed, 61 insertions, 46 deletions
diff --git a/cipher/ChangeLog b/cipher/ChangeLog index 2a53aff1a..6804a7b19 100644 --- a/cipher/ChangeLog +++ b/cipher/ChangeLog @@ -1,3 +1,15 @@ +Fri Jan 14 18:32:01 CET 2000 Werner Koch <[email protected]> + + * rmd160.c (rmd160_get_info): Moved casting to the left side due to a + problem with UTS4.3. Suggested by Dave Dykstra. + * sha1.c (sha1_get_info): Ditto. + * tiger.c (tiger_get_info): Ditto. + * md5.c (md5_get_info): Ditto + * des.c (des_get_info): Ditto. + * blowfish.c (blowfish_get_info): Ditto. + * cast5.c (cast5_get_info): Ditto. + * twofish.c (twofish_get_info): Ditto. + Thu Jan 13 19:31:58 CET 2000 Werner Koch <[email protected]> * elgamal.c (wiener_map): New. @@ -5,7 +17,7 @@ Thu Jan 13 19:31:58 CET 2000 Werner Koch <[email protected]> (generate): Calculate the qbits using the wiener map and choose an x at a size comparable to the one choosen in gen_k - * random.c (read_pool): Print a more friendly erro message in + * random.c (read_pool): Print a more friendly error message in cases when too much random is requested in one call. * Makefile.am (tiger): Replaced -O1 by -O. Suggested by Alec Habig. diff --git a/cipher/blowfish.c b/cipher/blowfish.c index 5a829d413..0cb5a861f 100644 --- a/cipher/blowfish.c +++ b/cipher/blowfish.c @@ -43,9 +43,6 @@ #define CIPHER_ALGO_BLOWFISH 4 /* blowfish 128 bit key */ -#define FNCCAST_SETKEY(f) (int(*)(void*, byte*, unsigned))(f) -#define FNCCAST_CRYPT(f) (void(*)(void*, byte*, byte*))(f) - #define BLOWFISH_BLOCKSIZE 8 #define BLOWFISH_ROUNDS 16 @@ -584,9 +581,12 @@ blowfish_get_info( int algo, size_t *keylen, *keylen = 128; *blocksize = BLOWFISH_BLOCKSIZE; *contextsize = sizeof(BLOWFISH_context); - *r_setkey = FNCCAST_SETKEY(bf_setkey); - *r_encrypt= FNCCAST_CRYPT(encrypt_block); - *r_decrypt= FNCCAST_CRYPT(decrypt_block); + *(int (**)(BLOWFISH_context*, byte*, unsigned))r_setkey + = bf_setkey; + *(void (**)(BLOWFISH_context*, byte*, byte*))r_encrypt + = encrypt_block; + *(void (**)(BLOWFISH_context*, byte*, byte*))r_decrypt + = decrypt_block; if( algo == CIPHER_ALGO_BLOWFISH ) return "BLOWFISH"; diff --git a/cipher/cast5.c b/cipher/cast5.c index 0e602bd2e..329f00ff7 100644 --- a/cipher/cast5.c +++ b/cipher/cast5.c @@ -46,9 +46,6 @@ #define CIPHER_ALGO_CAST5 3 -#define FNCCAST_SETKEY(f) (int(*)(void*, byte*, unsigned))(f) -#define FNCCAST_CRYPT(f) (void(*)(void*, byte*, byte*))(f) - #define CAST5_BLOCKSIZE 8 typedef struct { @@ -610,9 +607,13 @@ cast5_get_info( int algo, size_t *keylen, *keylen = 128; *blocksize = CAST5_BLOCKSIZE; *contextsize = sizeof(CAST5_context); - *r_setkey = FNCCAST_SETKEY(cast_setkey); - *r_encrypt= FNCCAST_CRYPT(encrypt_block); - *r_decrypt= FNCCAST_CRYPT(decrypt_block); + *(int (**)(CAST5_context*, byte*, unsigned))r_setkey + = cast_setkey; + *(void (**)(CAST5_context*, byte*, byte*))r_encrypt + = encrypt_block; + *(void (**)(CAST5_context*, byte*, byte*))r_decrypt + = decrypt_block; + if( algo == CIPHER_ALGO_CAST5 ) return "CAST5"; diff --git a/cipher/des.c b/cipher/des.c index c2ca3f848..847a3473e 100644 --- a/cipher/des.c +++ b/cipher/des.c @@ -147,9 +147,6 @@ working_memcmp( const char *a, const char *b, size_t n ) #endif -/* Macros used by the info function. */ -#define FNCCAST_SETKEY(f) ((int(*)(void*, byte*, unsigned))(f)) -#define FNCCAST_CRYPT(f) ((void(*)(void*, byte*, byte*))(f)) /* @@ -996,14 +993,16 @@ des_get_info( int algo, size_t *keylen, } } - if( algo == CIPHER_ALGO_3DES ) { *keylen = 192; *blocksize = 8; *contextsize = sizeof(struct _tripledes_ctx); - *r_setkey = FNCCAST_SETKEY(do_tripledes_setkey); - *r_encrypt= FNCCAST_CRYPT(do_tripledes_encrypt); - *r_decrypt= FNCCAST_CRYPT(do_tripledes_decrypt); + *(int (**)(struct _tripledes_ctx*, byte*, unsigned))r_setkey + = do_tripledes_setkey; + *(void (**)(struct _tripledes_ctx*, byte*, byte*))r_encrypt + = do_tripledes_encrypt; + *(void (**)(struct _tripledes_ctx*, byte*, byte*))r_decrypt + = do_tripledes_decrypt; return "3DES"; } return NULL; diff --git a/cipher/md5.c b/cipher/md5.c index bb930d042..eb09d261c 100644 --- a/cipher/md5.c +++ b/cipher/md5.c @@ -344,10 +344,10 @@ md5_get_info( int algo, size_t *contextsize, *r_asnoid = asn; *r_asnlen = DIM(asn); *r_mdlen = 16; - *r_init = (void (*)(void *))md5_init; - *r_write = (void (*)(void *, byte*, size_t))md5_write; - *r_final = (void (*)(void *))md5_final; - *r_read = (byte *(*)(void *))md5_read; + *(void (**)(MD5_CONTEXT *))r_init = md5_init; + *(void (**)(MD5_CONTEXT *, byte*, size_t))r_write = md5_write; + *(void (**)(MD5_CONTEXT *))r_final = md5_final; + *(byte *(**)(MD5_CONTEXT *))r_read = md5_read; return "MD5"; } diff --git a/cipher/rmd160.c b/cipher/rmd160.c index ecd65b35d..fba910d7e 100644 --- a/cipher/rmd160.c +++ b/cipher/rmd160.c @@ -562,10 +562,10 @@ rmd160_get_info( int algo, size_t *contextsize, *r_asnoid = asn; *r_asnlen = DIM(asn); *r_mdlen = 20; - *r_init = (void (*)(void *))rmd160_init; - *r_write = (void (*)(void *, byte*, size_t))rmd160_write; - *r_final = (void (*)(void *))rmd160_final; - *r_read = (byte *(*)(void *))rmd160_read; + *(void (**)(RMD160_CONTEXT *))r_init = rmd160_init; + *(void (**)(RMD160_CONTEXT *, byte*, size_t))r_write = rmd160_write; + *(void (**)(RMD160_CONTEXT *))r_final = rmd160_final; + *(byte *(**)(RMD160_CONTEXT *))r_read = rmd160_read; return "RIPEMD160"; } diff --git a/cipher/sha1.c b/cipher/sha1.c index 40ad62f1f..e47cc5e60 100644 --- a/cipher/sha1.c +++ b/cipher/sha1.c @@ -341,6 +341,10 @@ sha1_get_info( int algo, size_t *contextsize, *r_write = (void (*)(void *, byte*, size_t))sha1_write; *r_final = (void (*)(void *))sha1_final; *r_read = (byte *(*)(void *))sha1_read; + *(void (**)(SHA1_CONTEXT *))r_init = sha1_init; + *(void (**)(SHA1_CONTEXT *, byte*, size_t))r_write = sha1_write; + *(void (**)(SHA1_CONTEXT *))r_final = sha1_final; + *(byte *(**)(SHA1_CONTEXT *))r_read = sha1_read; return "SHA1"; } diff --git a/cipher/tiger.c b/cipher/tiger.c index 0765f0bbd..e4a7c4daa 100644 --- a/cipher/tiger.c +++ b/cipher/tiger.c @@ -899,10 +899,10 @@ tiger_get_info( int algo, size_t *contextsize, *r_asnoid = asn; *r_asnlen = DIM(asn); *r_mdlen = 24; - *r_init = (void (*)(void *))tiger_init; - *r_write = (void (*)(void *, byte*, size_t))tiger_write; - *r_final = (void (*)(void *))tiger_final; - *r_read = (byte *(*)(void *))tiger_read; + *(void (**)(TIGER_CONTEXT *))r_init = tiger_init; + *(void (**)(TIGER_CONTEXT *, byte*, size_t))r_write = tiger_write; + *(void (**)(TIGER_CONTEXT *))r_final = tiger_final; + *(byte *(**)(TIGER_CONTEXT *))r_read = tiger_read; return "TIGER"; } diff --git a/cipher/twofish.c b/cipher/twofish.c index 182f18c49..157a13735 100644 --- a/cipher/twofish.c +++ b/cipher/twofish.c @@ -35,10 +35,6 @@ /* Prototype for the self-test function. */ static const char *selftest(void); -/* Macros used by the info function. */ -#define FNCCAST_SETKEY(f) ((int(*)(void*, byte*, unsigned))(f)) -#define FNCCAST_CRYPT(f) ((void(*)(void*, byte*, byte*))(f)) - /* Structure for an expanded Twofish key. s contains the key-dependent * S-boxes composed with the MDS matrix; w contains the eight "whitening" * subkeys, K[0] through K[7]. k holds the remaining, "round" subkeys. Note @@ -991,16 +987,19 @@ twofish_get_info (int algo, size_t *keylen, *keylen = algo==10? 256 : 128; *blocksize = 16; *contextsize = sizeof (TWOFISH_context); - *r_setkey = FNCCAST_SETKEY (twofish_setkey); - *r_encrypt= FNCCAST_CRYPT (twofish_encrypt); - *r_decrypt= FNCCAST_CRYPT (twofish_decrypt); - - if( algo == 10 ) - return "TWOFISH"; - if (algo == 102) /* This algorithm number is assigned for - * experiments, so we can use it */ - return "TWOFISH128"; - return NULL; + *(int (**)(const TWOFISH_context*, byte*, unsigned))r_setkey + = twofish_setkey; + *(void (**)(const TWOFISH_context*, byte*, byte*))r_encrypt + = twofish_encrypt; + *(void (**)(const TWOFISH_context*, byte*, byte*))r_decrypt + = twofish_decrypt; + + if( algo == 10 ) + return "TWOFISH"; + if (algo == 102) /* This algorithm number is assigned for + * experiments, so we can use it */ + return "TWOFISH128"; + return NULL; } |