Commit 9446e80b authored by Niels Möller's avatar Niels Möller
Browse files

* testsuite/arctwo-test.c, arctwo.h, arctwo.c

(arctwo_set_key_ekb): Fixed typo; it should be "ekb", not "ebk".

Rev: src/nettle/arctwo.c:1.2
Rev: src/nettle/arctwo.h:1.2
Rev: src/nettle/testsuite/arctwo-test.c:1.2
parent 5c4fe9a7
...@@ -175,8 +175,8 @@ arctwo_decrypt (struct arctwo_ctx *ctx, ...@@ -175,8 +175,8 @@ arctwo_decrypt (struct arctwo_ctx *ctx,
} }
void void
arctwo_set_key_ebk (struct arctwo_ctx *ctx, arctwo_set_key_ekb (struct arctwo_ctx *ctx,
unsigned length, const uint8_t *key, unsigned ebk) unsigned length, const uint8_t *key, unsigned ekb)
{ {
unsigned i; unsigned i;
/* Expanded key, treated as octets */ /* Expanded key, treated as octets */
...@@ -185,7 +185,7 @@ arctwo_set_key_ebk (struct arctwo_ctx *ctx, ...@@ -185,7 +185,7 @@ arctwo_set_key_ebk (struct arctwo_ctx *ctx,
assert (length >= ARCTWO_MIN_KEY_SIZE); assert (length >= ARCTWO_MIN_KEY_SIZE);
assert (length <= ARCTWO_MAX_KEY_SIZE); assert (length <= ARCTWO_MAX_KEY_SIZE);
assert (ebk <= 1024); assert (ekb <= 1024);
for (i = 0; i < length; i++) for (i = 0; i < length; i++)
S[i] = key[i]; S[i] = key[i];
...@@ -196,12 +196,12 @@ arctwo_set_key_ebk (struct arctwo_ctx *ctx, ...@@ -196,12 +196,12 @@ arctwo_set_key_ebk (struct arctwo_ctx *ctx,
S[0] = arctwo_sbox[S[0]]; S[0] = arctwo_sbox[S[0]];
/* Reduce effective key size to ebk bits, if requested by caller. */ /* Reduce effective key size to ekb bits, if requested by caller. */
if (ebk > 0 && ebk < 1024) if (ekb > 0 && ekb < 1024)
{ {
int len = (ebk + 7) >> 3; int len = (ekb + 7) >> 3;
i = 128 - len; i = 128 - len;
x = arctwo_sbox[S[i] & (255 >> (7 & -ebk))]; x = arctwo_sbox[S[i] & (255 >> (7 & -ekb))];
S[i] = x; S[i] = x;
while (i--) while (i--)
...@@ -219,12 +219,12 @@ arctwo_set_key_ebk (struct arctwo_ctx *ctx, ...@@ -219,12 +219,12 @@ arctwo_set_key_ebk (struct arctwo_ctx *ctx,
void void
arctwo_set_key (struct arctwo_ctx *ctx, unsigned length, const uint8_t *key) arctwo_set_key (struct arctwo_ctx *ctx, unsigned length, const uint8_t *key)
{ {
arctwo_set_key_ebk (ctx, length, key, 8 * length); arctwo_set_key_ekb (ctx, length, key, 8 * length);
} }
void void
arctwo_set_key_gutmann (struct arctwo_ctx *ctx, arctwo_set_key_gutmann (struct arctwo_ctx *ctx,
unsigned length, const uint8_t *key) unsigned length, const uint8_t *key)
{ {
arctwo_set_key_ebk (ctx, length, key, 0); arctwo_set_key_ekb (ctx, length, key, 0);
} }
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
/* Name mangling */ /* Name mangling */
#define arctwo_set_key nettle_arctwo_set_key #define arctwo_set_key nettle_arctwo_set_key
#define arctwo_set_key_ebk nettle_arctwo_set_key_ebk #define arctwo_set_key_ekb nettle_arctwo_set_key_ekb
#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_set_key_gutmann nettle_arctwo_set_key_gutmann
...@@ -52,14 +52,14 @@ struct arctwo_ctx ...@@ -52,14 +52,14 @@ struct arctwo_ctx
/* Key expansion function that takes the "effective key bits", 1-1024, /* Key expansion function that takes the "effective key bits", 1-1024,
as an explicit argument. 0 means maximum key bits. */ as an explicit argument. 0 means maximum key bits. */
void void
arctwo_set_key_ebk (struct arctwo_ctx *ctx, arctwo_set_key_ekb (struct arctwo_ctx *ctx,
unsigned length, const uint8_t * key, unsigned ebk); unsigned length, const uint8_t * key, unsigned ekb);
/* Equvivalent to arctwo_set_key_ebk, with ebk = 8 * length */ /* Equvivalent to arctwo_set_key_ekb, with ekb = 8 * length */
void void
arctwo_set_key (struct arctwo_ctx *ctx, unsigned length, const uint8_t *key); arctwo_set_key (struct arctwo_ctx *ctx, unsigned length, const uint8_t *key);
/* Equvivalent to arctwo_set_key_ebk, with ebk = 1024 */ /* Equvivalent to arctwo_set_key_ekb, with ekb = 1024 */
/* FIXME: Is this function really needed, and if so, what's the right /* FIXME: Is this function really needed, and if so, what's the right
name for it? */ name for it? */
void void
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
/* For tests with obscure values of ebk. */ /* For tests with obscure values of ebk. */
static void static void
test_arctwo(unsigned ebk, test_arctwo(unsigned ekb,
unsigned key_length, unsigned key_length,
const uint8_t *key, const uint8_t *key,
unsigned length, unsigned length,
...@@ -34,7 +34,7 @@ test_arctwo(unsigned ebk, ...@@ -34,7 +34,7 @@ test_arctwo(unsigned ebk,
struct arctwo_ctx ctx; struct arctwo_ctx ctx;
uint8_t *data = xalloc(length); uint8_t *data = xalloc(length);
arctwo_set_key_ebk(&ctx, key_length, key, ebk); arctwo_set_key_ekb(&ctx, key_length, key, ekb);
arctwo_encrypt(&ctx, length, data, cleartext); arctwo_encrypt(&ctx, length, data, cleartext);
if (!MEMEQ(length, data, ciphertext)) if (!MEMEQ(length, data, ciphertext))
......
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