]> git.proxmox.com Git - mirror_ubuntu-kernels.git/blame - drivers/crypto/caam/caamalg_desc.h
License cleanup: add SPDX GPL-2.0 license identifier to files with no license
[mirror_ubuntu-kernels.git] / drivers / crypto / caam / caamalg_desc.h
CommitLineData
b2441318 1/* SPDX-License-Identifier: GPL-2.0 */
8cea7b66
HG
2/*
3 * Shared descriptors for aead, ablkcipher algorithms
4 *
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)
15#define DESC_AEAD_GIVENC_LEN (DESC_AEAD_ENC_LEN + 7 * CAAM_CMD_SZ)
b189817c
HG
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)
8cea7b66
HG
19
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)
30
31#define DESC_RFC4106_BASE (3 * CAAM_CMD_SZ)
32#define DESC_RFC4106_ENC_LEN (DESC_RFC4106_BASE + 13 * CAAM_CMD_SZ)
33#define DESC_RFC4106_DEC_LEN (DESC_RFC4106_BASE + 13 * CAAM_CMD_SZ)
34
35#define DESC_RFC4543_BASE (3 * CAAM_CMD_SZ)
36#define DESC_RFC4543_ENC_LEN (DESC_RFC4543_BASE + 11 * CAAM_CMD_SZ)
37#define DESC_RFC4543_DEC_LEN (DESC_RFC4543_BASE + 12 * CAAM_CMD_SZ)
38
39#define DESC_ABLKCIPHER_BASE (3 * CAAM_CMD_SZ)
40#define DESC_ABLKCIPHER_ENC_LEN (DESC_ABLKCIPHER_BASE + \
41 20 * CAAM_CMD_SZ)
42#define DESC_ABLKCIPHER_DEC_LEN (DESC_ABLKCIPHER_BASE + \
43 15 * CAAM_CMD_SZ)
44
45void cnstr_shdsc_aead_null_encap(u32 * const desc, struct alginfo *adata,
46 unsigned int icvsize);
47
48void cnstr_shdsc_aead_null_decap(u32 * const desc, struct alginfo *adata,
49 unsigned int icvsize);
50
51void cnstr_shdsc_aead_encap(u32 * const desc, struct alginfo *cdata,
b189817c
HG
52 struct alginfo *adata, unsigned int ivsize,
53 unsigned int icvsize, const bool is_rfc3686,
54 u32 *nonce, const u32 ctx1_iv_off,
55 const bool is_qi);
8cea7b66
HG
56
57void cnstr_shdsc_aead_decap(u32 * const desc, struct alginfo *cdata,
58 struct alginfo *adata, unsigned int ivsize,
59 unsigned int icvsize, const bool geniv,
60 const bool is_rfc3686, u32 *nonce,
b189817c 61 const u32 ctx1_iv_off, const bool is_qi);
8cea7b66
HG
62
63void cnstr_shdsc_aead_givencap(u32 * const desc, struct alginfo *cdata,
64 struct alginfo *adata, unsigned int ivsize,
65 unsigned int icvsize, const bool is_rfc3686,
b189817c
HG
66 u32 *nonce, const u32 ctx1_iv_off,
67 const bool is_qi);
8cea7b66
HG
68
69void cnstr_shdsc_gcm_encap(u32 * const desc, struct alginfo *cdata,
70 unsigned int icvsize);
71
72void cnstr_shdsc_gcm_decap(u32 * const desc, struct alginfo *cdata,
73 unsigned int icvsize);
74
75void cnstr_shdsc_rfc4106_encap(u32 * const desc, struct alginfo *cdata,
76 unsigned int icvsize);
77
78void cnstr_shdsc_rfc4106_decap(u32 * const desc, struct alginfo *cdata,
79 unsigned int icvsize);
80
81void cnstr_shdsc_rfc4543_encap(u32 * const desc, struct alginfo *cdata,
82 unsigned int icvsize);
83
84void cnstr_shdsc_rfc4543_decap(u32 * const desc, struct alginfo *cdata,
85 unsigned int icvsize);
86
87void cnstr_shdsc_ablkcipher_encap(u32 * const desc, struct alginfo *cdata,
88 unsigned int ivsize, const bool is_rfc3686,
89 const u32 ctx1_iv_off);
90
91void cnstr_shdsc_ablkcipher_decap(u32 * const desc, struct alginfo *cdata,
92 unsigned int ivsize, const bool is_rfc3686,
93 const u32 ctx1_iv_off);
94
95void cnstr_shdsc_ablkcipher_givencap(u32 * const desc, struct alginfo *cdata,
96 unsigned int ivsize, const bool is_rfc3686,
97 const u32 ctx1_iv_off);
98
99void cnstr_shdsc_xts_ablkcipher_encap(u32 * const desc, struct alginfo *cdata);
100
101void cnstr_shdsc_xts_ablkcipher_decap(u32 * const desc, struct alginfo *cdata);
102
103#endif /* _CAAMALG_DESC_H_ */