Commit 58785537 authored by Niels Möller's avatar Niels Möller

Dropped length argument from nettle_set_key_func.

parent f508b1fe
2014-01-29 Niels Möller <nisse@lysator.liu.se>
* nettle-types.h (typedef nettle_set_key_func): Deleted length
argument.
* arctwo.c (arctwo40_set_key, arctwo64_set_key)
(arctwo128_set_key, arctwo128_set_key_gutmann): New functions.
* arctwo.h: Declare them.
* arctwo-meta.c (ARCTWO): New macro.
(nettle_arctwo40, nettle_arctwo64, nettle_arctwo128)
(nettle_arctwo_gutmann128): Use new _set_key functions.
* arcfour.h (ARCFOUR128_KEY_SIZE): New constant.
* arcfour.c (arcfour128_set_key): New function.
* arcfour-meta.c (nettle_arcfour128): Use arcfour128_set_key and
ARCFOUR128_KEY_SIZE.
* cast128.c (cast5_set_key): Renamed, was cast128_set_key.
(cast128_set_key): New definition, with fixed key size.
* cast128.h (CAST128_MIN_KEY_SIZE, CAST128_MAX_KEY_SIZE): Renamed
constants, to...
(CAST5_MIN_KEY_SIZE, CAST5_MAX_KEY_SIZE): ... new names.
* eax.h (EAX_SET_KEY): Deleted length argument.
* aes128-meta.c: Deleted _set_key wrappers.
* aes192-meta.c: Likewise.
* aes256-meta.c: Likewise.
* camellia128-meta.c: Likewise.
* camellia192-meta.c: Likewise.
* camellia256-meta.c: Likewise.
* gcm-aes128.c (gcm_aes128_set_key): Deleted length argument.
* gcm-aes192.c (gcm_aes192_set_key): Likewise.
* gcm-aes256.c (gcm_aes256_set_key): Likewise.
* gcm.h: Updated prototypes.
* serpent-set-key.c (serpent128_set_key, serpent192_set_key)
(serpent256_set_key): New functions.
* serpent.h: Declare new functions.
(SERPENT128_KEY_SIZE, SERPENT192_KEY_SIZE)
(SERPENT256_KEY_SIZE): New constants.
* serpent-meta.c (SERPENT): New macro.
(nettle_serpent128, nettle_serpent192, nettle_serpent256): Use new
_set_key functions.
* twofish-set-key.c (twofish128_set_key, twofish192_set_key)
(twofish256_set_key): New functions.
* twofish.h: Declare new functions.
(TWOFISH128_KEY_SIZE, TWOFISH192_KEY_SIZE)
(TWOFISH256_KEY_SIZE): New constants.
* twofish-meta.c (TWOFISH): New macro.
(nettle_twofish128, nettle_twofish192, nettle_twofish256): Use new
_set_key functions.
* nettle-internal.h (struct nettle_aead): Use
nettle_hash_update_func for the set_iv function pointer.
* nettle-internal.c (des_set_key_hack, des3_set_key_hack): Deleted
wrapper functions.
(chacha_set_key_hack): Deleted length argument. Use
chacha256_set_key.
(salsa20_set_key_hack): Deleted length argument. Use
salsa20_256_set_key.
(nettle_unified_aes128, nettle_unified_aes192)
(nettle_unified_aes256): Deleted, moved to test program.
(eax_aes128_set_key): Deleted length argument. Use EAX_SET_KEY.
* examples/nettle-benchmark.c: Updated for _set_key changes.
* examples/nettle-openssl.c: Likewise.
* testsuite/testutils.c: Likewise.
* testsuite/gcm-test.c: Likewise.
* testsuite/aes-test.c (UNIFIED_AES): New macro. Moved glue for
testing the old aes interface (struct aes_ctx) here.
* testsuite/arcfour-test.c (test_arcfour): New function, for key
sizes != 128 bits.
(test_main): Use it.
* testsuite/blowfish-test.c (test_blowfish): New function.
(test_main): Use it. Also deleted old #if:ed out code.
* testsuite/cast128-test.c (test_cast5): New function.
(test_main): Use it, for 40-bit and 80-bit tests.
* testsuite/serpent-test.c (test_serpent): New function.
(test_main): Use it.
2014-01-27 Niels Möller <nisse@lysator.liu.se>
* eax.h (struct eax_key, struct eax_ctx): Use union
......
......@@ -2,7 +2,7 @@
/* nettle, low-level cryptographics library
*
* Copyright (C) 2013 Niels Möller
* Copyright (C) 2013, 2014 Niels Möller
*
* The nettle library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
......@@ -30,28 +30,11 @@
#include "aes.h"
static nettle_set_key_func aes128_set_encrypt_key_wrapper;
static nettle_set_key_func aes128_set_decrypt_key_wrapper;
static void
aes128_set_encrypt_key_wrapper (void *ctx, size_t length, const uint8_t *key)
{
assert (length == AES128_KEY_SIZE);
aes128_set_encrypt_key (ctx, key);
}
static void
aes128_set_decrypt_key_wrapper (void *ctx, size_t length, const uint8_t *key)
{
assert (length == AES128_KEY_SIZE);
aes128_set_decrypt_key (ctx, key);
}
const struct nettle_cipher nettle_aes128 =
{ "aes128", sizeof(struct aes128_ctx),
AES_BLOCK_SIZE, AES128_KEY_SIZE,
aes128_set_encrypt_key_wrapper,
aes128_set_decrypt_key_wrapper,
(nettle_set_key_func *) aes128_set_encrypt_key,
(nettle_set_key_func *) aes128_set_decrypt_key,
(nettle_crypt_func *) aes128_encrypt,
(nettle_crypt_func *) aes128_decrypt
};
......@@ -2,7 +2,7 @@
/* nettle, low-level cryptographics library
*
* Copyright (C) 2013 Niels Möller
* Copyright (C) 2013, 2014 Niels Möller
*
* The nettle library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
......@@ -30,28 +30,11 @@
#include "aes.h"
static nettle_set_key_func aes192_set_encrypt_key_wrapper;
static nettle_set_key_func aes192_set_decrypt_key_wrapper;
static void
aes192_set_encrypt_key_wrapper (void *ctx, size_t length, const uint8_t *key)
{
assert (length == AES192_KEY_SIZE);
aes192_set_encrypt_key (ctx, key);
}
static void
aes192_set_decrypt_key_wrapper (void *ctx, size_t length, const uint8_t *key)
{
assert (length == AES192_KEY_SIZE);
aes192_set_decrypt_key (ctx, key);
}
const struct nettle_cipher nettle_aes192 =
{ "aes192", sizeof(struct aes192_ctx),
AES_BLOCK_SIZE, AES192_KEY_SIZE,
aes192_set_encrypt_key_wrapper,
aes192_set_decrypt_key_wrapper,
(nettle_set_key_func *) aes192_set_encrypt_key,
(nettle_set_key_func *) aes192_set_decrypt_key,
(nettle_crypt_func *) aes192_encrypt,
(nettle_crypt_func *) aes192_decrypt
};
......@@ -2,7 +2,7 @@
/* nettle, low-level cryptographics library
*
* Copyright (C) 2013 Niels Möller
* Copyright (C) 2013, 2014 Niels Möller
*
* The nettle library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
......@@ -30,28 +30,11 @@
#include "aes.h"
static nettle_set_key_func aes256_set_encrypt_key_wrapper;
static nettle_set_key_func aes256_set_decrypt_key_wrapper;
static void
aes256_set_encrypt_key_wrapper (void *ctx, size_t length, const uint8_t *key)
{
assert (length == AES256_KEY_SIZE);
aes256_set_encrypt_key (ctx, key);
}
static void
aes256_set_decrypt_key_wrapper (void *ctx, size_t length, const uint8_t *key)
{
assert (length == AES256_KEY_SIZE);
aes256_set_decrypt_key (ctx, key);
}
const struct nettle_cipher nettle_aes256 =
{ "aes256", sizeof(struct aes256_ctx),
AES_BLOCK_SIZE, AES256_KEY_SIZE,
aes256_set_encrypt_key_wrapper,
aes256_set_decrypt_key_wrapper,
(nettle_set_key_func *) aes256_set_encrypt_key,
(nettle_set_key_func *) aes256_set_decrypt_key,
(nettle_crypt_func *) aes256_encrypt,
(nettle_crypt_func *) aes256_decrypt
};
......@@ -30,9 +30,9 @@
const struct nettle_cipher nettle_arcfour128 =
{ "arcfour128", sizeof(struct arcfour_ctx),
0, 16,
(nettle_set_key_func *) arcfour_set_key,
(nettle_set_key_func *) arcfour_set_key,
0, ARCFOUR128_KEY_SIZE,
(nettle_set_key_func *) arcfour128_set_key,
(nettle_set_key_func *) arcfour128_set_key,
(nettle_crypt_func *) arcfour_crypt,
(nettle_crypt_func *) arcfour_crypt
};
......@@ -5,7 +5,7 @@
/* nettle, low-level cryptographics library
*
* Copyright (C) 2001 Niels Möller
* Copyright (C) 2001, 2014 Niels Möller
*
* The nettle library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
......@@ -56,3 +56,8 @@ arcfour_set_key(struct arcfour_ctx *ctx,
ctx->i = ctx->j = 0;
}
void
arcfour128_set_key(struct arcfour_ctx *ctx, const uint8_t *key)
{
arcfour_set_key (ctx, ARCFOUR128_KEY_SIZE, key);
}
......@@ -5,7 +5,7 @@
/* nettle, low-level cryptographics library
*
* Copyright (C) 2001 Niels Möller
* Copyright (C) 2001, 2014 Niels Möller
*
* The nettle library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
......@@ -33,6 +33,7 @@ extern "C" {
#endif
/* Name mangling */
#define arcfour128_set_key nettle_arcfour128_set_key
#define arcfour_set_key nettle_arcfour_set_key
#define arcfour_crypt nettle_arcfour_crypt
......@@ -41,6 +42,7 @@ extern "C" {
#define ARCFOUR_MIN_KEY_SIZE 1
#define ARCFOUR_MAX_KEY_SIZE 256
#define ARCFOUR_KEY_SIZE 16
#define ARCFOUR128_KEY_SIZE 16
struct arcfour_ctx
{
......@@ -53,6 +55,9 @@ void
arcfour_set_key(struct arcfour_ctx *ctx,
size_t length, const uint8_t *key);
void
arcfour128_set_key(struct arcfour_ctx *ctx, const uint8_t *key);
void
arcfour_crypt(struct arcfour_ctx *ctx,
size_t length, uint8_t *dst,
......
......@@ -3,6 +3,7 @@
/* nettle, low-level cryptographics library
*
* Copyright (C) 2004 Simon Josefsson
* Copyright (C) 2014 Niels Möller
*
* The nettle library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
......@@ -28,21 +29,28 @@
#include "arctwo.h"
#define ARCTWO(bits) { \
"arctwo" #bits, sizeof (struct arctwo_ctx), \
ARCTWO_BLOCK_SIZE, bits/8, \
(nettle_set_key_func *) arctwo ## bits ## _set_key, \
(nettle_set_key_func *) arctwo ## bits ## _set_key, \
(nettle_crypt_func *) arctwo_encrypt, \
(nettle_crypt_func *) arctwo_decrypt, \
}
const struct nettle_cipher nettle_arctwo40
= _NETTLE_CIPHER (arctwo, ARCTWO, 40);
= ARCTWO(40);
const struct nettle_cipher nettle_arctwo64
= _NETTLE_CIPHER (arctwo, ARCTWO, 64);
= ARCTWO(64);
const struct nettle_cipher nettle_arctwo128
= _NETTLE_CIPHER (arctwo, ARCTWO, 128);
/* Map Gutmann variant. */
#define arctwo_gutmann_ctx arctwo_ctx
#define arctwo_gutmann_encrypt arctwo_encrypt
#define arctwo_gutmann_decrypt arctwo_decrypt
#define arctwo_gutmann_ctx arctwo_ctx
#define arctwo_gutmann_set_key arctwo_set_key_gutmann
const struct nettle_cipher nettle_arctwo_gutmann128
= _NETTLE_CIPHER (arctwo_gutmann, ARCTWO, 128);
= ARCTWO(128);
/* Gutmann variant. */
const struct nettle_cipher nettle_arctwo_gutmann128 =
{
"arctwo_gutmann128", sizeof (struct arctwo_ctx),
ARCTWO_BLOCK_SIZE, 16,
(nettle_set_key_func *) arctwo128_set_key_gutmann,
(nettle_set_key_func *) arctwo128_set_key_gutmann,
(nettle_crypt_func *) arctwo_encrypt,
(nettle_crypt_func *) arctwo_decrypt,
};
......@@ -8,7 +8,7 @@
* Copyright (C) 2004 Simon Josefsson
* Copyright (C) 2003 Nikos Mavroyanopoulos
* Copyright (C) 2004 Free Software Foundation, Inc.
* Copyright (C) 2004 Niels Möller
* Copyright (C) 2004, 2014 Niels Möller
*
* The nettle library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
......@@ -228,3 +228,26 @@ arctwo_set_key_gutmann (struct arctwo_ctx *ctx,
{
arctwo_set_key_ekb (ctx, length, key, 0);
}
void
arctwo40_set_key (struct arctwo_ctx *ctx, const uint8_t *key)
{
arctwo_set_key_ekb (ctx, 5, key, 40);
}
void
arctwo64_set_key (struct arctwo_ctx *ctx, const uint8_t *key)
{
arctwo_set_key_ekb (ctx, 8, key, 64);
}
void
arctwo128_set_key (struct arctwo_ctx *ctx, const uint8_t *key)
{
arctwo_set_key_ekb (ctx, 16, key, 128);
}
void
arctwo128_set_key_gutmann (struct arctwo_ctx *ctx,
const uint8_t *key)
{
arctwo_set_key_ekb (ctx, 16, key, 1024);
}
......@@ -6,7 +6,7 @@
/* nettle, low-level cryptographics library
*
* Copyright (C) 2004 Simon Josefsson
* Copyright (C) 2002, 2004 Niels Möller
* Copyright (C) 2002, 2004, 2014 Niels Möller
*
* The nettle library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
......@@ -36,9 +36,13 @@ extern "C" {
/* Name mangling */
#define arctwo_set_key nettle_arctwo_set_key
#define arctwo_set_key_ekb nettle_arctwo_set_key_ekb
#define arctwo_set_key_gutmann nettle_arctwo_set_key_gutmann
#define arctwo40_set_key nettle_arctwo40_set_key
#define arctwo64_set_key nettle_arctwo64_set_key
#define arctwo128_set_key nettle_arctwo128_set_key
#define arctwo128_set_key_gutmann nettle_arctwo128_set_key_gutmann
#define arctwo_encrypt nettle_arctwo_encrypt
#define arctwo_decrypt nettle_arctwo_decrypt
#define arctwo_set_key_gutmann nettle_arctwo_set_key_gutmann
#define ARCTWO_BLOCK_SIZE 8
......@@ -62,11 +66,20 @@ arctwo_set_key_ekb (struct arctwo_ctx *ctx,
/* Equvivalent to arctwo_set_key_ekb, with ekb = 8 * length */
void
arctwo_set_key (struct arctwo_ctx *ctx, size_t length, const uint8_t *key);
void
arctwo40_set_key (struct arctwo_ctx *ctx, const uint8_t *key);
void
arctwo64_set_key (struct arctwo_ctx *ctx, const uint8_t *key);
void
arctwo128_set_key (struct arctwo_ctx *ctx, const uint8_t *key);
/* Equvivalent to arctwo_set_key_ekb, with ekb = 1024 */
void
arctwo_set_key_gutmann (struct arctwo_ctx *ctx,
size_t length, const uint8_t *key);
void
arctwo128_set_key_gutmann (struct arctwo_ctx *ctx,
const uint8_t *key);
void
arctwo_encrypt (struct arctwo_ctx *ctx,
......
......@@ -2,7 +2,7 @@
/* nettle, low-level cryptographics library
*
* Copyright (C) 2010, 2013 Niels Möller
* Copyright (C) 2010, 2013, 2014 Niels Möller
*
* The nettle library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
......@@ -30,25 +30,11 @@
#include "camellia.h"
static void
camellia128_set_encrypt_key_wrapper (void *ctx, size_t length, const uint8_t *key)
{
assert (length == CAMELLIA128_KEY_SIZE);
camellia128_set_encrypt_key (ctx, key);
}
static void
camellia128_set_decrypt_key_wrapper (void *ctx, size_t length, const uint8_t *key)
{
assert (length == CAMELLIA128_KEY_SIZE);
camellia128_set_decrypt_key (ctx, key);
}
const struct nettle_cipher nettle_camellia128 =
{ "camellia128", sizeof(struct camellia128_ctx),
CAMELLIA_BLOCK_SIZE, CAMELLIA128_KEY_SIZE,
camellia128_set_encrypt_key_wrapper,
camellia128_set_decrypt_key_wrapper,
(nettle_set_key_func *) camellia128_set_encrypt_key,
(nettle_set_key_func *) camellia128_set_decrypt_key,
(nettle_crypt_func *) camellia128_crypt,
(nettle_crypt_func *) camellia128_crypt
};
......@@ -2,7 +2,7 @@
/* nettle, low-level cryptographics library
*
* Copyright (C) 2010, 2013 Niels Möller
* Copyright (C) 2010, 2013, 2014 Niels Möller
*
* The nettle library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
......@@ -30,25 +30,11 @@
#include "camellia.h"
static void
camellia192_set_encrypt_key_wrapper (void *ctx, size_t length, const uint8_t *key)
{
assert (length == CAMELLIA192_KEY_SIZE);
camellia192_set_encrypt_key (ctx, key);
}
static void
camellia192_set_decrypt_key_wrapper (void *ctx, size_t length, const uint8_t *key)
{
assert (length == CAMELLIA192_KEY_SIZE);
camellia192_set_decrypt_key (ctx, key);
}
const struct nettle_cipher nettle_camellia192 =
{ "camellia192", sizeof(struct camellia256_ctx),
CAMELLIA_BLOCK_SIZE, CAMELLIA192_KEY_SIZE,
camellia192_set_encrypt_key_wrapper,
camellia192_set_decrypt_key_wrapper,
(nettle_set_key_func *) camellia192_set_encrypt_key,
(nettle_set_key_func *) camellia192_set_decrypt_key,
(nettle_crypt_func *) camellia256_crypt,
(nettle_crypt_func *) camellia256_crypt
};
......@@ -2,7 +2,7 @@
/* nettle, low-level cryptographics library
*
* Copyright (C) 2010, 2013 Niels Möller
* Copyright (C) 2010, 2013, 2014 Niels Möller
*
* The nettle library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
......@@ -30,25 +30,11 @@
#include "camellia.h"
static void
camellia256_set_encrypt_key_wrapper (void *ctx, size_t length, const uint8_t *key)
{
assert (length == CAMELLIA256_KEY_SIZE);
camellia256_set_encrypt_key (ctx, key);
}
static void
camellia256_set_decrypt_key_wrapper (void *ctx, size_t length, const uint8_t *key)
{
assert (length == CAMELLIA256_KEY_SIZE);
camellia256_set_decrypt_key (ctx, key);
}
const struct nettle_cipher nettle_camellia256 =
{ "camellia256", sizeof(struct camellia256_ctx),
CAMELLIA_BLOCK_SIZE, CAMELLIA256_KEY_SIZE,
camellia256_set_encrypt_key_wrapper,
camellia256_set_decrypt_key_wrapper,
(nettle_set_key_func *) camellia256_set_encrypt_key,
(nettle_set_key_func *) camellia256_set_decrypt_key,
(nettle_crypt_func *) camellia256_crypt,
(nettle_crypt_func *) camellia256_crypt
};
......@@ -11,7 +11,7 @@
/* nettle, low-level cryptographics library
*
* Copyright (C) 2001 Niels Möller
* Copyright (C) 2001, 2014 Niels Möller
*
* The nettle library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
......@@ -213,15 +213,15 @@ cast128_decrypt(const struct cast128_ctx *ctx,
} while (0)
void
cast128_set_key(struct cast128_ctx *ctx,
size_t length, const uint8_t *key)
cast5_set_key(struct cast128_ctx *ctx,
size_t length, const uint8_t *key)
{
uint32_t x0, x1, x2, x3, z0, z1, z2, z3;
uint32_t w;
int full;
assert (length >= CAST128_MIN_KEY_SIZE);
assert (length <= CAST128_MAX_KEY_SIZE);
assert (length >= CAST5_MIN_KEY_SIZE);
assert (length <= CAST5_MAX_KEY_SIZE);
full = (length > CAST_SMALL_KEY);
......@@ -269,3 +269,9 @@ cast128_set_key(struct cast128_ctx *ctx,
ctx->rounds = full ? 16 : 12;
}
void
cast128_set_key(struct cast128_ctx *ctx, const uint8_t *key)
{
cast5_set_key (ctx, CAST128_KEY_SIZE, key);
}
......@@ -11,7 +11,7 @@
/* nettle, low-level cryptographics library
*
* Copyright (C) 2001 Niels Möller
* Copyright (C) 2001, 2014 Niels Möller
*
* The nettle library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
......@@ -39,6 +39,7 @@ extern "C" {
#endif
/* Name mangling */
#define cast5_set_key nettle_cast5_set_key
#define cast128_set_key nettle_cast128_set_key
#define cast128_encrypt nettle_cast128_encrypt
#define cast128_decrypt nettle_cast128_decrypt
......@@ -46,8 +47,8 @@ extern "C" {
#define CAST128_BLOCK_SIZE 8
/* Variable key size between 40 and 128. */
#define CAST128_MIN_KEY_SIZE 5
#define CAST128_MAX_KEY_SIZE 16
#define CAST5_MIN_KEY_SIZE 5
#define CAST5_MAX_KEY_SIZE 16
#define CAST128_KEY_SIZE 16
......@@ -59,9 +60,13 @@ struct cast128_ctx
uint32_t Km[16];
};
/* Using variable key size. */
void
cast128_set_key(struct cast128_ctx *ctx,
size_t length, const uint8_t *key);
cast5_set_key(struct cast128_ctx *ctx,
size_t length, const uint8_t *key);
void
cast128_set_key(struct cast128_ctx *ctx, const uint8_t *key);
void
cast128_encrypt(const struct cast128_ctx *ctx,
......
......@@ -102,9 +102,9 @@ eax_digest (struct eax_ctx *eax, const struct eax_key *key,
#define EAX_CTX(type) \
{ struct eax_key key; struct eax_ctx eax; type cipher; }
#define EAX_SET_KEY(ctx, set_key, encrypt, length, data) \
#define EAX_SET_KEY(ctx, set_key, encrypt, data) \
do { \
(set_key)(&(ctx)->cipher, (length), (data)); \
(set_key)(&(ctx)->cipher, (data)); \
if (0) (encrypt) (&(ctx)->cipher, 0, (void *) 0, (void *) 0); \
eax_set_key (&(ctx)->key, &(ctx)->cipher, (nettle_crypt_func *) encrypt); \
} while (0)
......
......@@ -427,7 +427,7 @@ time_gcm(void)
uint8_t key[AES128_KEY_SIZE];
uint8_t iv[GCM_IV_SIZE];
gcm_aes128_set_key(&ctx, sizeof(key), key);
gcm_aes128_set_key(&ctx, key);
gcm_aes128_set_iv(&ctx, sizeof(iv), iv);
hinfo.ctx = &ctx;
......@@ -461,7 +461,7 @@ time_eax(void)
uint8_t key[AES128_KEY_SIZE];
uint8_t iv[EAX_BLOCK_SIZE];
eax_aes128_set_key (&ctx, sizeof(key), key);
eax_aes128_set_key (&ctx, key);
eax_aes128_set_nonce(&ctx, sizeof(iv), iv);
hinfo.ctx = &ctx;
......@@ -521,7 +521,7 @@ time_cipher(const struct nettle_cipher *cipher)
info.data = data;
init_key(cipher->key_size, key);
cipher->set_encrypt_key(ctx, cipher->key_size, key);
cipher->set_encrypt_key(ctx, key);
display(cipher->name, "ECB encrypt", cipher->block_size,
time_function(bench_cipher, &info));
......@@ -534,7 +534,7 @@ time_cipher(const struct nettle_cipher *cipher)
info.data = data;
init_key(cipher->key_size, key);
cipher->set_decrypt_key(ctx, cipher->key_size, key);
cipher->set_decrypt_key(ctx, key);
display(cipher->name, "ECB decrypt", cipher->block_size,
time_function(bench_cipher, &info));
......@@ -555,7 +555,7 @@ time_cipher(const struct nettle_cipher *cipher)
memset(iv, 0, sizeof(iv));
cipher->set_encrypt_key(ctx, cipher->key_size, key);
cipher->set_encrypt_key(ctx, key);
display(cipher->name, "CBC encrypt", cipher->block_size,
time_function(bench_cbc_encrypt, &info));
......@@ -571,7 +571,7 @@ time_cipher(const struct nettle_cipher *cipher)
memset(iv, 0, sizeof(iv));
cipher->set_decrypt_key(ctx, cipher->key_size, key);
cipher->set_decrypt_key(ctx, key);