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> 2014-01-27 Niels Möller <nisse@lysator.liu.se>
* eax.h (struct eax_key, struct eax_ctx): Use union * eax.h (struct eax_key, struct eax_ctx): Use union
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
/* nettle, low-level cryptographics library /* 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 * 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 * it under the terms of the GNU Lesser General Public License as published by
...@@ -30,28 +30,11 @@ ...@@ -30,28 +30,11 @@
#include "aes.h" #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 = const struct nettle_cipher nettle_aes128 =
{ "aes128", sizeof(struct aes128_ctx), { "aes128", sizeof(struct aes128_ctx),
AES_BLOCK_SIZE, AES128_KEY_SIZE, AES_BLOCK_SIZE, AES128_KEY_SIZE,
aes128_set_encrypt_key_wrapper, (nettle_set_key_func *) aes128_set_encrypt_key,
aes128_set_decrypt_key_wrapper, (nettle_set_key_func *) aes128_set_decrypt_key,
(nettle_crypt_func *) aes128_encrypt, (nettle_crypt_func *) aes128_encrypt,
(nettle_crypt_func *) aes128_decrypt (nettle_crypt_func *) aes128_decrypt
}; };
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
/* nettle, low-level cryptographics library /* 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 * 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 * it under the terms of the GNU Lesser General Public License as published by
...@@ -30,28 +30,11 @@ ...@@ -30,28 +30,11 @@
#include "aes.h" #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 = const struct nettle_cipher nettle_aes192 =
{ "aes192", sizeof(struct aes192_ctx), { "aes192", sizeof(struct aes192_ctx),
AES_BLOCK_SIZE, AES192_KEY_SIZE, AES_BLOCK_SIZE, AES192_KEY_SIZE,
aes192_set_encrypt_key_wrapper, (nettle_set_key_func *) aes192_set_encrypt_key,
aes192_set_decrypt_key_wrapper, (nettle_set_key_func *) aes192_set_decrypt_key,
(nettle_crypt_func *) aes192_encrypt, (nettle_crypt_func *) aes192_encrypt,
(nettle_crypt_func *) aes192_decrypt (nettle_crypt_func *) aes192_decrypt
}; };
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
/* nettle, low-level cryptographics library /* 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 * 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 * it under the terms of the GNU Lesser General Public License as published by
...@@ -30,28 +30,11 @@ ...@@ -30,28 +30,11 @@
#include "aes.h" #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 = const struct nettle_cipher nettle_aes256 =
{ "aes256", sizeof(struct aes256_ctx), { "aes256", sizeof(struct aes256_ctx),
AES_BLOCK_SIZE, AES256_KEY_SIZE, AES_BLOCK_SIZE, AES256_KEY_SIZE,
aes256_set_encrypt_key_wrapper, (nettle_set_key_func *) aes256_set_encrypt_key,
aes256_set_decrypt_key_wrapper, (nettle_set_key_func *) aes256_set_decrypt_key,
(nettle_crypt_func *) aes256_encrypt, (nettle_crypt_func *) aes256_encrypt,
(nettle_crypt_func *) aes256_decrypt (nettle_crypt_func *) aes256_decrypt
}; };
...@@ -30,9 +30,9 @@ ...@@ -30,9 +30,9 @@
const struct nettle_cipher nettle_arcfour128 = const struct nettle_cipher nettle_arcfour128 =
{ "arcfour128", sizeof(struct arcfour_ctx), { "arcfour128", sizeof(struct arcfour_ctx),
0, 16, 0, ARCFOUR128_KEY_SIZE,
(nettle_set_key_func *) arcfour_set_key, (nettle_set_key_func *) arcfour128_set_key,
(nettle_set_key_func *) arcfour_set_key, (nettle_set_key_func *) arcfour128_set_key,
(nettle_crypt_func *) arcfour_crypt, (nettle_crypt_func *) arcfour_crypt,
(nettle_crypt_func *) arcfour_crypt (nettle_crypt_func *) arcfour_crypt
}; };
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
/* nettle, low-level cryptographics library /* 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 * 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 * 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, ...@@ -56,3 +56,8 @@ arcfour_set_key(struct arcfour_ctx *ctx,
ctx->i = ctx->j = 0; 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 @@ ...@@ -5,7 +5,7 @@
/* nettle, low-level cryptographics library /* 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 * 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 * it under the terms of the GNU Lesser General Public License as published by
...@@ -33,6 +33,7 @@ extern "C" { ...@@ -33,6 +33,7 @@ extern "C" {
#endif #endif
/* Name mangling */ /* Name mangling */
#define arcfour128_set_key nettle_arcfour128_set_key
#define arcfour_set_key nettle_arcfour_set_key #define arcfour_set_key nettle_arcfour_set_key
#define arcfour_crypt nettle_arcfour_crypt #define arcfour_crypt nettle_arcfour_crypt
...@@ -41,6 +42,7 @@ extern "C" { ...@@ -41,6 +42,7 @@ extern "C" {
#define ARCFOUR_MIN_KEY_SIZE 1 #define ARCFOUR_MIN_KEY_SIZE 1
#define ARCFOUR_MAX_KEY_SIZE 256 #define ARCFOUR_MAX_KEY_SIZE 256
#define ARCFOUR_KEY_SIZE 16 #define ARCFOUR_KEY_SIZE 16
#define ARCFOUR128_KEY_SIZE 16
struct arcfour_ctx struct arcfour_ctx
{ {
...@@ -53,6 +55,9 @@ void ...@@ -53,6 +55,9 @@ void
arcfour_set_key(struct arcfour_ctx *ctx, arcfour_set_key(struct arcfour_ctx *ctx,
size_t length, const uint8_t *key); size_t length, const uint8_t *key);
void
arcfour128_set_key(struct arcfour_ctx *ctx, const uint8_t *key);
void void
arcfour_crypt(struct arcfour_ctx *ctx, arcfour_crypt(struct arcfour_ctx *ctx,
size_t length, uint8_t *dst, size_t length, uint8_t *dst,
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
/* nettle, low-level cryptographics library /* nettle, low-level cryptographics library
* *
* Copyright (C) 2004 Simon Josefsson * Copyright (C) 2004 Simon Josefsson
* Copyright (C) 2014 Niels Möller
* *
* The nettle library is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU Lesser General Public License as published by
...@@ -28,21 +29,28 @@ ...@@ -28,21 +29,28 @@
#include "arctwo.h" #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 const struct nettle_cipher nettle_arctwo40
= _NETTLE_CIPHER (arctwo, ARCTWO, 40); = ARCTWO(40);
const struct nettle_cipher nettle_arctwo64 const struct nettle_cipher nettle_arctwo64
= _NETTLE_CIPHER (arctwo, ARCTWO, 64); = ARCTWO(64);
const struct nettle_cipher nettle_arctwo128 const struct nettle_cipher nettle_arctwo128
= _NETTLE_CIPHER (arctwo, ARCTWO, 128); = ARCTWO(128);
/* Map Gutmann variant. */ /* Gutmann variant. */
#define arctwo_gutmann_ctx arctwo_ctx const struct nettle_cipher nettle_arctwo_gutmann128 =
#define arctwo_gutmann_encrypt arctwo_encrypt {
#define arctwo_gutmann_decrypt arctwo_decrypt "arctwo_gutmann128", sizeof (struct arctwo_ctx),
#define arctwo_gutmann_ctx arctwo_ctx ARCTWO_BLOCK_SIZE, 16,
#define arctwo_gutmann_set_key arctwo_set_key_gutmann (nettle_set_key_func *) arctwo128_set_key_gutmann,
(nettle_set_key_func *) arctwo128_set_key_gutmann,
const struct nettle_cipher nettle_arctwo_gutmann128 (nettle_crypt_func *) arctwo_encrypt,
= _NETTLE_CIPHER (arctwo_gutmann, ARCTWO, 128); (nettle_crypt_func *) arctwo_decrypt,
};
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* Copyright (C) 2004 Simon Josefsson * Copyright (C) 2004 Simon Josefsson
* Copyright (C) 2003 Nikos Mavroyanopoulos * Copyright (C) 2003 Nikos Mavroyanopoulos
* Copyright (C) 2004 Free Software Foundation, Inc. * 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 * 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 * 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, ...@@ -228,3 +228,26 @@ arctwo_set_key_gutmann (struct arctwo_ctx *ctx,
{ {
arctwo_set_key_ekb (ctx, length, key, 0); 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 @@ ...@@ -6,7 +6,7 @@
/* nettle, low-level cryptographics library /* nettle, low-level cryptographics library
* *
* Copyright (C) 2004 Simon Josefsson * 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 * 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 * it under the terms of the GNU Lesser General Public License as published by
...@@ -36,9 +36,13 @@ extern "C" { ...@@ -36,9 +36,13 @@ extern "C" {
/* Name mangling */ /* Name mangling */
#define arctwo_set_key nettle_arctwo_set_key #define arctwo_set_key nettle_arctwo_set_key
#define arctwo_set_key_ekb nettle_arctwo_set_key_ekb #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_encrypt nettle_arctwo_encrypt
#define arctwo_decrypt nettle_arctwo_decrypt #define arctwo_decrypt nettle_arctwo_decrypt
#define arctwo_set_key_gutmann nettle_arctwo_set_key_gutmann
#define ARCTWO_BLOCK_SIZE 8 #define ARCTWO_BLOCK_SIZE 8
...@@ -62,11 +66,20 @@ arctwo_set_key_ekb (struct arctwo_ctx *ctx, ...@@ -62,11 +66,20 @@ arctwo_set_key_ekb (struct arctwo_ctx *ctx,
/* Equvivalent to arctwo_set_key_ekb, with ekb = 8 * length */ /* Equvivalent to arctwo_set_key_ekb, with ekb = 8 * length */
void void
arctwo_set_key (struct arctwo_ctx *ctx, size_t length, const uint8_t *key); 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 */ /* Equvivalent to arctwo_set_key_ekb, with ekb = 1024 */
void void
arctwo_set_key_gutmann (struct arctwo_ctx *ctx, arctwo_set_key_gutmann (struct arctwo_ctx *ctx,
size_t length, const uint8_t *key); size_t length, const uint8_t *key);
void
arctwo128_set_key_gutmann (struct arctwo_ctx *ctx,
const uint8_t *key);
void void
arctwo_encrypt (struct arctwo_ctx *ctx, arctwo_encrypt (struct arctwo_ctx *ctx,
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
/* nettle, low-level cryptographics library /* 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 * 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 * it under the terms of the GNU Lesser General Public License as published by
...@@ -30,25 +30,11 @@ ...@@ -30,25 +30,11 @@
#include "camellia.h" #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 = const struct nettle_cipher nettle_camellia128 =
{ "camellia128", sizeof(struct camellia128_ctx), { "camellia128", sizeof(struct camellia128_ctx),
CAMELLIA_BLOCK_SIZE, CAMELLIA128_KEY_SIZE, CAMELLIA_BLOCK_SIZE, CAMELLIA128_KEY_SIZE,
camellia128_set_encrypt_key_wrapper, (nettle_set_key_func *) camellia128_set_encrypt_key,
camellia128_set_decrypt_key_wrapper, (nettle_set_key_func *) camellia128_set_decrypt_key,
(nettle_crypt_func *) camellia128_crypt, (nettle_crypt_func *) camellia128_crypt,
(nettle_crypt_func *) camellia128_crypt (nettle_crypt_func *) camellia128_crypt
}; };
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
/* nettle, low-level cryptographics library /* 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 * 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 * it under the terms of the GNU Lesser General Public License as published by
...@@ -30,25 +30,11 @@ ...@@ -30,25 +30,11 @@
#include "camellia.h" #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 = const struct nettle_cipher nettle_camellia192 =
{ "camellia192", sizeof(struct camellia256_ctx), { "camellia192", sizeof(struct camellia256_ctx),
CAMELLIA_BLOCK_SIZE, CAMELLIA192_KEY_SIZE, CAMELLIA_BLOCK_SIZE, CAMELLIA192_KEY_SIZE,
camellia192_set_encrypt_key_wrapper, (nettle_set_key_func *) camellia192_set_encrypt_key,
camellia192_set_decrypt_key_wrapper, (nettle_set_key_func *) camellia192_set_decrypt_key,
(nettle_crypt_func *) camellia256_crypt, (nettle_crypt_func *) camellia256_crypt,
(nettle_crypt_func *) camellia256_crypt (nettle_crypt_func *) camellia256_crypt
}; };
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
/* nettle, low-level cryptographics library /* 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 * 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 * it under the terms of the GNU Lesser General Public License as published by
...@@ -30,25 +30,11 @@ ...@@ -30,25 +30,11 @@
#include "camellia.h" #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 = const struct nettle_cipher nettle_camellia256 =
{ "camellia256", sizeof(struct camellia256_ctx), { "camellia256", sizeof(struct camellia256_ctx),
CAMELLIA_BLOCK_SIZE, CAMELLIA256_KEY_SIZE, CAMELLIA_BLOCK_SIZE, CAMELLIA256_KEY_SIZE,
camellia256_set_encrypt_key_wrapper, (nettle_set_key_func *) camellia256_set_encrypt_key,
camellia256_set_decrypt_key_wrapper, (nettle_set_key_func *) camellia256_set_decrypt_key,
(nettle_crypt_func *) camellia256_crypt, (nettle_crypt_func *) camellia256_crypt,
(nettle_crypt_func *) camellia256_crypt (nettle_crypt_func *) camellia256_crypt
}; };
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
/* nettle, low-level cryptographics library /* 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 * 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