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> |
Klement Sekera | 4b089f2 | 2018-04-17 18:04:57 +0200 | [diff] [blame] | 22 | #include <vnet/udp/udp.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 | |
Matthew Smith | 401aedf | 2019-07-08 14:45:04 -0500 | [diff] [blame] | 127 | void |
Neale Ranns | e8915fc | 2019-04-23 20:57:55 -0400 | [diff] [blame] | 128 | ipsec_add_feature (const char *arc_name, |
| 129 | const char *node_name, u32 * out_feature_index) |
| 130 | { |
| 131 | u8 arc; |
| 132 | |
| 133 | arc = vnet_get_feature_arc_index (arc_name); |
Neale Ranns | 0224514 | 2019-05-13 23:07:43 -0700 | [diff] [blame] | 134 | ASSERT (arc != (u8) ~ 0); |
Neale Ranns | e8915fc | 2019-04-23 20:57:55 -0400 | [diff] [blame] | 135 | *out_feature_index = vnet_get_feature_index (arc, node_name); |
| 136 | } |
| 137 | |
Klement Sekera | b4d3053 | 2018-11-08 13:00:02 +0100 | [diff] [blame] | 138 | u32 |
| 139 | ipsec_register_ah_backend (vlib_main_t * vm, ipsec_main_t * im, |
| 140 | const char *name, |
| 141 | const char *ah4_encrypt_node_name, |
| 142 | const char *ah4_decrypt_node_name, |
| 143 | const char *ah6_encrypt_node_name, |
| 144 | const char *ah6_decrypt_node_name, |
| 145 | check_support_cb_t ah_check_support_cb, |
| 146 | add_del_sa_sess_cb_t ah_add_del_sa_sess_cb) |
| 147 | { |
| 148 | ipsec_ah_backend_t *b; |
| 149 | pool_get (im->ah_backends, b); |
Kingwel Xie | 561d1ca | 2019-03-05 22:56:17 -0500 | [diff] [blame] | 150 | b->name = format (0, "%s%c", name, 0); |
Klement Sekera | b4d3053 | 2018-11-08 13:00:02 +0100 | [diff] [blame] | 151 | |
Pierre Pfister | 057b356 | 2018-12-10 17:01:01 +0100 | [diff] [blame] | 152 | ipsec_add_node (vm, ah4_encrypt_node_name, "ipsec4-output-feature", |
Klement Sekera | b4d3053 | 2018-11-08 13:00:02 +0100 | [diff] [blame] | 153 | &b->ah4_encrypt_node_index, &b->ah4_encrypt_next_index); |
Pierre Pfister | 057b356 | 2018-12-10 17:01:01 +0100 | [diff] [blame] | 154 | ipsec_add_node (vm, ah4_decrypt_node_name, "ipsec4-input-feature", |
Klement Sekera | b4d3053 | 2018-11-08 13:00:02 +0100 | [diff] [blame] | 155 | &b->ah4_decrypt_node_index, &b->ah4_decrypt_next_index); |
Pierre Pfister | 057b356 | 2018-12-10 17:01:01 +0100 | [diff] [blame] | 156 | ipsec_add_node (vm, ah6_encrypt_node_name, "ipsec6-output-feature", |
Klement Sekera | b4d3053 | 2018-11-08 13:00:02 +0100 | [diff] [blame] | 157 | &b->ah6_encrypt_node_index, &b->ah6_encrypt_next_index); |
Pierre Pfister | 057b356 | 2018-12-10 17:01:01 +0100 | [diff] [blame] | 158 | ipsec_add_node (vm, ah6_decrypt_node_name, "ipsec6-input-feature", |
Klement Sekera | b4d3053 | 2018-11-08 13:00:02 +0100 | [diff] [blame] | 159 | &b->ah6_decrypt_node_index, &b->ah6_decrypt_next_index); |
| 160 | |
| 161 | b->check_support_cb = ah_check_support_cb; |
| 162 | b->add_del_sa_sess_cb = ah_add_del_sa_sess_cb; |
| 163 | return b - im->ah_backends; |
| 164 | } |
| 165 | |
| 166 | u32 |
| 167 | ipsec_register_esp_backend (vlib_main_t * vm, ipsec_main_t * im, |
| 168 | const char *name, |
| 169 | const char *esp4_encrypt_node_name, |
Neale Ranns | e8915fc | 2019-04-23 20:57:55 -0400 | [diff] [blame] | 170 | const char *esp4_encrypt_node_tun_name, |
Klement Sekera | b4d3053 | 2018-11-08 13:00:02 +0100 | [diff] [blame] | 171 | const char *esp4_decrypt_node_name, |
Neale Ranns | 7ec120e | 2020-01-21 04:58:02 +0000 | [diff] [blame] | 172 | const char *esp4_decrypt_tun_node_name, |
Klement Sekera | b4d3053 | 2018-11-08 13:00:02 +0100 | [diff] [blame] | 173 | const char *esp6_encrypt_node_name, |
Neale Ranns | e8915fc | 2019-04-23 20:57:55 -0400 | [diff] [blame] | 174 | const char *esp6_encrypt_node_tun_name, |
Klement Sekera | b4d3053 | 2018-11-08 13:00:02 +0100 | [diff] [blame] | 175 | const char *esp6_decrypt_node_name, |
Neale Ranns | 7ec120e | 2020-01-21 04:58:02 +0000 | [diff] [blame] | 176 | const char *esp6_decrypt_tun_node_name, |
Klement Sekera | b4d3053 | 2018-11-08 13:00:02 +0100 | [diff] [blame] | 177 | check_support_cb_t esp_check_support_cb, |
Fan Zhang | f539578 | 2020-04-29 14:00:03 +0100 | [diff] [blame] | 178 | add_del_sa_sess_cb_t esp_add_del_sa_sess_cb, |
| 179 | enable_disable_cb_t enable_disable_cb) |
Klement Sekera | b4d3053 | 2018-11-08 13:00:02 +0100 | [diff] [blame] | 180 | { |
| 181 | ipsec_esp_backend_t *b; |
Neale Ranns | e8915fc | 2019-04-23 20:57:55 -0400 | [diff] [blame] | 182 | |
Klement Sekera | b4d3053 | 2018-11-08 13:00:02 +0100 | [diff] [blame] | 183 | pool_get (im->esp_backends, b); |
Kingwel Xie | 561d1ca | 2019-03-05 22:56:17 -0500 | [diff] [blame] | 184 | b->name = format (0, "%s%c", name, 0); |
Klement Sekera | b4d3053 | 2018-11-08 13:00:02 +0100 | [diff] [blame] | 185 | |
Pierre Pfister | 057b356 | 2018-12-10 17:01:01 +0100 | [diff] [blame] | 186 | ipsec_add_node (vm, esp4_encrypt_node_name, "ipsec4-output-feature", |
Klement Sekera | b4d3053 | 2018-11-08 13:00:02 +0100 | [diff] [blame] | 187 | &b->esp4_encrypt_node_index, &b->esp4_encrypt_next_index); |
Pierre Pfister | 057b356 | 2018-12-10 17:01:01 +0100 | [diff] [blame] | 188 | ipsec_add_node (vm, esp4_decrypt_node_name, "ipsec4-input-feature", |
Klement Sekera | b4d3053 | 2018-11-08 13:00:02 +0100 | [diff] [blame] | 189 | &b->esp4_decrypt_node_index, &b->esp4_decrypt_next_index); |
Pierre Pfister | 057b356 | 2018-12-10 17:01:01 +0100 | [diff] [blame] | 190 | ipsec_add_node (vm, esp6_encrypt_node_name, "ipsec6-output-feature", |
Klement Sekera | b4d3053 | 2018-11-08 13:00:02 +0100 | [diff] [blame] | 191 | &b->esp6_encrypt_node_index, &b->esp6_encrypt_next_index); |
Pierre Pfister | 057b356 | 2018-12-10 17:01:01 +0100 | [diff] [blame] | 192 | ipsec_add_node (vm, esp6_decrypt_node_name, "ipsec6-input-feature", |
Klement Sekera | b4d3053 | 2018-11-08 13:00:02 +0100 | [diff] [blame] | 193 | &b->esp6_decrypt_node_index, &b->esp6_decrypt_next_index); |
Neale Ranns | 7ec120e | 2020-01-21 04:58:02 +0000 | [diff] [blame] | 194 | ipsec_add_node (vm, esp4_decrypt_tun_node_name, "ipsec4-tun-input", |
| 195 | &b->esp4_decrypt_tun_node_index, |
| 196 | &b->esp4_decrypt_tun_next_index); |
| 197 | ipsec_add_node (vm, esp6_decrypt_tun_node_name, "ipsec6-tun-input", |
| 198 | &b->esp6_decrypt_tun_node_index, |
| 199 | &b->esp6_decrypt_tun_next_index); |
Klement Sekera | b4d3053 | 2018-11-08 13:00:02 +0100 | [diff] [blame] | 200 | |
Neale Ranns | e8915fc | 2019-04-23 20:57:55 -0400 | [diff] [blame] | 201 | ipsec_add_feature ("ip4-output", esp4_encrypt_node_tun_name, |
Neale Ranns | 0295040 | 2019-12-20 00:54:57 +0000 | [diff] [blame] | 202 | &b->esp44_encrypt_tun_feature_index); |
| 203 | ipsec_add_feature ("ip4-output", esp6_encrypt_node_tun_name, |
| 204 | &b->esp46_encrypt_tun_feature_index); |
Neale Ranns | e8915fc | 2019-04-23 20:57:55 -0400 | [diff] [blame] | 205 | ipsec_add_feature ("ip6-output", esp6_encrypt_node_tun_name, |
Neale Ranns | 0295040 | 2019-12-20 00:54:57 +0000 | [diff] [blame] | 206 | &b->esp66_encrypt_tun_feature_index); |
| 207 | ipsec_add_feature ("ip6-output", esp4_encrypt_node_tun_name, |
| 208 | &b->esp64_encrypt_tun_feature_index); |
Neale Ranns | e8915fc | 2019-04-23 20:57:55 -0400 | [diff] [blame] | 209 | |
Klement Sekera | b4d3053 | 2018-11-08 13:00:02 +0100 | [diff] [blame] | 210 | b->check_support_cb = esp_check_support_cb; |
| 211 | b->add_del_sa_sess_cb = esp_add_del_sa_sess_cb; |
Fan Zhang | f539578 | 2020-04-29 14:00:03 +0100 | [diff] [blame] | 212 | b->enable_disable_cb = enable_disable_cb; |
| 213 | |
Klement Sekera | b4d3053 | 2018-11-08 13:00:02 +0100 | [diff] [blame] | 214 | return b - im->esp_backends; |
| 215 | } |
| 216 | |
Neale Ranns | e8915fc | 2019-04-23 20:57:55 -0400 | [diff] [blame] | 217 | clib_error_t * |
| 218 | ipsec_rsc_in_use (ipsec_main_t * im) |
Neale Ranns | b4cfd55 | 2019-02-13 02:08:06 -0800 | [diff] [blame] | 219 | { |
Neale Ranns | e8915fc | 2019-04-23 20:57:55 -0400 | [diff] [blame] | 220 | /* return an error is crypto resource are in use */ |
| 221 | if (pool_elts (im->sad) > 0) |
| 222 | return clib_error_return (0, |
| 223 | "%d SA entries configured", |
| 224 | pool_elts (im->sad)); |
Neale Ranns | b4cfd55 | 2019-02-13 02:08:06 -0800 | [diff] [blame] | 225 | |
Neale Ranns | e8915fc | 2019-04-23 20:57:55 -0400 | [diff] [blame] | 226 | return (NULL); |
Neale Ranns | b4cfd55 | 2019-02-13 02:08:06 -0800 | [diff] [blame] | 227 | } |
| 228 | |
Klement Sekera | b4d3053 | 2018-11-08 13:00:02 +0100 | [diff] [blame] | 229 | int |
| 230 | ipsec_select_ah_backend (ipsec_main_t * im, u32 backend_idx) |
| 231 | { |
Neale Ranns | e8915fc | 2019-04-23 20:57:55 -0400 | [diff] [blame] | 232 | if (ipsec_rsc_in_use (im)) |
| 233 | return VNET_API_ERROR_RSRC_IN_USE; |
| 234 | |
| 235 | if (pool_is_free_index (im->ah_backends, backend_idx)) |
| 236 | return VNET_API_ERROR_INVALID_VALUE; |
| 237 | |
Klement Sekera | b4d3053 | 2018-11-08 13:00:02 +0100 | [diff] [blame] | 238 | ipsec_ah_backend_t *b = pool_elt_at_index (im->ah_backends, backend_idx); |
| 239 | im->ah_current_backend = backend_idx; |
| 240 | im->ah4_encrypt_node_index = b->ah4_encrypt_node_index; |
| 241 | im->ah4_decrypt_node_index = b->ah4_decrypt_node_index; |
| 242 | im->ah4_encrypt_next_index = b->ah4_encrypt_next_index; |
| 243 | im->ah4_decrypt_next_index = b->ah4_decrypt_next_index; |
| 244 | im->ah6_encrypt_node_index = b->ah6_encrypt_node_index; |
| 245 | im->ah6_decrypt_node_index = b->ah6_decrypt_node_index; |
| 246 | im->ah6_encrypt_next_index = b->ah6_encrypt_next_index; |
| 247 | im->ah6_decrypt_next_index = b->ah6_decrypt_next_index; |
Neale Ranns | b4cfd55 | 2019-02-13 02:08:06 -0800 | [diff] [blame] | 248 | |
Klement Sekera | b4d3053 | 2018-11-08 13:00:02 +0100 | [diff] [blame] | 249 | return 0; |
| 250 | } |
| 251 | |
| 252 | int |
| 253 | ipsec_select_esp_backend (ipsec_main_t * im, u32 backend_idx) |
| 254 | { |
Neale Ranns | e8915fc | 2019-04-23 20:57:55 -0400 | [diff] [blame] | 255 | if (ipsec_rsc_in_use (im)) |
| 256 | return VNET_API_ERROR_RSRC_IN_USE; |
| 257 | |
| 258 | if (pool_is_free_index (im->esp_backends, backend_idx)) |
| 259 | return VNET_API_ERROR_INVALID_VALUE; |
| 260 | |
Fan Zhang | f539578 | 2020-04-29 14:00:03 +0100 | [diff] [blame] | 261 | /* disable current backend */ |
| 262 | if (im->esp_current_backend != ~0) |
| 263 | { |
| 264 | ipsec_esp_backend_t *cb = pool_elt_at_index (im->esp_backends, |
| 265 | im->esp_current_backend); |
| 266 | if (cb->enable_disable_cb) |
| 267 | { |
| 268 | if ((cb->enable_disable_cb) (0) != 0) |
| 269 | return -1; |
| 270 | } |
| 271 | } |
| 272 | |
Klement Sekera | b4d3053 | 2018-11-08 13:00:02 +0100 | [diff] [blame] | 273 | ipsec_esp_backend_t *b = pool_elt_at_index (im->esp_backends, backend_idx); |
| 274 | im->esp_current_backend = backend_idx; |
| 275 | im->esp4_encrypt_node_index = b->esp4_encrypt_node_index; |
| 276 | im->esp4_decrypt_node_index = b->esp4_decrypt_node_index; |
| 277 | im->esp4_encrypt_next_index = b->esp4_encrypt_next_index; |
| 278 | im->esp4_decrypt_next_index = b->esp4_decrypt_next_index; |
| 279 | im->esp6_encrypt_node_index = b->esp6_encrypt_node_index; |
| 280 | im->esp6_decrypt_node_index = b->esp6_decrypt_node_index; |
| 281 | im->esp6_encrypt_next_index = b->esp6_encrypt_next_index; |
| 282 | im->esp6_decrypt_next_index = b->esp6_decrypt_next_index; |
Neale Ranns | 7ec120e | 2020-01-21 04:58:02 +0000 | [diff] [blame] | 283 | im->esp4_decrypt_tun_node_index = b->esp4_decrypt_tun_node_index; |
| 284 | im->esp4_decrypt_tun_next_index = b->esp4_decrypt_tun_next_index; |
| 285 | im->esp6_decrypt_tun_node_index = b->esp6_decrypt_tun_node_index; |
| 286 | im->esp6_decrypt_tun_next_index = b->esp6_decrypt_tun_next_index; |
Neale Ranns | b4cfd55 | 2019-02-13 02:08:06 -0800 | [diff] [blame] | 287 | |
Neale Ranns | 0295040 | 2019-12-20 00:54:57 +0000 | [diff] [blame] | 288 | im->esp44_encrypt_tun_feature_index = b->esp44_encrypt_tun_feature_index; |
| 289 | im->esp64_encrypt_tun_feature_index = b->esp64_encrypt_tun_feature_index; |
| 290 | im->esp46_encrypt_tun_feature_index = b->esp46_encrypt_tun_feature_index; |
| 291 | im->esp66_encrypt_tun_feature_index = b->esp66_encrypt_tun_feature_index; |
Neale Ranns | e8915fc | 2019-04-23 20:57:55 -0400 | [diff] [blame] | 292 | |
Fan Zhang | f539578 | 2020-04-29 14:00:03 +0100 | [diff] [blame] | 293 | if (b->enable_disable_cb) |
| 294 | { |
| 295 | if ((b->enable_disable_cb) (1) != 0) |
| 296 | return -1; |
| 297 | } |
Klement Sekera | b4d3053 | 2018-11-08 13:00:02 +0100 | [diff] [blame] | 298 | return 0; |
| 299 | } |
| 300 | |
Fan Zhang | f539578 | 2020-04-29 14:00:03 +0100 | [diff] [blame] | 301 | void |
| 302 | ipsec_set_async_mode (u32 is_enabled) |
| 303 | { |
| 304 | ipsec_main_t *im = &ipsec_main; |
| 305 | ipsec_sa_t *sa; |
| 306 | |
| 307 | /* lock all SAs before change im->async_mode */ |
| 308 | pool_foreach (sa, im->sad, ( |
| 309 | { |
| 310 | fib_node_lock (&sa->node); |
| 311 | })); |
| 312 | |
| 313 | im->async_mode = is_enabled; |
| 314 | |
| 315 | /* change SA crypto op data before unlock them */ |
| 316 | pool_foreach (sa, im->sad, ( |
| 317 | { |
| 318 | sa->crypto_op_data = is_enabled ? |
| 319 | sa->async_op_data.data : sa->sync_op_data.data; |
| 320 | fib_node_unlock (&sa->node); |
| 321 | })); |
| 322 | } |
| 323 | |
| 324 | static void |
| 325 | crypto_engine_backend_register_post_node (vlib_main_t * vm) |
| 326 | { |
| 327 | esp_async_post_next_t *eit; |
| 328 | esp_async_post_next_t *dit; |
| 329 | |
| 330 | eit = &esp_encrypt_async_next; |
| 331 | eit->esp4_post_next = |
| 332 | vnet_crypto_register_post_node (vm, "esp4-encrypt-post"); |
| 333 | eit->esp6_post_next = |
| 334 | vnet_crypto_register_post_node (vm, "esp6-encrypt-post"); |
| 335 | eit->esp4_tun_post_next = |
| 336 | vnet_crypto_register_post_node (vm, "esp4-encrypt-tun-post"); |
| 337 | eit->esp6_tun_post_next = |
| 338 | vnet_crypto_register_post_node (vm, "esp6-encrypt-tun-post"); |
| 339 | |
| 340 | dit = &esp_decrypt_async_next; |
| 341 | dit->esp4_post_next = |
| 342 | vnet_crypto_register_post_node (vm, "esp4-decrypt-post"); |
| 343 | dit->esp6_post_next = |
| 344 | vnet_crypto_register_post_node (vm, "esp6-decrypt-post"); |
| 345 | dit->esp4_tun_post_next = |
| 346 | vnet_crypto_register_post_node (vm, "esp4-decrypt-tun-post"); |
| 347 | dit->esp6_tun_post_next = |
| 348 | vnet_crypto_register_post_node (vm, "esp6-decrypt-tun-post"); |
| 349 | } |
| 350 | |
Sergio Gonzalez Monroy | d04b60b | 2017-01-20 15:35:23 +0000 | [diff] [blame] | 351 | static clib_error_t * |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 352 | ipsec_init (vlib_main_t * vm) |
| 353 | { |
Keith Burns (alagalah) | 166a9d4 | 2016-08-06 11:00:56 -0700 | [diff] [blame] | 354 | clib_error_t *error; |
| 355 | ipsec_main_t *im = &ipsec_main; |
Damjan Marion | 91f17dc | 2019-03-18 18:59:25 +0100 | [diff] [blame] | 356 | ipsec_main_crypto_alg_t *a; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 357 | |
Dave Barach | 0dd9165 | 2019-05-05 13:34:28 -0400 | [diff] [blame] | 358 | /* Backend registration requires the feature arcs to be set up */ |
| 359 | if ((error = vlib_call_init_function (vm, vnet_feature_init))) |
| 360 | return (error); |
| 361 | |
Keith Burns (alagalah) | 166a9d4 | 2016-08-06 11:00:56 -0700 | [diff] [blame] | 362 | im->vnet_main = vnet_get_main (); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 363 | im->vlib_main = vm; |
| 364 | |
Keith Burns (alagalah) | 166a9d4 | 2016-08-06 11:00:56 -0700 | [diff] [blame] | 365 | im->spd_index_by_spd_id = hash_create (0, sizeof (uword)); |
| 366 | im->sa_index_by_sa_id = hash_create (0, sizeof (uword)); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 367 | im->spd_index_by_sw_if_index = hash_create (0, sizeof (uword)); |
| 368 | |
Klement Sekera | b4d3053 | 2018-11-08 13:00:02 +0100 | [diff] [blame] | 369 | 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] | 370 | ASSERT (node); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 371 | im->error_drop_node_index = node->index; |
| 372 | |
Fan Zhang | f539578 | 2020-04-29 14:00:03 +0100 | [diff] [blame] | 373 | im->ah_current_backend = ~0; |
| 374 | im->esp_current_backend = ~0; |
| 375 | |
Neale Ranns | d1a5b2d | 2019-05-16 17:09:28 +0000 | [diff] [blame] | 376 | u32 idx = ipsec_register_ah_backend (vm, im, "crypto engine backend", |
Klement Sekera | b4d3053 | 2018-11-08 13:00:02 +0100 | [diff] [blame] | 377 | "ah4-encrypt", |
| 378 | "ah4-decrypt", |
| 379 | "ah6-encrypt", |
| 380 | "ah6-decrypt", |
Klement Sekera | 4fd5a9d | 2019-01-30 11:11:23 +0100 | [diff] [blame] | 381 | ipsec_check_ah_support, |
Klement Sekera | b4d3053 | 2018-11-08 13:00:02 +0100 | [diff] [blame] | 382 | NULL); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 383 | |
Klement Sekera | b4d3053 | 2018-11-08 13:00:02 +0100 | [diff] [blame] | 384 | im->ah_default_backend = idx; |
| 385 | int rv = ipsec_select_ah_backend (im, idx); |
| 386 | ASSERT (0 == rv); |
| 387 | (void) (rv); // avoid warning |
Sergio Gonzalez Monroy | d04b60b | 2017-01-20 15:35:23 +0000 | [diff] [blame] | 388 | |
Neale Ranns | d1a5b2d | 2019-05-16 17:09:28 +0000 | [diff] [blame] | 389 | idx = ipsec_register_esp_backend (vm, im, "crypto engine backend", |
Klement Sekera | b4d3053 | 2018-11-08 13:00:02 +0100 | [diff] [blame] | 390 | "esp4-encrypt", |
Neale Ranns | e8915fc | 2019-04-23 20:57:55 -0400 | [diff] [blame] | 391 | "esp4-encrypt-tun", |
Klement Sekera | b4d3053 | 2018-11-08 13:00:02 +0100 | [diff] [blame] | 392 | "esp4-decrypt", |
Neale Ranns | 7ec120e | 2020-01-21 04:58:02 +0000 | [diff] [blame] | 393 | "esp4-decrypt-tun", |
Klement Sekera | b4d3053 | 2018-11-08 13:00:02 +0100 | [diff] [blame] | 394 | "esp6-encrypt", |
Neale Ranns | e8915fc | 2019-04-23 20:57:55 -0400 | [diff] [blame] | 395 | "esp6-encrypt-tun", |
Klement Sekera | b4d3053 | 2018-11-08 13:00:02 +0100 | [diff] [blame] | 396 | "esp6-decrypt", |
Neale Ranns | 7ec120e | 2020-01-21 04:58:02 +0000 | [diff] [blame] | 397 | "esp6-decrypt-tun", |
Fan Zhang | f539578 | 2020-04-29 14:00:03 +0100 | [diff] [blame] | 398 | ipsec_check_esp_support, |
| 399 | NULL, crypto_dispatch_enable_disable); |
Klement Sekera | b4d3053 | 2018-11-08 13:00:02 +0100 | [diff] [blame] | 400 | im->esp_default_backend = idx; |
“mukeshyadav1984” | 430ac93 | 2017-11-23 02:39:33 -0800 | [diff] [blame] | 401 | |
Klement Sekera | b4d3053 | 2018-11-08 13:00:02 +0100 | [diff] [blame] | 402 | rv = ipsec_select_esp_backend (im, idx); |
| 403 | ASSERT (0 == rv); |
| 404 | (void) (rv); // avoid warning |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 405 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 406 | if ((error = vlib_call_init_function (vm, ipsec_cli_init))) |
| 407 | return error; |
| 408 | |
Damjan Marion | 91f17dc | 2019-03-18 18:59:25 +0100 | [diff] [blame] | 409 | vec_validate (im->crypto_algs, IPSEC_CRYPTO_N_ALG - 1); |
| 410 | |
Neale Ranns | 2cdcd0c | 2019-08-27 12:26:14 +0000 | [diff] [blame] | 411 | a = im->crypto_algs + IPSEC_CRYPTO_ALG_NONE; |
| 412 | a->enc_op_id = VNET_CRYPTO_OP_NONE; |
| 413 | a->dec_op_id = VNET_CRYPTO_OP_NONE; |
| 414 | a->alg = VNET_CRYPTO_ALG_NONE; |
| 415 | a->iv_size = 0; |
| 416 | a->block_size = 1; |
| 417 | |
Damjan Marion | 91f17dc | 2019-03-18 18:59:25 +0100 | [diff] [blame] | 418 | a = im->crypto_algs + IPSEC_CRYPTO_ALG_DES_CBC; |
Damjan Marion | 060bfb9 | 2019-03-29 13:47:54 +0100 | [diff] [blame] | 419 | a->enc_op_id = VNET_CRYPTO_OP_DES_CBC_ENC; |
| 420 | a->dec_op_id = VNET_CRYPTO_OP_DES_CBC_DEC; |
Damjan Marion | d1bed68 | 2019-04-24 15:20:35 +0200 | [diff] [blame] | 421 | a->alg = VNET_CRYPTO_ALG_DES_CBC; |
Damjan Marion | 91f17dc | 2019-03-18 18:59:25 +0100 | [diff] [blame] | 422 | a->iv_size = a->block_size = 8; |
| 423 | |
| 424 | a = im->crypto_algs + IPSEC_CRYPTO_ALG_3DES_CBC; |
Damjan Marion | 060bfb9 | 2019-03-29 13:47:54 +0100 | [diff] [blame] | 425 | a->enc_op_id = VNET_CRYPTO_OP_3DES_CBC_ENC; |
| 426 | a->dec_op_id = VNET_CRYPTO_OP_3DES_CBC_DEC; |
Damjan Marion | d1bed68 | 2019-04-24 15:20:35 +0200 | [diff] [blame] | 427 | a->alg = VNET_CRYPTO_ALG_3DES_CBC; |
Damjan Marion | 91f17dc | 2019-03-18 18:59:25 +0100 | [diff] [blame] | 428 | a->iv_size = a->block_size = 8; |
| 429 | |
| 430 | a = im->crypto_algs + IPSEC_CRYPTO_ALG_AES_CBC_128; |
Damjan Marion | 060bfb9 | 2019-03-29 13:47:54 +0100 | [diff] [blame] | 431 | a->enc_op_id = VNET_CRYPTO_OP_AES_128_CBC_ENC; |
| 432 | a->dec_op_id = VNET_CRYPTO_OP_AES_128_CBC_DEC; |
Damjan Marion | d1bed68 | 2019-04-24 15:20:35 +0200 | [diff] [blame] | 433 | a->alg = VNET_CRYPTO_ALG_AES_128_CBC; |
Damjan Marion | 91f17dc | 2019-03-18 18:59:25 +0100 | [diff] [blame] | 434 | a->iv_size = a->block_size = 16; |
| 435 | |
| 436 | a = im->crypto_algs + IPSEC_CRYPTO_ALG_AES_CBC_192; |
Damjan Marion | 060bfb9 | 2019-03-29 13:47:54 +0100 | [diff] [blame] | 437 | a->enc_op_id = VNET_CRYPTO_OP_AES_192_CBC_ENC; |
| 438 | a->dec_op_id = VNET_CRYPTO_OP_AES_192_CBC_DEC; |
Damjan Marion | d1bed68 | 2019-04-24 15:20:35 +0200 | [diff] [blame] | 439 | a->alg = VNET_CRYPTO_ALG_AES_192_CBC; |
Damjan Marion | 91f17dc | 2019-03-18 18:59:25 +0100 | [diff] [blame] | 440 | a->iv_size = a->block_size = 16; |
| 441 | |
| 442 | a = im->crypto_algs + IPSEC_CRYPTO_ALG_AES_CBC_256; |
Damjan Marion | 060bfb9 | 2019-03-29 13:47:54 +0100 | [diff] [blame] | 443 | a->enc_op_id = VNET_CRYPTO_OP_AES_256_CBC_ENC; |
| 444 | a->dec_op_id = VNET_CRYPTO_OP_AES_256_CBC_DEC; |
Damjan Marion | d1bed68 | 2019-04-24 15:20:35 +0200 | [diff] [blame] | 445 | a->alg = VNET_CRYPTO_ALG_AES_256_CBC; |
Damjan Marion | 91f17dc | 2019-03-18 18:59:25 +0100 | [diff] [blame] | 446 | a->iv_size = a->block_size = 16; |
| 447 | |
Neale Ranns | 47feb11 | 2019-04-11 15:14:07 +0000 | [diff] [blame] | 448 | a = im->crypto_algs + IPSEC_CRYPTO_ALG_AES_GCM_128; |
| 449 | a->enc_op_id = VNET_CRYPTO_OP_AES_128_GCM_ENC; |
| 450 | a->dec_op_id = VNET_CRYPTO_OP_AES_128_GCM_DEC; |
Damjan Marion | d1bed68 | 2019-04-24 15:20:35 +0200 | [diff] [blame] | 451 | a->alg = VNET_CRYPTO_ALG_AES_128_GCM; |
Damjan Marion | f1ecb65 | 2020-02-10 19:21:14 +0100 | [diff] [blame] | 452 | a->iv_size = 8; |
| 453 | a->block_size = 16; |
Neale Ranns | 47feb11 | 2019-04-11 15:14:07 +0000 | [diff] [blame] | 454 | a->icv_size = 16; |
| 455 | |
| 456 | a = im->crypto_algs + IPSEC_CRYPTO_ALG_AES_GCM_192; |
| 457 | a->enc_op_id = VNET_CRYPTO_OP_AES_192_GCM_ENC; |
| 458 | a->dec_op_id = VNET_CRYPTO_OP_AES_192_GCM_DEC; |
Damjan Marion | d1bed68 | 2019-04-24 15:20:35 +0200 | [diff] [blame] | 459 | a->alg = VNET_CRYPTO_ALG_AES_192_GCM; |
Damjan Marion | f1ecb65 | 2020-02-10 19:21:14 +0100 | [diff] [blame] | 460 | a->iv_size = 8; |
| 461 | a->block_size = 16; |
Neale Ranns | 47feb11 | 2019-04-11 15:14:07 +0000 | [diff] [blame] | 462 | a->icv_size = 16; |
| 463 | |
| 464 | a = im->crypto_algs + IPSEC_CRYPTO_ALG_AES_GCM_256; |
| 465 | a->enc_op_id = VNET_CRYPTO_OP_AES_256_GCM_ENC; |
| 466 | a->dec_op_id = VNET_CRYPTO_OP_AES_256_GCM_DEC; |
Damjan Marion | d1bed68 | 2019-04-24 15:20:35 +0200 | [diff] [blame] | 467 | a->alg = VNET_CRYPTO_ALG_AES_256_GCM; |
Damjan Marion | f1ecb65 | 2020-02-10 19:21:14 +0100 | [diff] [blame] | 468 | a->iv_size = 8; |
| 469 | a->block_size = 16; |
Neale Ranns | 47feb11 | 2019-04-11 15:14:07 +0000 | [diff] [blame] | 470 | a->icv_size = 16; |
| 471 | |
Damjan Marion | 91f17dc | 2019-03-18 18:59:25 +0100 | [diff] [blame] | 472 | vec_validate (im->integ_algs, IPSEC_INTEG_N_ALG - 1); |
| 473 | ipsec_main_integ_alg_t *i; |
| 474 | |
Dmitry Vakhrushev | 77cc14a | 2019-08-14 00:12:33 -0400 | [diff] [blame] | 475 | i = &im->integ_algs[IPSEC_INTEG_ALG_MD5_96]; |
| 476 | i->op_id = VNET_CRYPTO_OP_MD5_HMAC; |
| 477 | i->alg = VNET_CRYPTO_ALG_HMAC_MD5; |
| 478 | i->icv_size = 12; |
| 479 | |
Damjan Marion | 91f17dc | 2019-03-18 18:59:25 +0100 | [diff] [blame] | 480 | i = &im->integ_algs[IPSEC_INTEG_ALG_SHA1_96]; |
Damjan Marion | 060bfb9 | 2019-03-29 13:47:54 +0100 | [diff] [blame] | 481 | i->op_id = VNET_CRYPTO_OP_SHA1_HMAC; |
Damjan Marion | d1bed68 | 2019-04-24 15:20:35 +0200 | [diff] [blame] | 482 | i->alg = VNET_CRYPTO_ALG_HMAC_SHA1; |
Damjan Marion | 7c22ff7 | 2019-04-04 12:25:44 +0200 | [diff] [blame] | 483 | i->icv_size = 12; |
Damjan Marion | 91f17dc | 2019-03-18 18:59:25 +0100 | [diff] [blame] | 484 | |
| 485 | i = &im->integ_algs[IPSEC_INTEG_ALG_SHA_256_96]; |
Damjan Marion | 060bfb9 | 2019-03-29 13:47:54 +0100 | [diff] [blame] | 486 | i->op_id = VNET_CRYPTO_OP_SHA1_HMAC; |
Damjan Marion | d1bed68 | 2019-04-24 15:20:35 +0200 | [diff] [blame] | 487 | i->alg = VNET_CRYPTO_ALG_HMAC_SHA256; |
Damjan Marion | 7c22ff7 | 2019-04-04 12:25:44 +0200 | [diff] [blame] | 488 | i->icv_size = 12; |
Damjan Marion | 91f17dc | 2019-03-18 18:59:25 +0100 | [diff] [blame] | 489 | |
| 490 | i = &im->integ_algs[IPSEC_INTEG_ALG_SHA_256_128]; |
Damjan Marion | 060bfb9 | 2019-03-29 13:47:54 +0100 | [diff] [blame] | 491 | i->op_id = VNET_CRYPTO_OP_SHA256_HMAC; |
Damjan Marion | d1bed68 | 2019-04-24 15:20:35 +0200 | [diff] [blame] | 492 | i->alg = VNET_CRYPTO_ALG_HMAC_SHA256; |
Damjan Marion | 7c22ff7 | 2019-04-04 12:25:44 +0200 | [diff] [blame] | 493 | i->icv_size = 16; |
Damjan Marion | 91f17dc | 2019-03-18 18:59:25 +0100 | [diff] [blame] | 494 | |
| 495 | i = &im->integ_algs[IPSEC_INTEG_ALG_SHA_384_192]; |
Damjan Marion | 060bfb9 | 2019-03-29 13:47:54 +0100 | [diff] [blame] | 496 | i->op_id = VNET_CRYPTO_OP_SHA384_HMAC; |
Damjan Marion | 4cb8381 | 2019-04-24 17:32:01 +0200 | [diff] [blame] | 497 | i->alg = VNET_CRYPTO_ALG_HMAC_SHA384; |
Damjan Marion | 7c22ff7 | 2019-04-04 12:25:44 +0200 | [diff] [blame] | 498 | i->icv_size = 24; |
Damjan Marion | 91f17dc | 2019-03-18 18:59:25 +0100 | [diff] [blame] | 499 | |
| 500 | i = &im->integ_algs[IPSEC_INTEG_ALG_SHA_512_256]; |
Damjan Marion | 060bfb9 | 2019-03-29 13:47:54 +0100 | [diff] [blame] | 501 | i->op_id = VNET_CRYPTO_OP_SHA512_HMAC; |
Damjan Marion | d1bed68 | 2019-04-24 15:20:35 +0200 | [diff] [blame] | 502 | i->alg = VNET_CRYPTO_ALG_HMAC_SHA512; |
Damjan Marion | 7c22ff7 | 2019-04-04 12:25:44 +0200 | [diff] [blame] | 503 | i->icv_size = 32; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 504 | |
Neale Ranns | 5ae793a | 2019-04-03 13:36:56 +0000 | [diff] [blame] | 505 | vec_validate_aligned (im->ptd, vlib_num_workers (), CLIB_CACHE_LINE_BYTES); |
Damjan Marion | c59b9a2 | 2019-03-19 15:38:40 +0100 | [diff] [blame] | 506 | |
Neale Ranns | f62a8c0 | 2019-04-02 08:13:33 +0000 | [diff] [blame] | 507 | im->ah4_enc_fq_index = |
| 508 | vlib_frame_queue_main_init (ah4_encrypt_node.index, 0); |
| 509 | im->ah4_dec_fq_index = |
| 510 | vlib_frame_queue_main_init (ah4_decrypt_node.index, 0); |
| 511 | im->ah6_enc_fq_index = |
| 512 | vlib_frame_queue_main_init (ah6_encrypt_node.index, 0); |
| 513 | im->ah6_dec_fq_index = |
| 514 | vlib_frame_queue_main_init (ah6_decrypt_node.index, 0); |
| 515 | |
| 516 | im->esp4_enc_fq_index = |
| 517 | vlib_frame_queue_main_init (esp4_encrypt_node.index, 0); |
| 518 | im->esp4_dec_fq_index = |
| 519 | vlib_frame_queue_main_init (esp4_decrypt_node.index, 0); |
| 520 | im->esp6_enc_fq_index = |
| 521 | vlib_frame_queue_main_init (esp6_encrypt_node.index, 0); |
| 522 | im->esp6_dec_fq_index = |
| 523 | vlib_frame_queue_main_init (esp6_decrypt_node.index, 0); |
| 524 | im->esp4_enc_tun_fq_index = |
| 525 | vlib_frame_queue_main_init (esp4_encrypt_tun_node.index, 0); |
| 526 | im->esp6_enc_tun_fq_index = |
| 527 | vlib_frame_queue_main_init (esp6_encrypt_tun_node.index, 0); |
| 528 | im->esp4_dec_tun_fq_index = |
| 529 | vlib_frame_queue_main_init (esp4_decrypt_tun_node.index, 0); |
| 530 | im->esp6_dec_tun_fq_index = |
| 531 | vlib_frame_queue_main_init (esp6_decrypt_tun_node.index, 0); |
| 532 | |
Fan Zhang | f539578 | 2020-04-29 14:00:03 +0100 | [diff] [blame] | 533 | im->async_mode = 0; |
| 534 | crypto_engine_backend_register_post_node (vm); |
| 535 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 536 | return 0; |
| 537 | } |
| 538 | |
| 539 | VLIB_INIT_FUNCTION (ipsec_init); |
Keith Burns (alagalah) | 166a9d4 | 2016-08-06 11:00:56 -0700 | [diff] [blame] | 540 | |
| 541 | /* |
| 542 | * fd.io coding-style-patch-verification: ON |
| 543 | * |
| 544 | * Local Variables: |
| 545 | * eval: (c-set-style "gnu") |
| 546 | * End: |
| 547 | */ |