37 if (sa->
integ_alg == IPSEC_INTEG_ALG_NONE)
52 if (IPSEC_INTEG_ALG_NONE != sa->
integ_alg)
115 const char *prev_node_name,
u32 * out_node_index,
116 u32 * out_next_index)
123 *out_node_index =
node->index;
161 n_regs = (p ? p[0] : 0);
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,
186 &
b->ah4_encrypt_node_index, &
b->ah4_encrypt_next_index);
188 &
b->ah4_decrypt_node_index, &
b->ah4_decrypt_next_index);
190 &
b->ah6_encrypt_node_index, &
b->ah6_encrypt_next_index);
192 &
b->ah6_decrypt_node_index, &
b->ah6_decrypt_next_index);
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;
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,
217 &
b->esp4_encrypt_node_index, &
b->esp4_encrypt_next_index);
219 &
b->esp4_decrypt_node_index, &
b->esp4_decrypt_next_index);
221 &
b->esp6_encrypt_node_index, &
b->esp6_encrypt_next_index);
223 &
b->esp6_decrypt_node_index, &
b->esp6_decrypt_next_index);
225 &
b->esp4_decrypt_tun_node_index,
226 &
b->esp4_decrypt_tun_next_index);
228 &
b->esp6_decrypt_tun_node_index,
229 &
b->esp6_decrypt_tun_next_index);
231 b->esp6_encrypt_tun_node_index =
233 b->esp_mpls_encrypt_tun_node_index =
235 b->esp4_encrypt_tun_node_index =
238 b->check_support_cb = esp_check_support_cb;
239 b->add_del_sa_sess_cb = esp_add_del_sa_sess_cb;
240 b->enable_disable_cb = enable_disable_cb;
242 return b -
im->esp_backends;
260 return VNET_API_ERROR_RSRC_IN_USE;
263 return VNET_API_ERROR_INVALID_VALUE;
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;
283 return VNET_API_ERROR_RSRC_IN_USE;
286 return VNET_API_ERROR_INVALID_VALUE;
289 if (
im->esp_current_backend != ~0)
292 im->esp_current_backend);
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;
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;
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;
316 im->esp_mpls_encrypt_tun_node_index =
b->esp_mpls_encrypt_tun_node_index;
318 if (
b->enable_disable_cb)
320 if ((
b->enable_disable_cb) (1) != 0)
334 im->async_mode = is_enabled;
393 im->error_drop_node_index =
node->index;
395 im->ah_current_backend = ~0;
396 im->esp_current_backend = ~0;
406 im->ah_default_backend = idx;
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",
416 im->esp_default_backend = idx;
427 a =
im->crypto_algs + IPSEC_CRYPTO_ALG_NONE;
434 a =
im->crypto_algs + IPSEC_CRYPTO_ALG_DES_CBC;
435 a->enc_op_id = VNET_CRYPTO_OP_DES_CBC_ENC;
436 a->dec_op_id = VNET_CRYPTO_OP_DES_CBC_DEC;
437 a->alg = VNET_CRYPTO_ALG_DES_CBC;
438 a->iv_size =
a->block_align = 8;
440 a =
im->crypto_algs + IPSEC_CRYPTO_ALG_3DES_CBC;
441 a->enc_op_id = VNET_CRYPTO_OP_3DES_CBC_ENC;
442 a->dec_op_id = VNET_CRYPTO_OP_3DES_CBC_DEC;
443 a->alg = VNET_CRYPTO_ALG_3DES_CBC;
444 a->iv_size =
a->block_align = 8;
446 a =
im->crypto_algs + IPSEC_CRYPTO_ALG_AES_CBC_128;
447 a->enc_op_id = VNET_CRYPTO_OP_AES_128_CBC_ENC;
448 a->dec_op_id = VNET_CRYPTO_OP_AES_128_CBC_DEC;
449 a->alg = VNET_CRYPTO_ALG_AES_128_CBC;
450 a->iv_size =
a->block_align = 16;
452 a =
im->crypto_algs + IPSEC_CRYPTO_ALG_AES_CBC_192;
453 a->enc_op_id = VNET_CRYPTO_OP_AES_192_CBC_ENC;
454 a->dec_op_id = VNET_CRYPTO_OP_AES_192_CBC_DEC;
455 a->alg = VNET_CRYPTO_ALG_AES_192_CBC;
456 a->iv_size =
a->block_align = 16;
458 a =
im->crypto_algs + IPSEC_CRYPTO_ALG_AES_CBC_256;
459 a->enc_op_id = VNET_CRYPTO_OP_AES_256_CBC_ENC;
460 a->dec_op_id = VNET_CRYPTO_OP_AES_256_CBC_DEC;
461 a->alg = VNET_CRYPTO_ALG_AES_256_CBC;
462 a->iv_size =
a->block_align = 16;
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;
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;
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;
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;
488 a->alg = VNET_CRYPTO_ALG_AES_128_GCM;
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;
496 a->alg = VNET_CRYPTO_ALG_AES_192_GCM;
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;
504 a->alg = VNET_CRYPTO_ALG_AES_256_GCM;
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;
517 i = &
im->integ_algs[IPSEC_INTEG_ALG_SHA1_96];
518 i->op_id = VNET_CRYPTO_OP_SHA1_HMAC;
519 i->alg = VNET_CRYPTO_ALG_HMAC_SHA1;
522 i = &
im->integ_algs[IPSEC_INTEG_ALG_SHA_256_96];
523 i->op_id = VNET_CRYPTO_OP_SHA1_HMAC;
524 i->alg = VNET_CRYPTO_ALG_HMAC_SHA256;
527 i = &
im->integ_algs[IPSEC_INTEG_ALG_SHA_256_128];
528 i->op_id = VNET_CRYPTO_OP_SHA256_HMAC;
529 i->alg = VNET_CRYPTO_ALG_HMAC_SHA256;
532 i = &
im->integ_algs[IPSEC_INTEG_ALG_SHA_384_192];
533 i->op_id = VNET_CRYPTO_OP_SHA384_HMAC;
534 i->alg = VNET_CRYPTO_ALG_HMAC_SHA384;
537 i = &
im->integ_algs[IPSEC_INTEG_ALG_SHA_512_256];
538 i->op_id = VNET_CRYPTO_OP_SHA512_HMAC;
539 i->alg = VNET_CRYPTO_ALG_HMAC_SHA512;