Commit 05968af0 authored by Niels Möller's avatar Niels Möller
Browse files

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
parent d2af04a6
......@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment