summaryrefslogtreecommitdiffstats
path: root/src/vnet/crypto/crypto.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet/crypto/crypto.c')
-rw-r--r--src/vnet/crypto/crypto.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/src/vnet/crypto/crypto.c b/src/vnet/crypto/crypto.c
index 74f945e8382..3b1505ad448 100644
--- a/src/vnet/crypto/crypto.c
+++ b/src/vnet/crypto/crypto.c
@@ -343,7 +343,13 @@ vnet_crypto_key_len_check (vnet_crypto_alg_t alg, u16 length)
#define _(n, s) \
case VNET_CRYPTO_ALG_HMAC_##n: \
return 1;
- foreach_crypto_hmac_alg
+ foreach_crypto_hmac_alg
+#undef _
+
+#define _(n, s) \
+ case VNET_CRYPTO_ALG_HASH_##n: \
+ return 1;
+ foreach_crypto_hash_alg
#undef _
}
@@ -669,6 +675,20 @@ vnet_crypto_init_cipher_data (vnet_crypto_alg_t alg, vnet_crypto_op_id_t eid,
}
static void
+vnet_crypto_init_hash_data (vnet_crypto_alg_t alg, vnet_crypto_op_id_t id,
+ char *name)
+{
+ vnet_crypto_main_t *cm = &crypto_main;
+ cm->algs[alg].name = name;
+ cm->algs[alg].op_by_type[VNET_CRYPTO_OP_TYPE_HASH] = id;
+ cm->opt_data[id].alg = alg;
+ cm->opt_data[id].active_engine_index_simple = ~0;
+ cm->opt_data[id].active_engine_index_chained = ~0;
+ cm->opt_data[id].type = VNET_CRYPTO_OP_TYPE_HASH;
+ hash_set_mem (cm->alg_index_by_name, name, alg);
+}
+
+static void
vnet_crypto_init_hmac_data (vnet_crypto_alg_t alg,
vnet_crypto_op_id_t id, char *name)
{
@@ -740,6 +760,11 @@ vnet_crypto_init (vlib_main_t * vm)
VNET_CRYPTO_OP_##n##_HMAC, "hmac-" s);
foreach_crypto_hmac_alg;
#undef _
+#define _(n, s) \
+ vnet_crypto_init_hash_data (VNET_CRYPTO_ALG_HASH_##n, \
+ VNET_CRYPTO_OP_##n##_HASH, s);
+ foreach_crypto_hash_alg;
+#undef _
#define _(n, s, k, t, a) \
vnet_crypto_init_async_data (VNET_CRYPTO_ALG_##n##_TAG##t##_AAD##a, \
VNET_CRYPTO_OP_##n##_TAG##t##_AAD##a##_ENC, \