Lines Matching full:aead
4 #include <crypto/aead.h>
40 * Allocate an AEAD request structure with extra space for SG and IV.
47 static void *esp_alloc_tmp(struct crypto_aead *aead, int nfrags, int extralen) in esp_alloc_tmp() argument
53 len += crypto_aead_ivsize(aead); in esp_alloc_tmp()
56 len += crypto_aead_alignmask(aead) & in esp_alloc_tmp()
61 len += sizeof(struct aead_request) + crypto_aead_reqsize(aead); in esp_alloc_tmp()
74 static inline u8 *esp_tmp_iv(struct crypto_aead *aead, void *tmp, int extralen) in esp_tmp_iv() argument
76 return crypto_aead_ivsize(aead) ? in esp_tmp_iv()
78 crypto_aead_alignmask(aead) + 1) : tmp + extralen; in esp_tmp_iv()
81 static inline struct aead_request *esp_tmp_req(struct crypto_aead *aead, u8 *iv) in esp_tmp_req() argument
85 req = (void *)PTR_ALIGN(iv + crypto_aead_ivsize(aead), in esp_tmp_req()
87 aead_request_set_tfm(req, aead); in esp_tmp_req()
91 static inline struct scatterlist *esp_req_sg(struct crypto_aead *aead, in esp_req_sg() argument
95 crypto_aead_reqsize(aead), in esp_req_sg()
101 struct crypto_aead *aead = x->data; in esp_ssg_unref() local
110 iv = esp_tmp_iv(aead, tmp, extralen); in esp_ssg_unref()
111 req = esp_tmp_req(aead, iv); in esp_ssg_unref()
117 struct scatterlist *src = already_unref ? esp_req_sg(aead, req) : req->src; in esp_ssg_unref()
508 struct crypto_aead *aead; in esp_output_tail() local
522 aead = x->data; in esp_output_tail()
523 alen = crypto_aead_authsize(aead); in esp_output_tail()
524 ivlen = crypto_aead_ivsize(aead); in esp_output_tail()
526 tmp = esp_alloc_tmp(aead, esp->nfrags + 2, extralen); in esp_output_tail()
531 iv = esp_tmp_iv(aead, tmp, extralen); in esp_output_tail()
532 req = esp_tmp_req(aead, iv); in esp_output_tail()
533 sg = esp_req_sg(aead, req); in esp_output_tail()
627 struct crypto_aead *aead; in esp_output() local
637 aead = x->data; in esp_output()
638 alen = crypto_aead_authsize(aead); in esp_output()
649 blksize = ALIGN(crypto_aead_blocksize(aead), 4); in esp_output()
675 struct crypto_aead *aead = x->data; in esp_remove_trailer() local
682 alen = crypto_aead_authsize(aead); in esp_remove_trailer()
683 hlen = sizeof(struct ip_esp_hdr) + crypto_aead_ivsize(aead); in esp_remove_trailer()
718 struct crypto_aead *aead = x->data; in esp_input_done2() local
719 int hlen = sizeof(struct ip_esp_hdr) + crypto_aead_ivsize(aead); in esp_input_done2()
848 struct crypto_aead *aead = x->data; in esp_input() local
851 int ivlen = crypto_aead_ivsize(aead); in esp_input()
898 tmp = esp_alloc_tmp(aead, nfrags, seqhilen); in esp_input()
904 iv = esp_tmp_iv(aead, tmp, seqhilen); in esp_input()
905 req = esp_tmp_req(aead, iv); in esp_input()
906 sg = esp_req_sg(aead, req); in esp_input()
974 struct crypto_aead *aead = x->data; in esp_destroy() local
976 if (!aead) in esp_destroy()
979 crypto_free_aead(aead); in esp_destroy()
985 struct crypto_aead *aead; in esp_init_aead() local
989 x->geniv, x->aead->alg_name) >= CRYPTO_MAX_ALG_NAME) { in esp_init_aead()
994 aead = crypto_alloc_aead(aead_name, 0, 0); in esp_init_aead()
995 err = PTR_ERR(aead); in esp_init_aead()
996 if (IS_ERR(aead)) in esp_init_aead()
999 x->data = aead; in esp_init_aead()
1001 err = crypto_aead_setkey(aead, x->aead->alg_key, in esp_init_aead()
1002 (x->aead->alg_key_len + 7) / 8); in esp_init_aead()
1006 err = crypto_aead_setauthsize(aead, x->aead->alg_icv_len / 8); in esp_init_aead()
1020 struct crypto_aead *aead; in esp_init_authenc() local
1053 aead = crypto_alloc_aead(authenc_name, 0, 0); in esp_init_authenc()
1054 err = PTR_ERR(aead); in esp_init_authenc()
1055 if (IS_ERR(aead)) { in esp_init_authenc()
1060 x->data = aead; in esp_init_authenc()
1087 crypto_aead_authsize(aead)) { in esp_init_authenc()
1093 aead, x->aalg->alg_trunc_len / 8); in esp_init_authenc()
1103 err = crypto_aead_setkey(aead, key, keylen); in esp_init_authenc()
1114 struct crypto_aead *aead; in esp_init_state() local
1120 if (x->aead) { in esp_init_state()
1125 NL_SET_ERR_MSG(extack, "ESP: AEAD or CRYPT must be provided"); in esp_init_state()
1132 aead = x->data; in esp_init_state()
1135 crypto_aead_ivsize(aead); in esp_init_state()
1162 align = ALIGN(crypto_aead_blocksize(aead), 4); in esp_init_state()
1163 x->props.trailer_len = align + 1 + crypto_aead_authsize(aead); in esp_init_state()