summaryrefslogtreecommitdiffstats
path: root/src/crypto/cipher/blowfish_ctr/builtin
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2013-11-05 16:29:57 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2013-11-05 16:29:57 +0100
commitcb42b5b1fa81969e6d4056e0220374e8ded09651 (patch)
tree72b85d9cc8a551149467f770ec1752f540e3d3eb /src/crypto/cipher/blowfish_ctr/builtin
parent4f9b5d66bc6b198dcf6e119fa05e891fce4e355f (diff)
downloadfastd-cb42b5b1fa81969e6d4056e0220374e8ded09651.tar
fastd-cb42b5b1fa81969e6d4056e0220374e8ded09651.zip
Generalize cipher/MAC key/IV lengths
Diffstat (limited to 'src/crypto/cipher/blowfish_ctr/builtin')
-rw-r--r--src/crypto/cipher/blowfish_ctr/builtin/blowfish_ctr.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/crypto/cipher/blowfish_ctr/builtin/blowfish_ctr.c b/src/crypto/cipher/blowfish_ctr/builtin/blowfish_ctr.c
index 04ac1f0..1d29a4c 100644
--- a/src/crypto/cipher/blowfish_ctr/builtin/blowfish_ctr.c
+++ b/src/crypto/cipher/blowfish_ctr/builtin/blowfish_ctr.c
@@ -223,6 +223,10 @@ static fastd_cipher_context_t* blowfish_ctr_initialize(fastd_context_t *ctx UNUS
return NULL;
}
+static size_t blowfish_ctr_key_length(fastd_context_t *ctx UNUSED, const fastd_cipher_context_t *cctx UNUSED) {
+ return 56;
+}
+
static inline void bf_swap(uint32_t *L, uint32_t *R) {
uint32_t tmp = *L;
*L = *R;
@@ -292,7 +296,11 @@ static fastd_cipher_state_t* blowfish_ctr_init_state(fastd_context_t *ctx UNUSED
return state;
}
-static bool blowfish_ctr_crypt(fastd_context_t *ctx UNUSED, const fastd_cipher_state_t *state, fastd_block128_t *out, const fastd_block128_t *in, size_t len, const fastd_block128_t *iv) {
+static size_t blowfish_ctr_iv_length(fastd_context_t *ctx UNUSED, const fastd_cipher_state_t *state UNUSED) {
+ return 8;
+}
+
+static bool blowfish_ctr_crypt(fastd_context_t *ctx UNUSED, const fastd_cipher_state_t *state, fastd_block128_t *out, const fastd_block128_t *in, size_t len, const uint8_t *iv) {
uint32_t ctr[2];
fastd_block128_t block;
@@ -329,7 +337,11 @@ const fastd_cipher_t fastd_cipher_blowfish_ctr_builtin = {
.name = "builtin",
.initialize = blowfish_ctr_initialize,
+
+ .key_length = blowfish_ctr_key_length,
.init_state = blowfish_ctr_init_state,
+
+ .iv_length = blowfish_ctr_iv_length,
.crypt = blowfish_ctr_crypt,
.free_state = blowfish_ctr_free_state,