crypto: fix algo selection

Check if crypto ops vector is matching actual ops instead if blindly
dereferencing it.

Type: fix
Signed-off-by: Dmitry Valter <d-valter@yandex-team.com>
Change-Id: Ib88ab44137d9360ee96228e72349a62b2fa7a7e0
diff --git a/src/vnet/crypto/crypto.c b/src/vnet/crypto/crypto.c
index 0f99492..3cada75 100644
--- a/src/vnet/crypto/crypto.c
+++ b/src/vnet/crypto/crypto.c
@@ -192,13 +192,16 @@
   vnet_crypto_op_id_t opt = 0;
   int i;
 
-  if (alg > vec_len (cm->algs))
+  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;
 
+  if (opt >= vec_len (cm->ops_handlers))
+    return 0;
+
   return NULL != cm->ops_handlers[opt];
 }