Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 1 | /* |
Neale Ranns | 999c8ee | 2019-02-01 03:31:24 -0800 | [diff] [blame] | 2 | * ipsec.c : IPSEC module functions |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 3 | * |
| 4 | * Copyright (c) 2015 Cisco and/or its affiliates. |
| 5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | * you may not use this file except in compliance with the License. |
| 7 | * You may obtain a copy of the License at: |
| 8 | * |
| 9 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | * |
| 11 | * Unless required by applicable law or agreed to in writing, software |
| 12 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | * See the License for the specific language governing permissions and |
| 15 | * limitations under the License. |
| 16 | */ |
| 17 | |
| 18 | #include <vnet/vnet.h> |
| 19 | #include <vnet/api_errno.h> |
| 20 | #include <vnet/ip/ip.h> |
| 21 | #include <vnet/interface.h> |
Florin Coras | b040f98 | 2020-10-20 14:59:43 -0700 | [diff] [blame] | 22 | #include <vnet/udp/udp_local.h> |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 23 | |
| 24 | #include <vnet/ipsec/ipsec.h> |
Sergio Gonzalez Monroy | a10f62b | 2016-11-25 13:36:12 +0000 | [diff] [blame] | 25 | #include <vnet/ipsec/esp.h> |
“mukeshyadav1984” | 430ac93 | 2017-11-23 02:39:33 -0800 | [diff] [blame] | 26 | #include <vnet/ipsec/ah.h> |
Sergio Gonzalez Monroy | a10f62b | 2016-11-25 13:36:12 +0000 | [diff] [blame] | 27 | |
Dave Wallace | 71612d6 | 2017-10-24 01:32:41 -0400 | [diff] [blame] | 28 | ipsec_main_t ipsec_main; |
Fan Zhang | f539578 | 2020-04-29 14:00:03 +0100 | [diff] [blame] | 29 | esp_async_post_next_t esp_encrypt_async_next; |
| 30 | esp_async_post_next_t esp_decrypt_async_next; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 31 | |
| 32 | static clib_error_t * |
Klement Sekera | 4fd5a9d | 2019-01-30 11:11:23 +0100 | [diff] [blame] | 33 | ipsec_check_ah_support (ipsec_sa_t * sa) |
| 34 | { |
Neale Ranns | ece2ae0 | 2019-06-21 12:44:11 +0000 | [diff] [blame] | 35 | ipsec_main_t *im = &ipsec_main; |
| 36 | |
Klement Sekera | 4fd5a9d | 2019-01-30 11:11:23 +0100 | [diff] [blame] | 37 | if (sa->integ_alg == IPSEC_INTEG_ALG_NONE) |
| 38 | return clib_error_return (0, "unsupported none integ-alg"); |
Neale Ranns | ece2ae0 | 2019-06-21 12:44:11 +0000 | [diff] [blame] | 39 | |
| 40 | if (!vnet_crypto_is_set_handler (im->integ_algs[sa->integ_alg].alg)) |
| 41 | return clib_error_return (0, "No crypto engine support for %U", |
| 42 | format_ipsec_integ_alg, sa->integ_alg); |
| 43 | |
Klement Sekera | 4fd5a9d | 2019-01-30 11:11:23 +0100 | [diff] [blame] | 44 | return 0; |
| 45 | } |
| 46 | |
| 47 | static clib_error_t * |
| 48 | ipsec_check_esp_support (ipsec_sa_t * sa) |
Sergio Gonzalez Monroy | d04b60b | 2017-01-20 15:35:23 +0000 | [diff] [blame] | 49 | { |
Neale Ranns | ece2ae0 | 2019-06-21 12:44:11 +0000 | [diff] [blame] | 50 | ipsec_main_t *im = &ipsec_main; |
| 51 | |
| 52 | if (IPSEC_INTEG_ALG_NONE != sa->integ_alg) |
| 53 | { |
| 54 | if (!vnet_crypto_is_set_handler (im->integ_algs[sa->integ_alg].alg)) |
| 55 | return clib_error_return (0, "No crypto engine support for %U", |
| 56 | format_ipsec_integ_alg, sa->integ_alg); |
| 57 | } |
| 58 | if (IPSEC_CRYPTO_ALG_NONE != sa->crypto_alg) |
| 59 | { |
| 60 | if (!vnet_crypto_is_set_handler (im->crypto_algs[sa->crypto_alg].alg)) |
| 61 | return clib_error_return (0, "No crypto engine support for %U", |
| 62 | format_ipsec_crypto_alg, sa->crypto_alg); |
| 63 | } |
| 64 | |
| 65 | return (0); |
Sergio Gonzalez Monroy | d04b60b | 2017-01-20 15:35:23 +0000 | [diff] [blame] | 66 | } |
| 67 | |
Klement Sekera | b4d3053 | 2018-11-08 13:00:02 +0100 | [diff] [blame] | 68 | clib_error_t * |
| 69 | ipsec_add_del_sa_sess_cb (ipsec_main_t * im, u32 sa_index, u8 is_add) |
| 70 | { |
| 71 | ipsec_ah_backend_t *ah = |
| 72 | pool_elt_at_index (im->ah_backends, im->ah_current_backend); |
| 73 | if (ah->add_del_sa_sess_cb) |
| 74 | { |
| 75 | clib_error_t *err = ah->add_del_sa_sess_cb (sa_index, is_add); |
| 76 | if (err) |
| 77 | return err; |
| 78 | } |
| 79 | ipsec_esp_backend_t *esp = |
| 80 | pool_elt_at_index (im->esp_backends, im->esp_current_backend); |
| 81 | if (esp->add_del_sa_sess_cb) |
| 82 | { |
| 83 | clib_error_t *err = esp->add_del_sa_sess_cb (sa_index, is_add); |
| 84 | if (err) |
| 85 | return err; |
| 86 | } |
| 87 | return 0; |
| 88 | } |
| 89 | |
| 90 | clib_error_t * |
| 91 | ipsec_check_support_cb (ipsec_main_t * im, ipsec_sa_t * sa) |
| 92 | { |
| 93 | clib_error_t *error = 0; |
Matthew Smith | 461caa5 | 2018-12-21 11:53:16 -0600 | [diff] [blame] | 94 | |
| 95 | if (PREDICT_FALSE (sa->protocol == IPSEC_PROTOCOL_AH)) |
| 96 | { |
| 97 | ipsec_ah_backend_t *ah = |
| 98 | pool_elt_at_index (im->ah_backends, im->ah_current_backend); |
| 99 | ASSERT (ah->check_support_cb); |
| 100 | error = ah->check_support_cb (sa); |
| 101 | } |
| 102 | else |
| 103 | { |
| 104 | ipsec_esp_backend_t *esp = |
| 105 | pool_elt_at_index (im->esp_backends, im->esp_current_backend); |
| 106 | ASSERT (esp->check_support_cb); |
| 107 | error = esp->check_support_cb (sa); |
| 108 | } |
Klement Sekera | b4d3053 | 2018-11-08 13:00:02 +0100 | [diff] [blame] | 109 | return error; |
| 110 | } |
| 111 | |
| 112 | |
| 113 | static void |
| 114 | ipsec_add_node (vlib_main_t * vm, const char *node_name, |
| 115 | const char *prev_node_name, u32 * out_node_index, |
| 116 | u32 * out_next_index) |
| 117 | { |
| 118 | vlib_node_t *prev_node, *node; |
| 119 | prev_node = vlib_get_node_by_name (vm, (u8 *) prev_node_name); |
| 120 | ASSERT (prev_node); |
| 121 | node = vlib_get_node_by_name (vm, (u8 *) node_name); |
| 122 | ASSERT (node); |
| 123 | *out_node_index = node->index; |
| 124 | *out_next_index = vlib_node_add_next (vm, prev_node->index, node->index); |
| 125 | } |
| 126 | |
Neale Ranns | abc5660 | 2020-04-01 09:45:23 +0000 | [diff] [blame] | 127 | void |
Neale Ranns | abc5660 | 2020-04-01 09:45:23 +0000 | [diff] [blame] | 128 | ipsec_unregister_udp_port (u16 port) |
| 129 | { |
| 130 | ipsec_main_t *im = &ipsec_main; |
| 131 | u32 n_regs; |
| 132 | uword *p; |
| 133 | |
| 134 | p = hash_get (im->udp_port_registrations, port); |
| 135 | |
| 136 | ASSERT (p); |
| 137 | |
| 138 | n_regs = p[0]; |
| 139 | |
| 140 | if (0 == --n_regs) |
| 141 | { |
| 142 | udp_unregister_dst_port (vlib_get_main (), port, 1); |
| 143 | hash_unset (im->udp_port_registrations, port); |
| 144 | } |
| 145 | else |
| 146 | { |
| 147 | hash_unset (im->udp_port_registrations, port); |
| 148 | hash_set (im->udp_port_registrations, port, n_regs); |
| 149 | } |
| 150 | } |
| 151 | |
| 152 | void |
| 153 | ipsec_register_udp_port (u16 port) |
| 154 | { |
| 155 | ipsec_main_t *im = &ipsec_main; |
| 156 | u32 n_regs; |
| 157 | uword *p; |
| 158 | |
| 159 | p = hash_get (im->udp_port_registrations, port); |
| 160 | |
| 161 | n_regs = (p ? p[0] : 0); |
| 162 | |
| 163 | if (0 == n_regs++) |
| 164 | udp_register_dst_port (vlib_get_main (), port, |
| 165 | ipsec4_tun_input_node.index, 1); |
| 166 | |
| 167 | hash_unset (im->udp_port_registrations, port); |
| 168 | hash_set (im->udp_port_registrations, port, n_regs); |
| 169 | } |
| 170 | |
Klement Sekera | b4d3053 | 2018-11-08 13:00:02 +0100 | [diff] [blame] | 171 | u32 |
| 172 | ipsec_register_ah_backend (vlib_main_t * vm, ipsec_main_t * im, |
| 173 | const char *name, |
| 174 | const char *ah4_encrypt_node_name, |
| 175 | const char *ah4_decrypt_node_name, |
| 176 | const char *ah6_encrypt_node_name, |
| 177 | const char *ah6_decrypt_node_name, |
| 178 | check_support_cb_t ah_check_support_cb, |
| 179 | add_del_sa_sess_cb_t ah_add_del_sa_sess_cb) |
| 180 | { |
| 181 | ipsec_ah_backend_t *b; |
| 182 | pool_get (im->ah_backends, b); |
Kingwel Xie | 561d1ca | 2019-03-05 22:56:17 -0500 | [diff] [blame] | 183 | b->name = format (0, "%s%c", name, 0); |
Klement Sekera | b4d3053 | 2018-11-08 13:00:02 +0100 | [diff] [blame] | 184 | |
Pierre Pfister | 057b356 | 2018-12-10 17:01:01 +0100 | [diff] [blame] | 185 | ipsec_add_node (vm, ah4_encrypt_node_name, "ipsec4-output-feature", |
Klement Sekera | b4d3053 | 2018-11-08 13:00:02 +0100 | [diff] [blame] | 186 | &b->ah4_encrypt_node_index, &b->ah4_encrypt_next_index); |
Pierre Pfister | 057b356 | 2018-12-10 17:01:01 +0100 | [diff] [blame] | 187 | ipsec_add_node (vm, ah4_decrypt_node_name, "ipsec4-input-feature", |
Klement Sekera | b4d3053 | 2018-11-08 13:00:02 +0100 | [diff] [blame] | 188 | &b->ah4_decrypt_node_index, &b->ah4_decrypt_next_index); |
Pierre Pfister | 057b356 | 2018-12-10 17:01:01 +0100 | [diff] [blame] | 189 | ipsec_add_node (vm, ah6_encrypt_node_name, "ipsec6-output-feature", |
Klement Sekera | b4d3053 | 2018-11-08 13:00:02 +0100 | [diff] [blame] | 190 | &b->ah6_encrypt_node_index, &b->ah6_encrypt_next_index); |
Pierre Pfister | 057b356 | 2018-12-10 17:01:01 +0100 | [diff] [blame] | 191 | ipsec_add_node (vm, ah6_decrypt_node_name, "ipsec6-input-feature", |
Klement Sekera | b4d3053 | 2018-11-08 13:00:02 +0100 | [diff] [blame] | 192 | &b->ah6_decrypt_node_index, &b->ah6_decrypt_next_index); |
| 193 | |
| 194 | b->check_support_cb = ah_check_support_cb; |
| 195 | b->add_del_sa_sess_cb = ah_add_del_sa_sess_cb; |
| 196 | return b - im->ah_backends; |
| 197 | } |
| 198 | |
| 199 | u32 |
Neale Ranns | 4a58e49 | 2020-12-21 13:19:10 +0000 | [diff] [blame] | 200 | ipsec_register_esp_backend ( |
| 201 | vlib_main_t *vm, ipsec_main_t *im, const char *name, |
| 202 | const char *esp4_encrypt_node_name, const char *esp4_encrypt_node_tun_name, |
| 203 | const char *esp4_decrypt_node_name, const char *esp4_decrypt_tun_node_name, |
| 204 | const char *esp6_encrypt_node_name, const char *esp6_encrypt_node_tun_name, |
| 205 | const char *esp6_decrypt_node_name, const char *esp6_decrypt_tun_node_name, |
| 206 | const char *esp_mpls_encrypt_node_tun_name, |
| 207 | check_support_cb_t esp_check_support_cb, |
| 208 | add_del_sa_sess_cb_t esp_add_del_sa_sess_cb, |
| 209 | enable_disable_cb_t enable_disable_cb) |
Klement Sekera | b4d3053 | 2018-11-08 13:00:02 +0100 | [diff] [blame] | 210 | { |
| 211 | ipsec_esp_backend_t *b; |
Neale Ranns | e8915fc | 2019-04-23 20:57:55 -0400 | [diff] [blame] | 212 | |
Klement Sekera | b4d3053 | 2018-11-08 13:00:02 +0100 | [diff] [blame] | 213 | pool_get (im->esp_backends, b); |
Kingwel Xie | 561d1ca | 2019-03-05 22:56:17 -0500 | [diff] [blame] | 214 | b->name = format (0, "%s%c", name, 0); |
Klement Sekera | b4d3053 | 2018-11-08 13:00:02 +0100 | [diff] [blame] | 215 | |
Pierre Pfister | 057b356 | 2018-12-10 17:01:01 +0100 | [diff] [blame] | 216 | ipsec_add_node (vm, esp4_encrypt_node_name, "ipsec4-output-feature", |
Klement Sekera | b4d3053 | 2018-11-08 13:00:02 +0100 | [diff] [blame] | 217 | &b->esp4_encrypt_node_index, &b->esp4_encrypt_next_index); |
Pierre Pfister | 057b356 | 2018-12-10 17:01:01 +0100 | [diff] [blame] | 218 | ipsec_add_node (vm, esp4_decrypt_node_name, "ipsec4-input-feature", |
Klement Sekera | b4d3053 | 2018-11-08 13:00:02 +0100 | [diff] [blame] | 219 | &b->esp4_decrypt_node_index, &b->esp4_decrypt_next_index); |
Pierre Pfister | 057b356 | 2018-12-10 17:01:01 +0100 | [diff] [blame] | 220 | ipsec_add_node (vm, esp6_encrypt_node_name, "ipsec6-output-feature", |
Klement Sekera | b4d3053 | 2018-11-08 13:00:02 +0100 | [diff] [blame] | 221 | &b->esp6_encrypt_node_index, &b->esp6_encrypt_next_index); |
Pierre Pfister | 057b356 | 2018-12-10 17:01:01 +0100 | [diff] [blame] | 222 | ipsec_add_node (vm, esp6_decrypt_node_name, "ipsec6-input-feature", |
Klement Sekera | b4d3053 | 2018-11-08 13:00:02 +0100 | [diff] [blame] | 223 | &b->esp6_decrypt_node_index, &b->esp6_decrypt_next_index); |
Neale Ranns | 7ec120e | 2020-01-21 04:58:02 +0000 | [diff] [blame] | 224 | ipsec_add_node (vm, esp4_decrypt_tun_node_name, "ipsec4-tun-input", |
| 225 | &b->esp4_decrypt_tun_node_index, |
| 226 | &b->esp4_decrypt_tun_next_index); |
| 227 | ipsec_add_node (vm, esp6_decrypt_tun_node_name, "ipsec6-tun-input", |
| 228 | &b->esp6_decrypt_tun_node_index, |
| 229 | &b->esp6_decrypt_tun_next_index); |
Klement Sekera | b4d3053 | 2018-11-08 13:00:02 +0100 | [diff] [blame] | 230 | |
Neale Ranns | 4ec36c5 | 2020-03-31 09:21:29 -0400 | [diff] [blame] | 231 | b->esp6_encrypt_tun_node_index = |
| 232 | vlib_get_node_by_name (vm, (u8 *) esp6_encrypt_node_tun_name)->index; |
Neale Ranns | 4a58e49 | 2020-12-21 13:19:10 +0000 | [diff] [blame] | 233 | b->esp_mpls_encrypt_tun_node_index = |
| 234 | vlib_get_node_by_name (vm, (u8 *) esp_mpls_encrypt_node_tun_name)->index; |
Neale Ranns | 4ec36c5 | 2020-03-31 09:21:29 -0400 | [diff] [blame] | 235 | b->esp4_encrypt_tun_node_index = |
| 236 | vlib_get_node_by_name (vm, (u8 *) esp4_encrypt_node_tun_name)->index; |
Neale Ranns | e8915fc | 2019-04-23 20:57:55 -0400 | [diff] [blame] | 237 | |
Klement Sekera | b4d3053 | 2018-11-08 13:00:02 +0100 | [diff] [blame] | 238 | b->check_support_cb = esp_check_support_cb; |
| 239 | b->add_del_sa_sess_cb = esp_add_del_sa_sess_cb; |
Fan Zhang | f539578 | 2020-04-29 14:00:03 +0100 | [diff] [blame] | 240 | b->enable_disable_cb = enable_disable_cb; |
| 241 | |
Klement Sekera | b4d3053 | 2018-11-08 13:00:02 +0100 | [diff] [blame] | 242 | return b - im->esp_backends; |
| 243 | } |
| 244 | |
Neale Ranns | e8915fc | 2019-04-23 20:57:55 -0400 | [diff] [blame] | 245 | clib_error_t * |
| 246 | ipsec_rsc_in_use (ipsec_main_t * im) |
Neale Ranns | b4cfd55 | 2019-02-13 02:08:06 -0800 | [diff] [blame] | 247 | { |
Neale Ranns | e8915fc | 2019-04-23 20:57:55 -0400 | [diff] [blame] | 248 | /* return an error is crypto resource are in use */ |
Neale Ranns | c5fe57d | 2021-02-25 16:01:28 +0000 | [diff] [blame] | 249 | if (pool_elts (ipsec_sa_pool) > 0) |
| 250 | return clib_error_return (0, "%d SA entries configured", |
| 251 | pool_elts (ipsec_sa_pool)); |
Neale Ranns | b4cfd55 | 2019-02-13 02:08:06 -0800 | [diff] [blame] | 252 | |
Neale Ranns | e8915fc | 2019-04-23 20:57:55 -0400 | [diff] [blame] | 253 | return (NULL); |
Neale Ranns | b4cfd55 | 2019-02-13 02:08:06 -0800 | [diff] [blame] | 254 | } |
| 255 | |
Klement Sekera | b4d3053 | 2018-11-08 13:00:02 +0100 | [diff] [blame] | 256 | int |
| 257 | ipsec_select_ah_backend (ipsec_main_t * im, u32 backend_idx) |
| 258 | { |
Neale Ranns | e8915fc | 2019-04-23 20:57:55 -0400 | [diff] [blame] | 259 | if (ipsec_rsc_in_use (im)) |
| 260 | return VNET_API_ERROR_RSRC_IN_USE; |
| 261 | |
| 262 | if (pool_is_free_index (im->ah_backends, backend_idx)) |
| 263 | return VNET_API_ERROR_INVALID_VALUE; |
| 264 | |
Klement Sekera | b4d3053 | 2018-11-08 13:00:02 +0100 | [diff] [blame] | 265 | ipsec_ah_backend_t *b = pool_elt_at_index (im->ah_backends, backend_idx); |
| 266 | im->ah_current_backend = backend_idx; |
| 267 | im->ah4_encrypt_node_index = b->ah4_encrypt_node_index; |
| 268 | im->ah4_decrypt_node_index = b->ah4_decrypt_node_index; |
| 269 | im->ah4_encrypt_next_index = b->ah4_encrypt_next_index; |
| 270 | im->ah4_decrypt_next_index = b->ah4_decrypt_next_index; |
| 271 | im->ah6_encrypt_node_index = b->ah6_encrypt_node_index; |
| 272 | im->ah6_decrypt_node_index = b->ah6_decrypt_node_index; |
| 273 | im->ah6_encrypt_next_index = b->ah6_encrypt_next_index; |
| 274 | im->ah6_decrypt_next_index = b->ah6_decrypt_next_index; |
Neale Ranns | b4cfd55 | 2019-02-13 02:08:06 -0800 | [diff] [blame] | 275 | |
Klement Sekera | b4d3053 | 2018-11-08 13:00:02 +0100 | [diff] [blame] | 276 | return 0; |
| 277 | } |
| 278 | |
| 279 | int |
| 280 | ipsec_select_esp_backend (ipsec_main_t * im, u32 backend_idx) |
| 281 | { |
Neale Ranns | e8915fc | 2019-04-23 20:57:55 -0400 | [diff] [blame] | 282 | if (ipsec_rsc_in_use (im)) |
| 283 | return VNET_API_ERROR_RSRC_IN_USE; |
| 284 | |
| 285 | if (pool_is_free_index (im->esp_backends, backend_idx)) |
| 286 | return VNET_API_ERROR_INVALID_VALUE; |
| 287 | |
Fan Zhang | f539578 | 2020-04-29 14:00:03 +0100 | [diff] [blame] | 288 | /* disable current backend */ |
| 289 | if (im->esp_current_backend != ~0) |
| 290 | { |
| 291 | ipsec_esp_backend_t *cb = pool_elt_at_index (im->esp_backends, |
| 292 | im->esp_current_backend); |
| 293 | if (cb->enable_disable_cb) |
| 294 | { |
| 295 | if ((cb->enable_disable_cb) (0) != 0) |
| 296 | return -1; |
| 297 | } |
| 298 | } |
| 299 | |
Klement Sekera | b4d3053 | 2018-11-08 13:00:02 +0100 | [diff] [blame] | 300 | ipsec_esp_backend_t *b = pool_elt_at_index (im->esp_backends, backend_idx); |
| 301 | im->esp_current_backend = backend_idx; |
| 302 | im->esp4_encrypt_node_index = b->esp4_encrypt_node_index; |
| 303 | im->esp4_decrypt_node_index = b->esp4_decrypt_node_index; |
| 304 | im->esp4_encrypt_next_index = b->esp4_encrypt_next_index; |
| 305 | im->esp4_decrypt_next_index = b->esp4_decrypt_next_index; |
| 306 | im->esp6_encrypt_node_index = b->esp6_encrypt_node_index; |
| 307 | im->esp6_decrypt_node_index = b->esp6_decrypt_node_index; |
| 308 | im->esp6_encrypt_next_index = b->esp6_encrypt_next_index; |
| 309 | im->esp6_decrypt_next_index = b->esp6_decrypt_next_index; |
Neale Ranns | 7ec120e | 2020-01-21 04:58:02 +0000 | [diff] [blame] | 310 | im->esp4_decrypt_tun_node_index = b->esp4_decrypt_tun_node_index; |
| 311 | im->esp4_decrypt_tun_next_index = b->esp4_decrypt_tun_next_index; |
| 312 | im->esp6_decrypt_tun_node_index = b->esp6_decrypt_tun_node_index; |
| 313 | im->esp6_decrypt_tun_next_index = b->esp6_decrypt_tun_next_index; |
Neale Ranns | 4ec36c5 | 2020-03-31 09:21:29 -0400 | [diff] [blame] | 314 | im->esp4_encrypt_tun_node_index = b->esp4_encrypt_tun_node_index; |
| 315 | im->esp6_encrypt_tun_node_index = b->esp6_encrypt_tun_node_index; |
Neale Ranns | 4a58e49 | 2020-12-21 13:19:10 +0000 | [diff] [blame] | 316 | im->esp_mpls_encrypt_tun_node_index = b->esp_mpls_encrypt_tun_node_index; |
Neale Ranns | e8915fc | 2019-04-23 20:57:55 -0400 | [diff] [blame] | 317 | |
Fan Zhang | f539578 | 2020-04-29 14:00:03 +0100 | [diff] [blame] | 318 | if (b->enable_disable_cb) |
| 319 | { |
| 320 | if ((b->enable_disable_cb) (1) != 0) |
| 321 | return -1; |
| 322 | } |
Klement Sekera | b4d3053 | 2018-11-08 13:00:02 +0100 | [diff] [blame] | 323 | return 0; |
| 324 | } |
| 325 | |
Fan Zhang | f539578 | 2020-04-29 14:00:03 +0100 | [diff] [blame] | 326 | void |
| 327 | ipsec_set_async_mode (u32 is_enabled) |
| 328 | { |
| 329 | ipsec_main_t *im = &ipsec_main; |
| 330 | ipsec_sa_t *sa; |
| 331 | |
Neale Ranns | f16e9a5 | 2021-02-25 19:09:24 +0000 | [diff] [blame] | 332 | vnet_crypto_request_async_mode (is_enabled); |
Fan Zhang | f539578 | 2020-04-29 14:00:03 +0100 | [diff] [blame] | 333 | |
| 334 | im->async_mode = is_enabled; |
| 335 | |
Neale Ranns | f16e9a5 | 2021-02-25 19:09:24 +0000 | [diff] [blame] | 336 | /* change SA crypto op data */ |
Neale Ranns | c5fe57d | 2021-02-25 16:01:28 +0000 | [diff] [blame] | 337 | pool_foreach (sa, ipsec_sa_pool) |
| 338 | { |
| 339 | sa->crypto_op_data = |
Neale Ranns | f16e9a5 | 2021-02-25 19:09:24 +0000 | [diff] [blame] | 340 | (is_enabled ? sa->async_op_data.data : sa->sync_op_data.data); |
Neale Ranns | c5fe57d | 2021-02-25 16:01:28 +0000 | [diff] [blame] | 341 | } |
Fan Zhang | f539578 | 2020-04-29 14:00:03 +0100 | [diff] [blame] | 342 | } |
| 343 | |
| 344 | static void |
| 345 | crypto_engine_backend_register_post_node (vlib_main_t * vm) |
| 346 | { |
| 347 | esp_async_post_next_t *eit; |
| 348 | esp_async_post_next_t *dit; |
| 349 | |
| 350 | eit = &esp_encrypt_async_next; |
| 351 | eit->esp4_post_next = |
| 352 | vnet_crypto_register_post_node (vm, "esp4-encrypt-post"); |
| 353 | eit->esp6_post_next = |
| 354 | vnet_crypto_register_post_node (vm, "esp6-encrypt-post"); |
| 355 | eit->esp4_tun_post_next = |
| 356 | vnet_crypto_register_post_node (vm, "esp4-encrypt-tun-post"); |
| 357 | eit->esp6_tun_post_next = |
| 358 | vnet_crypto_register_post_node (vm, "esp6-encrypt-tun-post"); |
Neale Ranns | 4a58e49 | 2020-12-21 13:19:10 +0000 | [diff] [blame] | 359 | eit->esp_mpls_tun_post_next = |
| 360 | vnet_crypto_register_post_node (vm, "esp-mpls-encrypt-tun-post"); |
Fan Zhang | f539578 | 2020-04-29 14:00:03 +0100 | [diff] [blame] | 361 | |
| 362 | dit = &esp_decrypt_async_next; |
| 363 | dit->esp4_post_next = |
| 364 | vnet_crypto_register_post_node (vm, "esp4-decrypt-post"); |
| 365 | dit->esp6_post_next = |
| 366 | vnet_crypto_register_post_node (vm, "esp6-decrypt-post"); |
| 367 | dit->esp4_tun_post_next = |
| 368 | vnet_crypto_register_post_node (vm, "esp4-decrypt-tun-post"); |
| 369 | dit->esp6_tun_post_next = |
| 370 | vnet_crypto_register_post_node (vm, "esp6-decrypt-tun-post"); |
| 371 | } |
| 372 | |
Sergio Gonzalez Monroy | d04b60b | 2017-01-20 15:35:23 +0000 | [diff] [blame] | 373 | static clib_error_t * |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 374 | ipsec_init (vlib_main_t * vm) |
| 375 | { |
Keith Burns (alagalah) | 166a9d4 | 2016-08-06 11:00:56 -0700 | [diff] [blame] | 376 | clib_error_t *error; |
| 377 | ipsec_main_t *im = &ipsec_main; |
Damjan Marion | 91f17dc | 2019-03-18 18:59:25 +0100 | [diff] [blame] | 378 | ipsec_main_crypto_alg_t *a; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 379 | |
Dave Barach | 0dd9165 | 2019-05-05 13:34:28 -0400 | [diff] [blame] | 380 | /* Backend registration requires the feature arcs to be set up */ |
| 381 | if ((error = vlib_call_init_function (vm, vnet_feature_init))) |
| 382 | return (error); |
| 383 | |
Keith Burns (alagalah) | 166a9d4 | 2016-08-06 11:00:56 -0700 | [diff] [blame] | 384 | im->vnet_main = vnet_get_main (); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 385 | im->vlib_main = vm; |
| 386 | |
Keith Burns (alagalah) | 166a9d4 | 2016-08-06 11:00:56 -0700 | [diff] [blame] | 387 | im->spd_index_by_spd_id = hash_create (0, sizeof (uword)); |
| 388 | im->sa_index_by_sa_id = hash_create (0, sizeof (uword)); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 389 | im->spd_index_by_sw_if_index = hash_create (0, sizeof (uword)); |
| 390 | |
Klement Sekera | b4d3053 | 2018-11-08 13:00:02 +0100 | [diff] [blame] | 391 | vlib_node_t *node = vlib_get_node_by_name (vm, (u8 *) "error-drop"); |
Keith Burns (alagalah) | 166a9d4 | 2016-08-06 11:00:56 -0700 | [diff] [blame] | 392 | ASSERT (node); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 393 | im->error_drop_node_index = node->index; |
| 394 | |
Fan Zhang | f539578 | 2020-04-29 14:00:03 +0100 | [diff] [blame] | 395 | im->ah_current_backend = ~0; |
| 396 | im->esp_current_backend = ~0; |
| 397 | |
Neale Ranns | d1a5b2d | 2019-05-16 17:09:28 +0000 | [diff] [blame] | 398 | u32 idx = ipsec_register_ah_backend (vm, im, "crypto engine backend", |
Klement Sekera | b4d3053 | 2018-11-08 13:00:02 +0100 | [diff] [blame] | 399 | "ah4-encrypt", |
| 400 | "ah4-decrypt", |
| 401 | "ah6-encrypt", |
| 402 | "ah6-decrypt", |
Klement Sekera | 4fd5a9d | 2019-01-30 11:11:23 +0100 | [diff] [blame] | 403 | ipsec_check_ah_support, |
Klement Sekera | b4d3053 | 2018-11-08 13:00:02 +0100 | [diff] [blame] | 404 | NULL); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 405 | |
Klement Sekera | b4d3053 | 2018-11-08 13:00:02 +0100 | [diff] [blame] | 406 | im->ah_default_backend = idx; |
| 407 | int rv = ipsec_select_ah_backend (im, idx); |
| 408 | ASSERT (0 == rv); |
| 409 | (void) (rv); // avoid warning |
Sergio Gonzalez Monroy | d04b60b | 2017-01-20 15:35:23 +0000 | [diff] [blame] | 410 | |
Neale Ranns | 4a58e49 | 2020-12-21 13:19:10 +0000 | [diff] [blame] | 411 | idx = ipsec_register_esp_backend ( |
| 412 | vm, im, "crypto engine backend", "esp4-encrypt", "esp4-encrypt-tun", |
| 413 | "esp4-decrypt", "esp4-decrypt-tun", "esp6-encrypt", "esp6-encrypt-tun", |
| 414 | "esp6-decrypt", "esp6-decrypt-tun", "esp-mpls-encrypt-tun", |
| 415 | ipsec_check_esp_support, NULL, crypto_dispatch_enable_disable); |
Klement Sekera | b4d3053 | 2018-11-08 13:00:02 +0100 | [diff] [blame] | 416 | im->esp_default_backend = idx; |
“mukeshyadav1984” | 430ac93 | 2017-11-23 02:39:33 -0800 | [diff] [blame] | 417 | |
Klement Sekera | b4d3053 | 2018-11-08 13:00:02 +0100 | [diff] [blame] | 418 | rv = ipsec_select_esp_backend (im, idx); |
| 419 | ASSERT (0 == rv); |
| 420 | (void) (rv); // avoid warning |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 421 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 422 | if ((error = vlib_call_init_function (vm, ipsec_cli_init))) |
| 423 | return error; |
| 424 | |
Damjan Marion | 91f17dc | 2019-03-18 18:59:25 +0100 | [diff] [blame] | 425 | vec_validate (im->crypto_algs, IPSEC_CRYPTO_N_ALG - 1); |
| 426 | |
Neale Ranns | 2cdcd0c | 2019-08-27 12:26:14 +0000 | [diff] [blame] | 427 | a = im->crypto_algs + IPSEC_CRYPTO_ALG_NONE; |
| 428 | a->enc_op_id = VNET_CRYPTO_OP_NONE; |
| 429 | a->dec_op_id = VNET_CRYPTO_OP_NONE; |
| 430 | a->alg = VNET_CRYPTO_ALG_NONE; |
| 431 | a->iv_size = 0; |
Christian Hopps | fb7e7ed | 2019-11-03 07:02:15 -0500 | [diff] [blame] | 432 | a->block_align = 1; |
Neale Ranns | 2cdcd0c | 2019-08-27 12:26:14 +0000 | [diff] [blame] | 433 | |
Damjan Marion | 91f17dc | 2019-03-18 18:59:25 +0100 | [diff] [blame] | 434 | a = im->crypto_algs + IPSEC_CRYPTO_ALG_DES_CBC; |
Damjan Marion | 060bfb9 | 2019-03-29 13:47:54 +0100 | [diff] [blame] | 435 | a->enc_op_id = VNET_CRYPTO_OP_DES_CBC_ENC; |
| 436 | a->dec_op_id = VNET_CRYPTO_OP_DES_CBC_DEC; |
Damjan Marion | d1bed68 | 2019-04-24 15:20:35 +0200 | [diff] [blame] | 437 | a->alg = VNET_CRYPTO_ALG_DES_CBC; |
Christian Hopps | fb7e7ed | 2019-11-03 07:02:15 -0500 | [diff] [blame] | 438 | a->iv_size = a->block_align = 8; |
Damjan Marion | 91f17dc | 2019-03-18 18:59:25 +0100 | [diff] [blame] | 439 | |
| 440 | a = im->crypto_algs + IPSEC_CRYPTO_ALG_3DES_CBC; |
Damjan Marion | 060bfb9 | 2019-03-29 13:47:54 +0100 | [diff] [blame] | 441 | a->enc_op_id = VNET_CRYPTO_OP_3DES_CBC_ENC; |
| 442 | a->dec_op_id = VNET_CRYPTO_OP_3DES_CBC_DEC; |
Damjan Marion | d1bed68 | 2019-04-24 15:20:35 +0200 | [diff] [blame] | 443 | a->alg = VNET_CRYPTO_ALG_3DES_CBC; |
Christian Hopps | fb7e7ed | 2019-11-03 07:02:15 -0500 | [diff] [blame] | 444 | a->iv_size = a->block_align = 8; |
Damjan Marion | 91f17dc | 2019-03-18 18:59:25 +0100 | [diff] [blame] | 445 | |
| 446 | a = im->crypto_algs + IPSEC_CRYPTO_ALG_AES_CBC_128; |
Damjan Marion | 060bfb9 | 2019-03-29 13:47:54 +0100 | [diff] [blame] | 447 | a->enc_op_id = VNET_CRYPTO_OP_AES_128_CBC_ENC; |
| 448 | a->dec_op_id = VNET_CRYPTO_OP_AES_128_CBC_DEC; |
Damjan Marion | d1bed68 | 2019-04-24 15:20:35 +0200 | [diff] [blame] | 449 | a->alg = VNET_CRYPTO_ALG_AES_128_CBC; |
Christian Hopps | fb7e7ed | 2019-11-03 07:02:15 -0500 | [diff] [blame] | 450 | a->iv_size = a->block_align = 16; |
Damjan Marion | 91f17dc | 2019-03-18 18:59:25 +0100 | [diff] [blame] | 451 | |
| 452 | a = im->crypto_algs + IPSEC_CRYPTO_ALG_AES_CBC_192; |
Damjan Marion | 060bfb9 | 2019-03-29 13:47:54 +0100 | [diff] [blame] | 453 | a->enc_op_id = VNET_CRYPTO_OP_AES_192_CBC_ENC; |
| 454 | a->dec_op_id = VNET_CRYPTO_OP_AES_192_CBC_DEC; |
Damjan Marion | d1bed68 | 2019-04-24 15:20:35 +0200 | [diff] [blame] | 455 | a->alg = VNET_CRYPTO_ALG_AES_192_CBC; |
Christian Hopps | fb7e7ed | 2019-11-03 07:02:15 -0500 | [diff] [blame] | 456 | a->iv_size = a->block_align = 16; |
Damjan Marion | 91f17dc | 2019-03-18 18:59:25 +0100 | [diff] [blame] | 457 | |
| 458 | a = im->crypto_algs + IPSEC_CRYPTO_ALG_AES_CBC_256; |
Damjan Marion | 060bfb9 | 2019-03-29 13:47:54 +0100 | [diff] [blame] | 459 | a->enc_op_id = VNET_CRYPTO_OP_AES_256_CBC_ENC; |
| 460 | a->dec_op_id = VNET_CRYPTO_OP_AES_256_CBC_DEC; |
Damjan Marion | d1bed68 | 2019-04-24 15:20:35 +0200 | [diff] [blame] | 461 | a->alg = VNET_CRYPTO_ALG_AES_256_CBC; |
Christian Hopps | fb7e7ed | 2019-11-03 07:02:15 -0500 | [diff] [blame] | 462 | a->iv_size = a->block_align = 16; |
Damjan Marion | 91f17dc | 2019-03-18 18:59:25 +0100 | [diff] [blame] | 463 | |
Benoît Ganne | 490b927 | 2021-01-22 18:03:09 +0100 | [diff] [blame] | 464 | a = im->crypto_algs + IPSEC_CRYPTO_ALG_AES_CTR_128; |
| 465 | a->enc_op_id = VNET_CRYPTO_OP_AES_128_CTR_ENC; |
| 466 | a->dec_op_id = VNET_CRYPTO_OP_AES_128_CTR_DEC; |
| 467 | a->alg = VNET_CRYPTO_ALG_AES_128_CTR; |
| 468 | a->iv_size = 8; |
| 469 | a->block_align = 1; |
| 470 | |
| 471 | a = im->crypto_algs + IPSEC_CRYPTO_ALG_AES_CTR_192; |
| 472 | a->enc_op_id = VNET_CRYPTO_OP_AES_192_CTR_ENC; |
| 473 | a->dec_op_id = VNET_CRYPTO_OP_AES_192_CTR_DEC; |
| 474 | a->alg = VNET_CRYPTO_ALG_AES_192_CTR; |
| 475 | a->iv_size = 8; |
| 476 | a->block_align = 1; |
| 477 | |
| 478 | a = im->crypto_algs + IPSEC_CRYPTO_ALG_AES_CTR_256; |
| 479 | a->enc_op_id = VNET_CRYPTO_OP_AES_256_CTR_ENC; |
| 480 | a->dec_op_id = VNET_CRYPTO_OP_AES_256_CTR_DEC; |
| 481 | a->alg = VNET_CRYPTO_ALG_AES_256_CTR; |
| 482 | a->iv_size = 8; |
| 483 | a->block_align = 1; |
| 484 | |
Neale Ranns | 47feb11 | 2019-04-11 15:14:07 +0000 | [diff] [blame] | 485 | a = im->crypto_algs + IPSEC_CRYPTO_ALG_AES_GCM_128; |
| 486 | a->enc_op_id = VNET_CRYPTO_OP_AES_128_GCM_ENC; |
| 487 | a->dec_op_id = VNET_CRYPTO_OP_AES_128_GCM_DEC; |
Damjan Marion | d1bed68 | 2019-04-24 15:20:35 +0200 | [diff] [blame] | 488 | a->alg = VNET_CRYPTO_ALG_AES_128_GCM; |
Damjan Marion | f1ecb65 | 2020-02-10 19:21:14 +0100 | [diff] [blame] | 489 | a->iv_size = 8; |
Christian Hopps | fb7e7ed | 2019-11-03 07:02:15 -0500 | [diff] [blame] | 490 | a->block_align = 1; |
Neale Ranns | 47feb11 | 2019-04-11 15:14:07 +0000 | [diff] [blame] | 491 | a->icv_size = 16; |
| 492 | |
| 493 | a = im->crypto_algs + IPSEC_CRYPTO_ALG_AES_GCM_192; |
| 494 | a->enc_op_id = VNET_CRYPTO_OP_AES_192_GCM_ENC; |
| 495 | a->dec_op_id = VNET_CRYPTO_OP_AES_192_GCM_DEC; |
Damjan Marion | d1bed68 | 2019-04-24 15:20:35 +0200 | [diff] [blame] | 496 | a->alg = VNET_CRYPTO_ALG_AES_192_GCM; |
Damjan Marion | f1ecb65 | 2020-02-10 19:21:14 +0100 | [diff] [blame] | 497 | a->iv_size = 8; |
Christian Hopps | fb7e7ed | 2019-11-03 07:02:15 -0500 | [diff] [blame] | 498 | a->block_align = 1; |
Neale Ranns | 47feb11 | 2019-04-11 15:14:07 +0000 | [diff] [blame] | 499 | a->icv_size = 16; |
| 500 | |
| 501 | a = im->crypto_algs + IPSEC_CRYPTO_ALG_AES_GCM_256; |
| 502 | a->enc_op_id = VNET_CRYPTO_OP_AES_256_GCM_ENC; |
| 503 | a->dec_op_id = VNET_CRYPTO_OP_AES_256_GCM_DEC; |
Damjan Marion | d1bed68 | 2019-04-24 15:20:35 +0200 | [diff] [blame] | 504 | a->alg = VNET_CRYPTO_ALG_AES_256_GCM; |
Damjan Marion | f1ecb65 | 2020-02-10 19:21:14 +0100 | [diff] [blame] | 505 | a->iv_size = 8; |
Christian Hopps | fb7e7ed | 2019-11-03 07:02:15 -0500 | [diff] [blame] | 506 | a->block_align = 1; |
Neale Ranns | 47feb11 | 2019-04-11 15:14:07 +0000 | [diff] [blame] | 507 | a->icv_size = 16; |
| 508 | |
Damjan Marion | 91f17dc | 2019-03-18 18:59:25 +0100 | [diff] [blame] | 509 | vec_validate (im->integ_algs, IPSEC_INTEG_N_ALG - 1); |
| 510 | ipsec_main_integ_alg_t *i; |
| 511 | |
Dmitry Vakhrushev | 77cc14a | 2019-08-14 00:12:33 -0400 | [diff] [blame] | 512 | i = &im->integ_algs[IPSEC_INTEG_ALG_MD5_96]; |
| 513 | i->op_id = VNET_CRYPTO_OP_MD5_HMAC; |
| 514 | i->alg = VNET_CRYPTO_ALG_HMAC_MD5; |
| 515 | i->icv_size = 12; |
| 516 | |
Damjan Marion | 91f17dc | 2019-03-18 18:59:25 +0100 | [diff] [blame] | 517 | i = &im->integ_algs[IPSEC_INTEG_ALG_SHA1_96]; |
Damjan Marion | 060bfb9 | 2019-03-29 13:47:54 +0100 | [diff] [blame] | 518 | i->op_id = VNET_CRYPTO_OP_SHA1_HMAC; |
Damjan Marion | d1bed68 | 2019-04-24 15:20:35 +0200 | [diff] [blame] | 519 | i->alg = VNET_CRYPTO_ALG_HMAC_SHA1; |
Damjan Marion | 7c22ff7 | 2019-04-04 12:25:44 +0200 | [diff] [blame] | 520 | i->icv_size = 12; |
Damjan Marion | 91f17dc | 2019-03-18 18:59:25 +0100 | [diff] [blame] | 521 | |
| 522 | i = &im->integ_algs[IPSEC_INTEG_ALG_SHA_256_96]; |
Damjan Marion | 060bfb9 | 2019-03-29 13:47:54 +0100 | [diff] [blame] | 523 | i->op_id = VNET_CRYPTO_OP_SHA1_HMAC; |
Damjan Marion | d1bed68 | 2019-04-24 15:20:35 +0200 | [diff] [blame] | 524 | i->alg = VNET_CRYPTO_ALG_HMAC_SHA256; |
Damjan Marion | 7c22ff7 | 2019-04-04 12:25:44 +0200 | [diff] [blame] | 525 | i->icv_size = 12; |
Damjan Marion | 91f17dc | 2019-03-18 18:59:25 +0100 | [diff] [blame] | 526 | |
| 527 | i = &im->integ_algs[IPSEC_INTEG_ALG_SHA_256_128]; |
Damjan Marion | 060bfb9 | 2019-03-29 13:47:54 +0100 | [diff] [blame] | 528 | i->op_id = VNET_CRYPTO_OP_SHA256_HMAC; |
Damjan Marion | d1bed68 | 2019-04-24 15:20:35 +0200 | [diff] [blame] | 529 | i->alg = VNET_CRYPTO_ALG_HMAC_SHA256; |
Damjan Marion | 7c22ff7 | 2019-04-04 12:25:44 +0200 | [diff] [blame] | 530 | i->icv_size = 16; |
Damjan Marion | 91f17dc | 2019-03-18 18:59:25 +0100 | [diff] [blame] | 531 | |
| 532 | i = &im->integ_algs[IPSEC_INTEG_ALG_SHA_384_192]; |
Damjan Marion | 060bfb9 | 2019-03-29 13:47:54 +0100 | [diff] [blame] | 533 | i->op_id = VNET_CRYPTO_OP_SHA384_HMAC; |
Damjan Marion | 4cb8381 | 2019-04-24 17:32:01 +0200 | [diff] [blame] | 534 | i->alg = VNET_CRYPTO_ALG_HMAC_SHA384; |
Damjan Marion | 7c22ff7 | 2019-04-04 12:25:44 +0200 | [diff] [blame] | 535 | i->icv_size = 24; |
Damjan Marion | 91f17dc | 2019-03-18 18:59:25 +0100 | [diff] [blame] | 536 | |
| 537 | i = &im->integ_algs[IPSEC_INTEG_ALG_SHA_512_256]; |
Damjan Marion | 060bfb9 | 2019-03-29 13:47:54 +0100 | [diff] [blame] | 538 | i->op_id = VNET_CRYPTO_OP_SHA512_HMAC; |
Damjan Marion | d1bed68 | 2019-04-24 15:20:35 +0200 | [diff] [blame] | 539 | i->alg = VNET_CRYPTO_ALG_HMAC_SHA512; |
Damjan Marion | 7c22ff7 | 2019-04-04 12:25:44 +0200 | [diff] [blame] | 540 | i->icv_size = 32; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 541 | |
Neale Ranns | 5ae793a | 2019-04-03 13:36:56 +0000 | [diff] [blame] | 542 | vec_validate_aligned (im->ptd, vlib_num_workers (), CLIB_CACHE_LINE_BYTES); |
Damjan Marion | c59b9a2 | 2019-03-19 15:38:40 +0100 | [diff] [blame] | 543 | |
Fan Zhang | f539578 | 2020-04-29 14:00:03 +0100 | [diff] [blame] | 544 | im->async_mode = 0; |
| 545 | crypto_engine_backend_register_post_node (vm); |
| 546 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 547 | return 0; |
| 548 | } |
| 549 | |
| 550 | VLIB_INIT_FUNCTION (ipsec_init); |
Keith Burns (alagalah) | 166a9d4 | 2016-08-06 11:00:56 -0700 | [diff] [blame] | 551 | |
| 552 | /* |
| 553 | * fd.io coding-style-patch-verification: ON |
| 554 | * |
| 555 | * Local Variables: |
| 556 | * eval: (c-set-style "gnu") |
| 557 | * End: |
| 558 | */ |