crypto: fixed vnet_crypto_is_set_handler()
[vpp.git] / src / vnet / crypto / crypto.c
index a82ebae..e52e68e 100644 (file)
@@ -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
@@ -710,7 +719,7 @@ vnet_crypto_init (vlib_main_t * vm)
   cm->async_alg_index_by_name = hash_create_string (0, sizeof (uword));
   vec_validate_aligned (cm->threads, tm->n_vlib_mains, CLIB_CACHE_LINE_BYTES);
   vec_foreach (ct, cm->threads)
-    pool_alloc_aligned (ct->frame_pool, 256, CLIB_CACHE_LINE_BYTES);
+    pool_alloc_aligned (ct->frame_pool, 1024, CLIB_CACHE_LINE_BYTES);
   vec_validate (cm->algs, VNET_CRYPTO_N_ALGS);
   vec_validate (cm->async_algs, VNET_CRYPTO_N_ASYNC_ALGS);
   clib_bitmap_validate (cm->async_active_ids, VNET_CRYPTO_ASYNC_OP_N_IDS - 1);