Lines Matching refs:cfg

175 static int set_aes_keylen(struct nfp_ipsec_cfg_add_sa *cfg, int alg, int keylen)  in set_aes_keylen()  argument
181 cfg->ctrl_word.cipher = aes_gmac ? NFP_IPSEC_CIPHER_AES128_NULL : in set_aes_keylen()
185 cfg->ctrl_word.cipher = aes_gmac ? NFP_IPSEC_CIPHER_AES192_NULL : in set_aes_keylen()
189 cfg->ctrl_word.cipher = aes_gmac ? NFP_IPSEC_CIPHER_AES256_NULL : in set_aes_keylen()
199 static void set_md5hmac(struct nfp_ipsec_cfg_add_sa *cfg, int *trunc_len) in set_md5hmac() argument
203 cfg->ctrl_word.hash = NFP_IPSEC_HASH_MD5_96; in set_md5hmac()
206 cfg->ctrl_word.hash = NFP_IPSEC_HASH_MD5_128; in set_md5hmac()
213 static void set_sha1hmac(struct nfp_ipsec_cfg_add_sa *cfg, int *trunc_len) in set_sha1hmac() argument
217 cfg->ctrl_word.hash = NFP_IPSEC_HASH_SHA1_96; in set_sha1hmac()
220 cfg->ctrl_word.hash = NFP_IPSEC_HASH_SHA1_80; in set_sha1hmac()
227 static void set_sha2_256hmac(struct nfp_ipsec_cfg_add_sa *cfg, int *trunc_len) in set_sha2_256hmac() argument
231 cfg->ctrl_word.hash = NFP_IPSEC_HASH_SHA256_96; in set_sha2_256hmac()
234 cfg->ctrl_word.hash = NFP_IPSEC_HASH_SHA256_128; in set_sha2_256hmac()
241 static void set_sha2_384hmac(struct nfp_ipsec_cfg_add_sa *cfg, int *trunc_len) in set_sha2_384hmac() argument
245 cfg->ctrl_word.hash = NFP_IPSEC_HASH_SHA384_96; in set_sha2_384hmac()
248 cfg->ctrl_word.hash = NFP_IPSEC_HASH_SHA384_192; in set_sha2_384hmac()
255 static void set_sha2_512hmac(struct nfp_ipsec_cfg_add_sa *cfg, int *trunc_len) in set_sha2_512hmac() argument
259 cfg->ctrl_word.hash = NFP_IPSEC_HASH_SHA512_96; in set_sha2_512hmac()
262 cfg->ctrl_word.hash = NFP_IPSEC_HASH_SHA512_256; in set_sha2_512hmac()
275 struct nfp_ipsec_cfg_add_sa *cfg; in nfp_net_xfrm_add_state() local
280 cfg = &msg.cfg_add_sa; in nfp_net_xfrm_add_state()
285 cfg->ctrl_word.mode = NFP_IPSEC_PROTMODE_TUNNEL; in nfp_net_xfrm_add_state()
288 cfg->ctrl_word.mode = NFP_IPSEC_PROTMODE_TRANSPORT; in nfp_net_xfrm_add_state()
297 cfg->ctrl_word.proto = NFP_IPSEC_PROTOCOL_ESP; in nfp_net_xfrm_add_state()
300 cfg->ctrl_word.proto = NFP_IPSEC_PROTOCOL_AH; in nfp_net_xfrm_add_state()
317 cfg->spi = ntohl(x->id.spi); in nfp_net_xfrm_add_state()
335 cfg->ctrl_word.hash = NFP_IPSEC_HASH_NONE; in nfp_net_xfrm_add_state()
343 set_md5hmac(cfg, &trunc_len); in nfp_net_xfrm_add_state()
346 set_sha1hmac(cfg, &trunc_len); in nfp_net_xfrm_add_state()
349 set_sha2_256hmac(cfg, &trunc_len); in nfp_net_xfrm_add_state()
352 set_sha2_384hmac(cfg, &trunc_len); in nfp_net_xfrm_add_state()
355 set_sha2_512hmac(cfg, &trunc_len); in nfp_net_xfrm_add_state()
369 if (key_len > sizeof(cfg->auth_key)) { in nfp_net_xfrm_add_state()
373 for (i = 0; i < key_len / sizeof(cfg->auth_key[0]) ; i++) in nfp_net_xfrm_add_state()
374 cfg->auth_key[i] = get_unaligned_be32(x->aalg->alg_key + in nfp_net_xfrm_add_state()
375 sizeof(cfg->auth_key[0]) * i); in nfp_net_xfrm_add_state()
382 cfg->ctrl_word.cimode = NFP_IPSEC_CIMODE_CBC; in nfp_net_xfrm_add_state()
383 cfg->ctrl_word.cipher = NFP_IPSEC_CIPHER_NULL; in nfp_net_xfrm_add_state()
390 cfg->ctrl_word.cimode = NFP_IPSEC_CIMODE_CBC; in nfp_net_xfrm_add_state()
391 cfg->ctrl_word.cipher = NFP_IPSEC_CIPHER_3DES; in nfp_net_xfrm_add_state()
404 cfg->ctrl_word.cimode = NFP_IPSEC_CIMODE_CTR; in nfp_net_xfrm_add_state()
405 cfg->ctrl_word.hash = NFP_IPSEC_HASH_GF128_128; in nfp_net_xfrm_add_state()
408 if (set_aes_keylen(cfg, x->props.ealgo, x->aead->alg_key_len - 32)) { in nfp_net_xfrm_add_state()
414 cfg->ctrl_word.cimode = NFP_IPSEC_CIMODE_CBC; in nfp_net_xfrm_add_state()
419 if (set_aes_keylen(cfg, x->props.ealgo, x->ealg->alg_key_len) < 0) { in nfp_net_xfrm_add_state()
435 if (key_len > sizeof(cfg->ciph_key)) { in nfp_net_xfrm_add_state()
440 for (i = 0; i < key_len / sizeof(cfg->ciph_key[0]) ; i++) in nfp_net_xfrm_add_state()
441 cfg->ciph_key[i] = get_unaligned_be32(x->aead->alg_key + in nfp_net_xfrm_add_state()
442 sizeof(cfg->ciph_key[0]) * i); in nfp_net_xfrm_add_state()
445 cfg->aesgcm_fields.salt = get_unaligned_be32(x->aead->alg_key + key_len); in nfp_net_xfrm_add_state()
451 if (key_len > sizeof(cfg->ciph_key)) { in nfp_net_xfrm_add_state()
455 for (i = 0; i < key_len / sizeof(cfg->ciph_key[0]) ; i++) in nfp_net_xfrm_add_state()
456 cfg->ciph_key[i] = get_unaligned_be32(x->ealg->alg_key + in nfp_net_xfrm_add_state()
457 sizeof(cfg->ciph_key[0]) * i); in nfp_net_xfrm_add_state()
463 cfg->ipv6 = 0; in nfp_net_xfrm_add_state()
464 cfg->src_ip[0] = ntohl(x->props.saddr.a4); in nfp_net_xfrm_add_state()
465 cfg->dst_ip[0] = ntohl(x->id.daddr.a4); in nfp_net_xfrm_add_state()
468 cfg->ipv6 = 1; in nfp_net_xfrm_add_state()
470 cfg->src_ip[i] = ntohl(x->props.saddr.a6[i]); in nfp_net_xfrm_add_state()
471 cfg->dst_ip[i] = ntohl(x->id.daddr.a6[i]); in nfp_net_xfrm_add_state()
480 cfg->pmtu_limit = 0xffff; in nfp_net_xfrm_add_state()
481 cfg->ctrl_word.encap_dsbl = 1; in nfp_net_xfrm_add_state()
484 cfg->ctrl_word.dir = x->xso.dir; in nfp_net_xfrm_add_state()