aboutsummaryrefslogtreecommitdiffstats
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.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/vnet/crypto/crypto.c b/src/vnet/crypto/crypto.c
index d1a6a6b12a1..765dc499078 100644
--- a/src/vnet/crypto/crypto.c
+++ b/src/vnet/crypto/crypto.c
@@ -18,6 +18,8 @@ VLIB_REGISTER_LOG_CLASS (crypto_main_log, static) = {
#define log_debug(f, ...) \
vlib_log (VLIB_LOG_LEVEL_DEBUG, crypto_main_log.class, f, ##__VA_ARGS__)
+#define log_notice(f, ...) \
+ vlib_log (VLIB_LOG_LEVEL_NOTICE, crypto_main_log.class, f, ##__VA_ARGS__)
#define log_err(f, ...) \
vlib_log (VLIB_LOG_LEVEL_ERR, crypto_main_log.class, f, ##__VA_ARGS__)
@@ -564,11 +566,14 @@ static void
vnet_crypto_load_engines (vlib_main_t *vm)
{
vlib_thread_main_t *tm = vlib_get_thread_main ();
+ vnet_crypto_main_t *cm = &crypto_main;
+ vnet_crypto_config_t *pc;
u8 *path;
char *p;
u32 path_len;
struct dirent *entry;
DIR *dp;
+ uword *config_index;
path = os_get_exec_path ();
log_debug ("exec path is %s", path);
@@ -623,6 +628,31 @@ vnet_crypto_load_engines (vlib_main_t *vm)
continue;
}
+ /* follow crypto-engines config section directive */
+ config_index = hash_get_mem (cm->config_index_by_name, r->name);
+ if (config_index)
+ {
+ pc = vec_elt_at_index (cm->configs, config_index[0]);
+ if (pc->is_disabled)
+ {
+ log_notice ("crypto disabled: %s", r->name);
+ dlclose (handle);
+ continue;
+ }
+ if (cm->default_disabled && pc->is_enabled == 0)
+ {
+ log_notice ("crypto disabled (default): %s", r->name);
+ dlclose (handle);
+ continue;
+ }
+ }
+ else if (cm->default_disabled)
+ {
+ log_notice ("crypto disabled (default): %s", r->name);
+ dlclose (handle);
+ continue;
+ }
+
if (r->per_thread_data_sz)
{
u64 sz =