From bbd42ca7a94daadb63781fa7714ea66e968c775c Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Wed, 6 Nov 2013 15:07:53 +0100 Subject: blowfish-ctr: use the whole 56-byte key --- src/crypto/cipher/blowfish_ctr/builtin/blowfish_ctr.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/crypto') diff --git a/src/crypto/cipher/blowfish_ctr/builtin/blowfish_ctr.c b/src/crypto/cipher/blowfish_ctr/builtin/blowfish_ctr.c index 1d29a4c..690e0a6 100644 --- a/src/crypto/cipher/blowfish_ctr/builtin/blowfish_ctr.c +++ b/src/crypto/cipher/blowfish_ctr/builtin/blowfish_ctr.c @@ -265,9 +265,9 @@ static inline void bf_encrypt(const fastd_cipher_state_t *state, uint32_t *L, ui } static fastd_cipher_state_t* blowfish_ctr_init_state(fastd_context_t *ctx UNUSED, const fastd_cipher_context_t *cctx UNUSED, const uint8_t *key) { - uint32_t key32[4]; - memcpy(key32, key, 16); - bf_ntohl(key32, 4); + uint32_t key32[14]; + memcpy(key32, key, 56); + bf_ntohl(key32, 14); fastd_cipher_state_t *state = malloc(sizeof(fastd_cipher_state_t)); @@ -276,7 +276,7 @@ static fastd_cipher_state_t* blowfish_ctr_init_state(fastd_context_t *ctx UNUSED size_t i, j; for (i = 0; i < 18; i++) - state->P[i] ^= key32[i % 4]; + state->P[i] ^= key32[i % 14]; uint32_t L = 0, R = 0; for (i = 0; i < 18; i += 2) { -- cgit v1.2.3