1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Copyright (c) 2021, Linaro Limited. All rights reserved.
12 #define QCE_MAX_KEY_SIZE 64
13 #define QCE_CCM4309_SALT_SIZE 3
16 u8 enc_key[QCE_MAX_KEY_SIZE];
17 u8 auth_key[QCE_MAX_KEY_SIZE];
18 u8 ccm4309_salt[QCE_CCM4309_SALT_SIZE];
19 unsigned int enc_keylen;
20 unsigned int auth_keylen;
21 unsigned int authsize;
23 struct crypto_aead *fallback;
26 struct qce_aead_reqctx {
32 struct scatterlist result_sg;
33 struct scatterlist adata_sg;
34 struct sg_table dst_tbl;
35 struct sg_table src_tbl;
36 struct scatterlist *dst_sg;
37 struct scatterlist *src_sg;
38 unsigned int cryptlen;
39 unsigned int assoclen;
41 u8 ccm_nonce[QCE_MAX_NONCE];
42 u8 ccmresult_buf[QCE_BAM_BURST_SIZE];
43 u8 ccm_rfc4309_iv[QCE_MAX_IV_SIZE];
44 struct aead_request fallback_req;
47 static inline struct qce_alg_template *to_aead_tmpl(struct crypto_aead *tfm)
49 struct aead_alg *alg = crypto_aead_alg(tfm);
51 return container_of(alg, struct qce_alg_template, alg.aead);
54 extern const struct qce_algo_ops aead_ops;