aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPiotrX Kleski <piotrx.kleski@intel.com>2021-01-11 08:59:31 +0000
committerNeale Ranns <neale@graphiant.com>2021-01-20 11:04:46 +0000
commitb2525922cd7932413a370c212c09485367d15464 (patch)
treee7c06f8b6868ab662650a2ad1229e1bc4a180489 /src
parent2a81d9a4cc3436d63dad618ec654572343e89257 (diff)
crypto: fixed vnet_crypto_is_set_handler()
Type: fix vnet_crypto_is_set_handler() was checking if op handler is set by using alg instead of op id. This fix changes the check to use op ids from crypto_main's alg_data for provided alg. Signed-off-by: PiotrX Kleski <piotrx.kleski@intel.com> Change-Id: I5f0f00a889ddada44d9912af175ebad66677037a
Diffstat (limited to 'src')
-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