Lines Matching full:aead

16 #include <crypto/aead.h>
56 * Allocate an AEAD request structure with extra space for SG and IV.
64 static void *esp_alloc_tmp(struct crypto_aead *aead, int nfrags, int seqihlen) in esp_alloc_tmp() argument
70 len += crypto_aead_ivsize(aead); in esp_alloc_tmp()
73 len += crypto_aead_alignmask(aead) & in esp_alloc_tmp()
78 len += sizeof(struct aead_request) + crypto_aead_reqsize(aead); in esp_alloc_tmp()
91 static inline u8 *esp_tmp_iv(struct crypto_aead *aead, void *tmp, int seqhilen) in esp_tmp_iv() argument
93 return crypto_aead_ivsize(aead) ? in esp_tmp_iv()
95 crypto_aead_alignmask(aead) + 1) : tmp + seqhilen; in esp_tmp_iv()
98 static inline struct aead_request *esp_tmp_req(struct crypto_aead *aead, u8 *iv) in esp_tmp_req() argument
102 req = (void *)PTR_ALIGN(iv + crypto_aead_ivsize(aead), in esp_tmp_req()
104 aead_request_set_tfm(req, aead); in esp_tmp_req()
108 static inline struct scatterlist *esp_req_sg(struct crypto_aead *aead, in esp_req_sg() argument
112 crypto_aead_reqsize(aead), in esp_req_sg()
118 struct crypto_aead *aead = x->data; in esp_ssg_unref() local
127 iv = esp_tmp_iv(aead, tmp, extralen); in esp_ssg_unref()
128 req = esp_tmp_req(aead, iv); in esp_ssg_unref()
134 struct scatterlist *src = already_unref ? esp_req_sg(aead, req) : req->src; in esp_ssg_unref()
541 struct crypto_aead *aead; in esp6_output_tail() local
554 aead = x->data; in esp6_output_tail()
555 alen = crypto_aead_authsize(aead); in esp6_output_tail()
556 ivlen = crypto_aead_ivsize(aead); in esp6_output_tail()
558 tmp = esp_alloc_tmp(aead, esp->nfrags + 2, extralen); in esp6_output_tail()
563 iv = esp_tmp_iv(aead, tmp, extralen); in esp6_output_tail()
564 req = esp_tmp_req(aead, iv); in esp6_output_tail()
565 sg = esp_req_sg(aead, req); in esp6_output_tail()
660 struct crypto_aead *aead; in esp6_output() local
670 aead = x->data; in esp6_output()
671 alen = crypto_aead_authsize(aead); in esp6_output()
682 blksize = ALIGN(crypto_aead_blocksize(aead), 4); in esp6_output()
708 struct crypto_aead *aead = x->data; in esp_remove_trailer() local
715 alen = crypto_aead_authsize(aead); in esp_remove_trailer()
716 hlen = sizeof(struct ip_esp_hdr) + crypto_aead_ivsize(aead); in esp_remove_trailer()
750 struct crypto_aead *aead = x->data; in esp6_input_done2() local
751 int hlen = sizeof(struct ip_esp_hdr) + crypto_aead_ivsize(aead); in esp6_input_done2()
887 struct crypto_aead *aead = x->data; in esp6_input() local
890 int ivlen = crypto_aead_ivsize(aead); in esp6_input()
941 tmp = esp_alloc_tmp(aead, nfrags, seqhilen); in esp6_input()
947 iv = esp_tmp_iv(aead, tmp, seqhilen); in esp6_input()
948 req = esp_tmp_req(aead, iv); in esp6_input()
949 sg = esp_req_sg(aead, req); in esp6_input()
1012 struct crypto_aead *aead = x->data; in esp6_destroy() local
1014 if (!aead) in esp6_destroy()
1017 crypto_free_aead(aead); in esp6_destroy()
1023 struct crypto_aead *aead; in esp_init_aead() local
1027 x->geniv, x->aead->alg_name) >= CRYPTO_MAX_ALG_NAME) { in esp_init_aead()
1032 aead = crypto_alloc_aead(aead_name, 0, 0); in esp_init_aead()
1033 err = PTR_ERR(aead); in esp_init_aead()
1034 if (IS_ERR(aead)) in esp_init_aead()
1037 x->data = aead; in esp_init_aead()
1039 err = crypto_aead_setkey(aead, x->aead->alg_key, in esp_init_aead()
1040 (x->aead->alg_key_len + 7) / 8); in esp_init_aead()
1044 err = crypto_aead_setauthsize(aead, x->aead->alg_icv_len / 8); in esp_init_aead()
1058 struct crypto_aead *aead; in esp_init_authenc() local
1091 aead = crypto_alloc_aead(authenc_name, 0, 0); in esp_init_authenc()
1092 err = PTR_ERR(aead); in esp_init_authenc()
1093 if (IS_ERR(aead)) { in esp_init_authenc()
1098 x->data = aead; in esp_init_authenc()
1125 crypto_aead_authsize(aead)) { in esp_init_authenc()
1131 aead, x->aalg->alg_trunc_len / 8); in esp_init_authenc()
1141 err = crypto_aead_setkey(aead, key, keylen); in esp_init_authenc()
1152 struct crypto_aead *aead; in esp6_init_state() local
1158 if (x->aead) { in esp6_init_state()
1163 NL_SET_ERR_MSG(extack, "ESP: AEAD or CRYPT must be provided"); in esp6_init_state()
1170 aead = x->data; in esp6_init_state()
1173 crypto_aead_ivsize(aead); in esp6_init_state()
1210 align = ALIGN(crypto_aead_blocksize(aead), 4); in esp6_init_state()
1211 x->props.trailer_len = align + 1 + crypto_aead_authsize(aead); in esp6_init_state()