summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2013-11-06 15:07:53 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2013-11-06 15:07:53 +0100
commitbbd42ca7a94daadb63781fa7714ea66e968c775c (patch)
treed09a9cb8b2406790ca1b2891132aef57e44ee984 /src
parentcb42b5b1fa81969e6d4056e0220374e8ded09651 (diff)
downloadfastd-bbd42ca7a94daadb63781fa7714ea66e968c775c.tar
fastd-bbd42ca7a94daadb63781fa7714ea66e968c775c.zip
blowfish-ctr: use the whole 56-byte key
Diffstat (limited to 'src')
-rw-r--r--src/crypto/cipher/blowfish_ctr/builtin/blowfish_ctr.c8
1 files changed, 4 insertions, 4 deletions
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) {