summaryrefslogtreecommitdiffstats
path: root/src/vnet/crypto
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet/crypto')
-rw-r--r--src/vnet/crypto/crypto.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/vnet/crypto/crypto.c b/src/vnet/crypto/crypto.c
index 26fc4940e0a..e52e68ed610 100644
--- a/src/vnet/crypto/crypto.c
+++ b/src/vnet/crypto/crypto.c
@@ -189,8 +189,17 @@ int
vnet_crypto_is_set_handler (vnet_crypto_alg_t alg)
{
vnet_crypto_main_t *cm = &crypto_main;
+ vnet_crypto_op_id_t opt = 0;
+ int i;
+
+ if (alg > vec_len (cm->algs))
+ return 0;
+
+ for (i = 0; i < VNET_CRYPTO_OP_N_TYPES; i++)
+ if ((opt = cm->algs[alg].op_by_type[i]) != 0)
+ break;
- return (alg < vec_len (cm->ops_handlers) && NULL != cm->ops_handlers[alg]);
+ return NULL != cm->ops_handlers[opt];
}
void