From df3b1d654f62de31afd0116634f33732578e7bbe Mon Sep 17 00:00:00 2001 From: Moritz Bitsch Date: Wed, 27 Jan 2016 23:45:26 +0100 Subject: [PATCH] use define as key length for expand function --- speck.c | 2 +- speck.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/speck.c b/speck.c index 0acd7e4..20f96d1 100644 --- a/speck.c +++ b/speck.c @@ -26,7 +26,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #define RR(x, y, k) (y ^= x, y = ROR(y, 3), x ^= k, x -= y, x = ROL(x, 8)) #endif -void speck_expand(SPECK_TYPE const K[static 4], SPECK_TYPE S[static SPECK_ROUNDS]) +void speck_expand(SPECK_TYPE const K[static SPECK_KEY_LEN], SPECK_TYPE S[static SPECK_ROUNDS]) { SPECK_TYPE i, b = K[0]; SPECK_TYPE a[SPECK_KEY_LEN - 1]; diff --git a/speck.h b/speck.h index 9e64592..3ca88ab 100644 --- a/speck.h +++ b/speck.h @@ -45,7 +45,7 @@ extern "C" { #define SPECK_KEY_LEN 4 #endif -void speck_expand(SPECK_TYPE const K[static 4], SPECK_TYPE S[static SPECK_ROUNDS]); +void speck_expand(SPECK_TYPE const K[static SPECK_KEY_LEN], SPECK_TYPE S[static SPECK_ROUNDS]); void speck_encrypt(SPECK_TYPE const pt[static 2], SPECK_TYPE ct[static 2], SPECK_TYPE const K[static SPECK_ROUNDS]); void speck_decrypt(SPECK_TYPE const ct[static 2], SPECK_TYPE pt[static 2], SPECK_TYPE const K[static SPECK_ROUNDS]);