diff options
author | Neale Ranns <nranns@cisco.com> | 2019-06-21 12:44:11 +0000 |
---|---|---|
committer | Neale Ranns <nranns@cisco.com> | 2019-06-25 09:39:10 +0000 |
commit | ece2ae0fa27a11d25fff6ea27263d5c5ba5c9dbc (patch) | |
tree | 15dbd3f370dcfe4526673601b3a00076d8a7507f /src/vnet/ipsec | |
parent | 47e77304edf72fda629f054b393013ff795d5637 (diff) |
ipsec: return error if the engine backend has no handler for the
requested alogrithm.
Type: feature
Change-Id: I19a9c14b2bb52ba2fc66246845b7ada73d5095d1
Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'src/vnet/ipsec')
-rw-r--r-- | src/vnet/ipsec/ipsec.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/src/vnet/ipsec/ipsec.c b/src/vnet/ipsec/ipsec.c index 84f0809954e..4caae4840fb 100644 --- a/src/vnet/ipsec/ipsec.c +++ b/src/vnet/ipsec/ipsec.c @@ -30,15 +30,37 @@ ipsec_main_t ipsec_main; static clib_error_t * ipsec_check_ah_support (ipsec_sa_t * sa) { + ipsec_main_t *im = &ipsec_main; + if (sa->integ_alg == IPSEC_INTEG_ALG_NONE) return clib_error_return (0, "unsupported none integ-alg"); + + if (!vnet_crypto_is_set_handler (im->integ_algs[sa->integ_alg].alg)) + return clib_error_return (0, "No crypto engine support for %U", + format_ipsec_integ_alg, sa->integ_alg); + return 0; } static clib_error_t * ipsec_check_esp_support (ipsec_sa_t * sa) { - return 0; + ipsec_main_t *im = &ipsec_main; + + if (IPSEC_INTEG_ALG_NONE != sa->integ_alg) + { + if (!vnet_crypto_is_set_handler (im->integ_algs[sa->integ_alg].alg)) + return clib_error_return (0, "No crypto engine support for %U", + format_ipsec_integ_alg, sa->integ_alg); + } + if (IPSEC_CRYPTO_ALG_NONE != sa->crypto_alg) + { + if (!vnet_crypto_is_set_handler (im->crypto_algs[sa->crypto_alg].alg)) + return clib_error_return (0, "No crypto engine support for %U", + format_ipsec_crypto_alg, sa->crypto_alg); + } + + return (0); } clib_error_t * |