38 if (sa->
integ_alg == IPSEC_INTEG_ALG_NONE)
53 if (IPSEC_INTEG_ALG_NONE != sa->
integ_alg)
116 const char *prev_node_name,
u32 * out_node_index,
117 u32 * out_next_index)
124 *out_node_index =
node->index;
162 n_regs = (p ? p[0] : 0);
175 const char *ah4_encrypt_node_name,
176 const char *ah4_decrypt_node_name,
177 const char *ah6_encrypt_node_name,
178 const char *ah6_decrypt_node_name,
187 &
b->ah4_encrypt_node_index, &
b->ah4_encrypt_next_index);
189 &
b->ah4_decrypt_node_index, &
b->ah4_decrypt_next_index);
191 &
b->ah6_encrypt_node_index, &
b->ah6_encrypt_next_index);
193 &
b->ah6_decrypt_node_index, &
b->ah6_decrypt_next_index);
195 b->check_support_cb = ah_check_support_cb;
196 b->add_del_sa_sess_cb = ah_add_del_sa_sess_cb;
197 return b -
im->ah_backends;
203 const char *esp4_encrypt_node_name,
const char *esp4_encrypt_node_tun_name,
204 const char *esp4_decrypt_node_name,
const char *esp4_decrypt_tun_node_name,
205 const char *esp6_encrypt_node_name,
const char *esp6_encrypt_node_tun_name,
206 const char *esp6_decrypt_node_name,
const char *esp6_decrypt_tun_node_name,
207 const char *esp_mpls_encrypt_node_tun_name,
218 &
b->esp4_encrypt_node_index, &
b->esp4_encrypt_next_index);
220 &
b->esp4_decrypt_node_index, &
b->esp4_decrypt_next_index);
222 &
b->esp6_encrypt_node_index, &
b->esp6_encrypt_next_index);
224 &
b->esp6_decrypt_node_index, &
b->esp6_decrypt_next_index);
226 &
b->esp4_decrypt_tun_node_index,
227 &
b->esp4_decrypt_tun_next_index);
229 &
b->esp6_decrypt_tun_node_index,
230 &
b->esp6_decrypt_tun_next_index);
232 b->esp6_encrypt_tun_node_index =
234 b->esp_mpls_encrypt_tun_node_index =
236 b->esp4_encrypt_tun_node_index =
239 b->check_support_cb = esp_check_support_cb;
240 b->add_del_sa_sess_cb = esp_add_del_sa_sess_cb;
241 b->enable_disable_cb = enable_disable_cb;
243 return b -
im->esp_backends;
261 return VNET_API_ERROR_RSRC_IN_USE;
264 return VNET_API_ERROR_INVALID_VALUE;
267 im->ah_current_backend = backend_idx;
268 im->ah4_encrypt_node_index =
b->ah4_encrypt_node_index;
269 im->ah4_decrypt_node_index =
b->ah4_decrypt_node_index;
270 im->ah4_encrypt_next_index =
b->ah4_encrypt_next_index;
271 im->ah4_decrypt_next_index =
b->ah4_decrypt_next_index;
272 im->ah6_encrypt_node_index =
b->ah6_encrypt_node_index;
273 im->ah6_decrypt_node_index =
b->ah6_decrypt_node_index;
274 im->ah6_encrypt_next_index =
b->ah6_encrypt_next_index;
275 im->ah6_decrypt_next_index =
b->ah6_decrypt_next_index;
284 return VNET_API_ERROR_RSRC_IN_USE;
287 return VNET_API_ERROR_INVALID_VALUE;
290 if (
im->esp_current_backend != ~0)
293 im->esp_current_backend);
302 im->esp_current_backend = backend_idx;
303 im->esp4_encrypt_node_index =
b->esp4_encrypt_node_index;
304 im->esp4_decrypt_node_index =
b->esp4_decrypt_node_index;
305 im->esp4_encrypt_next_index =
b->esp4_encrypt_next_index;
306 im->esp4_decrypt_next_index =
b->esp4_decrypt_next_index;
307 im->esp6_encrypt_node_index =
b->esp6_encrypt_node_index;
308 im->esp6_decrypt_node_index =
b->esp6_decrypt_node_index;
309 im->esp6_encrypt_next_index =
b->esp6_encrypt_next_index;
310 im->esp6_decrypt_next_index =
b->esp6_decrypt_next_index;
311 im->esp4_decrypt_tun_node_index =
b->esp4_decrypt_tun_node_index;
312 im->esp4_decrypt_tun_next_index =
b->esp4_decrypt_tun_next_index;
313 im->esp6_decrypt_tun_node_index =
b->esp6_decrypt_tun_node_index;
314 im->esp6_decrypt_tun_next_index =
b->esp6_decrypt_tun_next_index;
315 im->esp4_encrypt_tun_node_index =
b->esp4_encrypt_tun_node_index;
316 im->esp6_encrypt_tun_node_index =
b->esp6_encrypt_tun_node_index;
317 im->esp_mpls_encrypt_tun_node_index =
b->esp_mpls_encrypt_tun_node_index;
319 if (
b->enable_disable_cb)
321 if ((
b->enable_disable_cb) (1) != 0)
335 im->async_mode = is_enabled;
394 im->error_drop_node_index =
node->index;
396 im->ah_current_backend = ~0;
397 im->esp_current_backend = ~0;
407 im->ah_default_backend = idx;
413 vm,
im,
"crypto engine backend",
"esp4-encrypt",
"esp4-encrypt-tun",
414 "esp4-decrypt",
"esp4-decrypt-tun",
"esp6-encrypt",
"esp6-encrypt-tun",
415 "esp6-decrypt",
"esp6-decrypt-tun",
"esp-mpls-encrypt-tun",
417 im->esp_default_backend = idx;
428 a =
im->crypto_algs + IPSEC_CRYPTO_ALG_NONE;
435 a =
im->crypto_algs + IPSEC_CRYPTO_ALG_DES_CBC;
436 a->enc_op_id = VNET_CRYPTO_OP_DES_CBC_ENC;
437 a->dec_op_id = VNET_CRYPTO_OP_DES_CBC_DEC;
438 a->alg = VNET_CRYPTO_ALG_DES_CBC;
439 a->iv_size =
a->block_align = 8;
441 a =
im->crypto_algs + IPSEC_CRYPTO_ALG_3DES_CBC;
442 a->enc_op_id = VNET_CRYPTO_OP_3DES_CBC_ENC;
443 a->dec_op_id = VNET_CRYPTO_OP_3DES_CBC_DEC;
444 a->alg = VNET_CRYPTO_ALG_3DES_CBC;
445 a->iv_size =
a->block_align = 8;
447 a =
im->crypto_algs + IPSEC_CRYPTO_ALG_AES_CBC_128;
448 a->enc_op_id = VNET_CRYPTO_OP_AES_128_CBC_ENC;
449 a->dec_op_id = VNET_CRYPTO_OP_AES_128_CBC_DEC;
450 a->alg = VNET_CRYPTO_ALG_AES_128_CBC;
451 a->iv_size =
a->block_align = 16;
453 a =
im->crypto_algs + IPSEC_CRYPTO_ALG_AES_CBC_192;
454 a->enc_op_id = VNET_CRYPTO_OP_AES_192_CBC_ENC;
455 a->dec_op_id = VNET_CRYPTO_OP_AES_192_CBC_DEC;
456 a->alg = VNET_CRYPTO_ALG_AES_192_CBC;
457 a->iv_size =
a->block_align = 16;
459 a =
im->crypto_algs + IPSEC_CRYPTO_ALG_AES_CBC_256;
460 a->enc_op_id = VNET_CRYPTO_OP_AES_256_CBC_ENC;
461 a->dec_op_id = VNET_CRYPTO_OP_AES_256_CBC_DEC;
462 a->alg = VNET_CRYPTO_ALG_AES_256_CBC;
463 a->iv_size =
a->block_align = 16;
465 a =
im->crypto_algs + IPSEC_CRYPTO_ALG_AES_CTR_128;
466 a->enc_op_id = VNET_CRYPTO_OP_AES_128_CTR_ENC;
467 a->dec_op_id = VNET_CRYPTO_OP_AES_128_CTR_DEC;
468 a->alg = VNET_CRYPTO_ALG_AES_128_CTR;
472 a =
im->crypto_algs + IPSEC_CRYPTO_ALG_AES_CTR_192;
473 a->enc_op_id = VNET_CRYPTO_OP_AES_192_CTR_ENC;
474 a->dec_op_id = VNET_CRYPTO_OP_AES_192_CTR_DEC;
475 a->alg = VNET_CRYPTO_ALG_AES_192_CTR;
479 a =
im->crypto_algs + IPSEC_CRYPTO_ALG_AES_CTR_256;
480 a->enc_op_id = VNET_CRYPTO_OP_AES_256_CTR_ENC;
481 a->dec_op_id = VNET_CRYPTO_OP_AES_256_CTR_DEC;
482 a->alg = VNET_CRYPTO_ALG_AES_256_CTR;
486 a =
im->crypto_algs + IPSEC_CRYPTO_ALG_AES_GCM_128;
487 a->enc_op_id = VNET_CRYPTO_OP_AES_128_GCM_ENC;
488 a->dec_op_id = VNET_CRYPTO_OP_AES_128_GCM_DEC;
489 a->alg = VNET_CRYPTO_ALG_AES_128_GCM;
494 a =
im->crypto_algs + IPSEC_CRYPTO_ALG_AES_GCM_192;
495 a->enc_op_id = VNET_CRYPTO_OP_AES_192_GCM_ENC;
496 a->dec_op_id = VNET_CRYPTO_OP_AES_192_GCM_DEC;
497 a->alg = VNET_CRYPTO_ALG_AES_192_GCM;
502 a =
im->crypto_algs + IPSEC_CRYPTO_ALG_AES_GCM_256;
503 a->enc_op_id = VNET_CRYPTO_OP_AES_256_GCM_ENC;
504 a->dec_op_id = VNET_CRYPTO_OP_AES_256_GCM_DEC;
505 a->alg = VNET_CRYPTO_ALG_AES_256_GCM;
513 i = &
im->integ_algs[IPSEC_INTEG_ALG_MD5_96];
514 i->op_id = VNET_CRYPTO_OP_MD5_HMAC;
515 i->alg = VNET_CRYPTO_ALG_HMAC_MD5;
518 i = &
im->integ_algs[IPSEC_INTEG_ALG_SHA1_96];
519 i->op_id = VNET_CRYPTO_OP_SHA1_HMAC;
520 i->alg = VNET_CRYPTO_ALG_HMAC_SHA1;
523 i = &
im->integ_algs[IPSEC_INTEG_ALG_SHA_256_96];
524 i->op_id = VNET_CRYPTO_OP_SHA1_HMAC;
525 i->alg = VNET_CRYPTO_ALG_HMAC_SHA256;
528 i = &
im->integ_algs[IPSEC_INTEG_ALG_SHA_256_128];
529 i->op_id = VNET_CRYPTO_OP_SHA256_HMAC;
530 i->alg = VNET_CRYPTO_ALG_HMAC_SHA256;
533 i = &
im->integ_algs[IPSEC_INTEG_ALG_SHA_384_192];
534 i->op_id = VNET_CRYPTO_OP_SHA384_HMAC;
535 i->alg = VNET_CRYPTO_ALG_HMAC_SHA384;
538 i = &
im->integ_algs[IPSEC_INTEG_ALG_SHA_512_256];
539 i->op_id = VNET_CRYPTO_OP_SHA512_HMAC;
540 i->alg = VNET_CRYPTO_ALG_HMAC_SHA512;
562 uword table_size = ~0;
567 if (
unformat (&sub_input,
"num-buckets %u", &n_buckets))
579 uword table_size = ~0;
584 if (
unformat (&sub_input,
"num-buckets %u", &n_buckets))