blob: f2893393ba5e770b505fa11f945d2b23f2d13c75 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Horia Geantă8cea7b62016-11-22 15:44:09 +02002/*
Horia Geantă9dbe3072018-08-06 15:44:00 +03003 * Shared descriptors for aead, skcipher algorithms
Horia Geantă8cea7b62016-11-22 15:44:09 +02004 *
5 * Copyright 2016 NXP
6 */
7
8#ifndef _CAAMALG_DESC_H_
9#define _CAAMALG_DESC_H_
10
11/* length of descriptors text */
12#define DESC_AEAD_BASE (4 * CAAM_CMD_SZ)
13#define DESC_AEAD_ENC_LEN (DESC_AEAD_BASE + 11 * CAAM_CMD_SZ)
14#define DESC_AEAD_DEC_LEN (DESC_AEAD_BASE + 15 * CAAM_CMD_SZ)
Horia Geantă48f89d22019-07-30 08:48:33 +030015#define DESC_AEAD_GIVENC_LEN (DESC_AEAD_ENC_LEN + 8 * CAAM_CMD_SZ)
Horia Geantăb1898172017-03-17 12:06:02 +020016#define DESC_QI_AEAD_ENC_LEN (DESC_AEAD_ENC_LEN + 3 * CAAM_CMD_SZ)
17#define DESC_QI_AEAD_DEC_LEN (DESC_AEAD_DEC_LEN + 3 * CAAM_CMD_SZ)
18#define DESC_QI_AEAD_GIVENC_LEN (DESC_AEAD_GIVENC_LEN + 3 * CAAM_CMD_SZ)
Horia Geantă8cea7b62016-11-22 15:44:09 +020019
20/* Note: Nonce is counted in cdata.keylen */
21#define DESC_AEAD_CTR_RFC3686_LEN (4 * CAAM_CMD_SZ)
22
23#define DESC_AEAD_NULL_BASE (3 * CAAM_CMD_SZ)
24#define DESC_AEAD_NULL_ENC_LEN (DESC_AEAD_NULL_BASE + 11 * CAAM_CMD_SZ)
25#define DESC_AEAD_NULL_DEC_LEN (DESC_AEAD_NULL_BASE + 13 * CAAM_CMD_SZ)
26
27#define DESC_GCM_BASE (3 * CAAM_CMD_SZ)
28#define DESC_GCM_ENC_LEN (DESC_GCM_BASE + 16 * CAAM_CMD_SZ)
29#define DESC_GCM_DEC_LEN (DESC_GCM_BASE + 12 * CAAM_CMD_SZ)
Horia Geantă87ec3a02018-01-29 10:38:36 +020030#define DESC_QI_GCM_ENC_LEN (DESC_GCM_ENC_LEN + 6 * CAAM_CMD_SZ)
31#define DESC_QI_GCM_DEC_LEN (DESC_GCM_DEC_LEN + 3 * CAAM_CMD_SZ)
Horia Geantă8cea7b62016-11-22 15:44:09 +020032
33#define DESC_RFC4106_BASE (3 * CAAM_CMD_SZ)
Iuliana Prodand28a43e2019-07-31 16:08:09 +030034#define DESC_RFC4106_ENC_LEN (DESC_RFC4106_BASE + 16 * CAAM_CMD_SZ)
Horia Geantă8cea7b62016-11-22 15:44:09 +020035#define DESC_RFC4106_DEC_LEN (DESC_RFC4106_BASE + 13 * CAAM_CMD_SZ)
Horia Geantă87ec3a02018-01-29 10:38:36 +020036#define DESC_QI_RFC4106_ENC_LEN (DESC_RFC4106_ENC_LEN + 5 * CAAM_CMD_SZ)
37#define DESC_QI_RFC4106_DEC_LEN (DESC_RFC4106_DEC_LEN + 5 * CAAM_CMD_SZ)
Horia Geantă8cea7b62016-11-22 15:44:09 +020038
39#define DESC_RFC4543_BASE (3 * CAAM_CMD_SZ)
40#define DESC_RFC4543_ENC_LEN (DESC_RFC4543_BASE + 11 * CAAM_CMD_SZ)
41#define DESC_RFC4543_DEC_LEN (DESC_RFC4543_BASE + 12 * CAAM_CMD_SZ)
Horia Geantă87ec3a02018-01-29 10:38:36 +020042#define DESC_QI_RFC4543_ENC_LEN (DESC_RFC4543_ENC_LEN + 4 * CAAM_CMD_SZ)
43#define DESC_QI_RFC4543_DEC_LEN (DESC_RFC4543_DEC_LEN + 4 * CAAM_CMD_SZ)
Horia Geantă8cea7b62016-11-22 15:44:09 +020044
Horia Geantă9dbe3072018-08-06 15:44:00 +030045#define DESC_SKCIPHER_BASE (3 * CAAM_CMD_SZ)
46#define DESC_SKCIPHER_ENC_LEN (DESC_SKCIPHER_BASE + \
Horia Geantă334d37c2019-06-10 16:30:59 +030047 21 * CAAM_CMD_SZ)
Horia Geantă9dbe3072018-08-06 15:44:00 +030048#define DESC_SKCIPHER_DEC_LEN (DESC_SKCIPHER_BASE + \
Horia Geantă334d37c2019-06-10 16:30:59 +030049 16 * CAAM_CMD_SZ)
Horia Geantă8cea7b62016-11-22 15:44:09 +020050
51void cnstr_shdsc_aead_null_encap(u32 * const desc, struct alginfo *adata,
Horia Geantă7e0880b2017-12-19 12:16:07 +020052 unsigned int icvsize, int era);
Horia Geantă8cea7b62016-11-22 15:44:09 +020053
54void cnstr_shdsc_aead_null_decap(u32 * const desc, struct alginfo *adata,
Horia Geantă7e0880b2017-12-19 12:16:07 +020055 unsigned int icvsize, int era);
Horia Geantă8cea7b62016-11-22 15:44:09 +020056
57void cnstr_shdsc_aead_encap(u32 * const desc, struct alginfo *cdata,
Horia Geantăb1898172017-03-17 12:06:02 +020058 struct alginfo *adata, unsigned int ivsize,
59 unsigned int icvsize, const bool is_rfc3686,
60 u32 *nonce, const u32 ctx1_iv_off,
Horia Geantă7e0880b2017-12-19 12:16:07 +020061 const bool is_qi, int era);
Horia Geantă8cea7b62016-11-22 15:44:09 +020062
63void cnstr_shdsc_aead_decap(u32 * const desc, struct alginfo *cdata,
64 struct alginfo *adata, unsigned int ivsize,
65 unsigned int icvsize, const bool geniv,
66 const bool is_rfc3686, u32 *nonce,
Horia Geantă7e0880b2017-12-19 12:16:07 +020067 const u32 ctx1_iv_off, const bool is_qi, int era);
Horia Geantă8cea7b62016-11-22 15:44:09 +020068
69void cnstr_shdsc_aead_givencap(u32 * const desc, struct alginfo *cdata,
70 struct alginfo *adata, unsigned int ivsize,
71 unsigned int icvsize, const bool is_rfc3686,
Horia Geantăb1898172017-03-17 12:06:02 +020072 u32 *nonce, const u32 ctx1_iv_off,
Horia Geantă7e0880b2017-12-19 12:16:07 +020073 const bool is_qi, int era);
Horia Geantă8cea7b62016-11-22 15:44:09 +020074
75void cnstr_shdsc_gcm_encap(u32 * const desc, struct alginfo *cdata,
Horia Geantă87ec3a02018-01-29 10:38:36 +020076 unsigned int ivsize, unsigned int icvsize,
77 const bool is_qi);
Horia Geantă8cea7b62016-11-22 15:44:09 +020078
79void cnstr_shdsc_gcm_decap(u32 * const desc, struct alginfo *cdata,
Horia Geantă87ec3a02018-01-29 10:38:36 +020080 unsigned int ivsize, unsigned int icvsize,
81 const bool is_qi);
Horia Geantă8cea7b62016-11-22 15:44:09 +020082
83void cnstr_shdsc_rfc4106_encap(u32 * const desc, struct alginfo *cdata,
Horia Geantă87ec3a02018-01-29 10:38:36 +020084 unsigned int ivsize, unsigned int icvsize,
85 const bool is_qi);
Horia Geantă8cea7b62016-11-22 15:44:09 +020086
87void cnstr_shdsc_rfc4106_decap(u32 * const desc, struct alginfo *cdata,
Horia Geantă87ec3a02018-01-29 10:38:36 +020088 unsigned int ivsize, unsigned int icvsize,
89 const bool is_qi);
Horia Geantă8cea7b62016-11-22 15:44:09 +020090
91void cnstr_shdsc_rfc4543_encap(u32 * const desc, struct alginfo *cdata,
Horia Geantă87ec3a02018-01-29 10:38:36 +020092 unsigned int ivsize, unsigned int icvsize,
93 const bool is_qi);
Horia Geantă8cea7b62016-11-22 15:44:09 +020094
95void cnstr_shdsc_rfc4543_decap(u32 * const desc, struct alginfo *cdata,
Horia Geantă87ec3a02018-01-29 10:38:36 +020096 unsigned int ivsize, unsigned int icvsize,
97 const bool is_qi);
Horia Geantă8cea7b62016-11-22 15:44:09 +020098
Horia Geantăd6bbd4e2018-11-08 15:36:30 +020099void cnstr_shdsc_chachapoly(u32 * const desc, struct alginfo *cdata,
100 struct alginfo *adata, unsigned int ivsize,
Horia Geantăc10a5332018-11-08 15:36:31 +0200101 unsigned int icvsize, const bool encap,
102 const bool is_qi);
Horia Geantăd6bbd4e2018-11-08 15:36:30 +0200103
Horia Geantă9dbe3072018-08-06 15:44:00 +0300104void cnstr_shdsc_skcipher_encap(u32 * const desc, struct alginfo *cdata,
105 unsigned int ivsize, const bool is_rfc3686,
106 const u32 ctx1_iv_off);
Horia Geantă8cea7b62016-11-22 15:44:09 +0200107
Horia Geantă9dbe3072018-08-06 15:44:00 +0300108void cnstr_shdsc_skcipher_decap(u32 * const desc, struct alginfo *cdata,
109 unsigned int ivsize, const bool is_rfc3686,
110 const u32 ctx1_iv_off);
Horia Geantă8cea7b62016-11-22 15:44:09 +0200111
Horia Geantă9dbe3072018-08-06 15:44:00 +0300112void cnstr_shdsc_xts_skcipher_encap(u32 * const desc, struct alginfo *cdata);
Horia Geantă8cea7b62016-11-22 15:44:09 +0200113
Horia Geantă9dbe3072018-08-06 15:44:00 +0300114void cnstr_shdsc_xts_skcipher_decap(u32 * const desc, struct alginfo *cdata);
Horia Geantă8cea7b62016-11-22 15:44:09 +0200115
116#endif /* _CAAMALG_DESC_H_ */