1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Shared descriptors for aead, ablkcipher algorithms
8 #ifndef _CAAMALG_DESC_H_
9 #define _CAAMALG_DESC_H_
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)
15 #define DESC_AEAD_GIVENC_LEN (DESC_AEAD_ENC_LEN + 8 * CAAM_CMD_SZ)
16 #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)
20 /* Note: Nonce is counted in cdata.keylen */
21 #define DESC_AEAD_CTR_RFC3686_LEN (4 * CAAM_CMD_SZ)
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)
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)
30 #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)
33 #define DESC_RFC4106_BASE (3 * CAAM_CMD_SZ)
34 #define DESC_RFC4106_ENC_LEN (DESC_RFC4106_BASE + 13 * CAAM_CMD_SZ)
35 #define DESC_RFC4106_DEC_LEN (DESC_RFC4106_BASE + 13 * CAAM_CMD_SZ)
36 #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)
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)
42 #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)
45 #define DESC_ABLKCIPHER_BASE (3 * CAAM_CMD_SZ)
46 #define DESC_ABLKCIPHER_ENC_LEN (DESC_ABLKCIPHER_BASE + \
48 #define DESC_ABLKCIPHER_DEC_LEN (DESC_ABLKCIPHER_BASE + \
51 void cnstr_shdsc_aead_null_encap(u32 * const desc, struct alginfo *adata,
52 unsigned int icvsize, int era);
54 void cnstr_shdsc_aead_null_decap(u32 * const desc, struct alginfo *adata,
55 unsigned int icvsize, int era);
57 void cnstr_shdsc_aead_encap(u32 * const desc, struct alginfo *cdata,
58 struct alginfo *adata, unsigned int ivsize,
59 unsigned int icvsize, const bool is_rfc3686,
60 u32 *nonce, const u32 ctx1_iv_off,
61 const bool is_qi, int era);
63 void 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,
67 const u32 ctx1_iv_off, const bool is_qi, int era);
69 void 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,
72 u32 *nonce, const u32 ctx1_iv_off,
73 const bool is_qi, int era);
75 void cnstr_shdsc_gcm_encap(u32 * const desc, struct alginfo *cdata,
76 unsigned int ivsize, unsigned int icvsize,
79 void cnstr_shdsc_gcm_decap(u32 * const desc, struct alginfo *cdata,
80 unsigned int ivsize, unsigned int icvsize,
83 void cnstr_shdsc_rfc4106_encap(u32 * const desc, struct alginfo *cdata,
84 unsigned int ivsize, unsigned int icvsize,
87 void cnstr_shdsc_rfc4106_decap(u32 * const desc, struct alginfo *cdata,
88 unsigned int ivsize, unsigned int icvsize,
91 void cnstr_shdsc_rfc4543_encap(u32 * const desc, struct alginfo *cdata,
92 unsigned int ivsize, unsigned int icvsize,
95 void cnstr_shdsc_rfc4543_decap(u32 * const desc, struct alginfo *cdata,
96 unsigned int ivsize, unsigned int icvsize,
99 void cnstr_shdsc_ablkcipher_encap(u32 * const desc, struct alginfo *cdata,
100 unsigned int ivsize, const bool is_rfc3686,
101 const u32 ctx1_iv_off);
103 void cnstr_shdsc_ablkcipher_decap(u32 * const desc, struct alginfo *cdata,
104 unsigned int ivsize, const bool is_rfc3686,
105 const u32 ctx1_iv_off);
107 void cnstr_shdsc_ablkcipher_givencap(u32 * const desc, struct alginfo *cdata,
108 unsigned int ivsize, const bool is_rfc3686,
109 const u32 ctx1_iv_off);
111 void cnstr_shdsc_xts_ablkcipher_encap(u32 * const desc, struct alginfo *cdata);
113 void cnstr_shdsc_xts_ablkcipher_decap(u32 * const desc, struct alginfo *cdata);
115 #endif /* _CAAMALG_DESC_H_ */