use define as key length for expand function

This commit is contained in:
Moritz Bitsch 2016-01-27 23:45:26 +01:00
parent 6e1ae6d9bd
commit df3b1d654f
2 changed files with 2 additions and 2 deletions

View file

@ -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)) #define RR(x, y, k) (y ^= x, y = ROR(y, 3), x ^= k, x -= y, x = ROL(x, 8))
#endif #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 i, b = K[0];
SPECK_TYPE a[SPECK_KEY_LEN - 1]; SPECK_TYPE a[SPECK_KEY_LEN - 1];

View file

@ -45,7 +45,7 @@ extern "C" {
#define SPECK_KEY_LEN 4 #define SPECK_KEY_LEN 4
#endif #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_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]); void speck_decrypt(SPECK_TYPE const ct[static 2], SPECK_TYPE pt[static 2], SPECK_TYPE const K[static SPECK_ROUNDS]);