From: Niels Möller Date: Sat, 7 Feb 2004 12:31:01 +0000 (+0100) Subject: When calling des_key_sched and X-Git-Tag: nettle_1.9_release_20040207~13 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=05968af0ab6960eaa8393da58b34331d95457e31;p=thirdparty%2Fnettle.git When calling des_key_sched and des_ecb_encrypt, cst arguments to (void *). Openssl's typedefs des_cblock and const_des_cblock are too broken. Rev: src/nettle/examples/nettle-openssl.c:1.3 --- diff --git a/examples/nettle-openssl.c b/examples/nettle-openssl.c index f50490aa..fcc7169e 100644 --- a/examples/nettle-openssl.c +++ b/examples/nettle-openssl.c @@ -93,7 +93,9 @@ static void openssl_des_set_key(void *ctx, unsigned length, const uint8_t *key) { assert(length == 8); - des_key_sched((char *) key, ctx); + /* Explicit cast used as I don't want to care about openssl's broken + array typedefs des_cblock and const_des_cblock. */ + des_key_sched( (void *) key, ctx); } #define DES_BLOCK_SIZE 8 @@ -105,7 +107,7 @@ openssl_des_encrypt(void *ctx, unsigned length, assert (!(length % DES_BLOCK_SIZE)); while (length) { - des_ecb_encrypt((char *) src, (char *) dst, ctx, DES_ENCRYPT); + des_ecb_encrypt( (void *) src, (void *) dst, ctx, DES_ENCRYPT); length -= DES_BLOCK_SIZE; dst += DES_BLOCK_SIZE; src += DES_BLOCK_SIZE; @@ -119,7 +121,7 @@ openssl_des_decrypt(void *ctx, unsigned length, assert (!(length % DES_BLOCK_SIZE)); while (length) { - des_ecb_encrypt((char *) src, (char *) dst, ctx, DES_DECRYPT); + des_ecb_encrypt( (void *) src, (void *) dst, ctx, DES_DECRYPT); length -= DES_BLOCK_SIZE; dst += DES_BLOCK_SIZE; src += DES_BLOCK_SIZE;