162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * Shared descriptors for aead, skcipher algorithms 462306a36Sopenharmony_ci * 562306a36Sopenharmony_ci * Copyright 2016 NXP 662306a36Sopenharmony_ci */ 762306a36Sopenharmony_ci 862306a36Sopenharmony_ci#ifndef _CAAMALG_DESC_H_ 962306a36Sopenharmony_ci#define _CAAMALG_DESC_H_ 1062306a36Sopenharmony_ci 1162306a36Sopenharmony_ci/* length of descriptors text */ 1262306a36Sopenharmony_ci#define DESC_AEAD_BASE (4 * CAAM_CMD_SZ) 1362306a36Sopenharmony_ci#define DESC_AEAD_ENC_LEN (DESC_AEAD_BASE + 11 * CAAM_CMD_SZ) 1462306a36Sopenharmony_ci#define DESC_AEAD_DEC_LEN (DESC_AEAD_BASE + 15 * CAAM_CMD_SZ) 1562306a36Sopenharmony_ci#define DESC_AEAD_GIVENC_LEN (DESC_AEAD_ENC_LEN + 8 * CAAM_CMD_SZ) 1662306a36Sopenharmony_ci#define DESC_QI_AEAD_ENC_LEN (DESC_AEAD_ENC_LEN + 3 * CAAM_CMD_SZ) 1762306a36Sopenharmony_ci#define DESC_QI_AEAD_DEC_LEN (DESC_AEAD_DEC_LEN + 3 * CAAM_CMD_SZ) 1862306a36Sopenharmony_ci#define DESC_QI_AEAD_GIVENC_LEN (DESC_AEAD_GIVENC_LEN + 3 * CAAM_CMD_SZ) 1962306a36Sopenharmony_ci 2062306a36Sopenharmony_ci/* Note: Nonce is counted in cdata.keylen */ 2162306a36Sopenharmony_ci#define DESC_AEAD_CTR_RFC3686_LEN (4 * CAAM_CMD_SZ) 2262306a36Sopenharmony_ci 2362306a36Sopenharmony_ci#define DESC_AEAD_NULL_BASE (3 * CAAM_CMD_SZ) 2462306a36Sopenharmony_ci#define DESC_AEAD_NULL_ENC_LEN (DESC_AEAD_NULL_BASE + 11 * CAAM_CMD_SZ) 2562306a36Sopenharmony_ci#define DESC_AEAD_NULL_DEC_LEN (DESC_AEAD_NULL_BASE + 13 * CAAM_CMD_SZ) 2662306a36Sopenharmony_ci 2762306a36Sopenharmony_ci#define DESC_GCM_BASE (3 * CAAM_CMD_SZ) 2862306a36Sopenharmony_ci#define DESC_GCM_ENC_LEN (DESC_GCM_BASE + 16 * CAAM_CMD_SZ) 2962306a36Sopenharmony_ci#define DESC_GCM_DEC_LEN (DESC_GCM_BASE + 12 * CAAM_CMD_SZ) 3062306a36Sopenharmony_ci#define DESC_QI_GCM_ENC_LEN (DESC_GCM_ENC_LEN + 6 * CAAM_CMD_SZ) 3162306a36Sopenharmony_ci#define DESC_QI_GCM_DEC_LEN (DESC_GCM_DEC_LEN + 3 * CAAM_CMD_SZ) 3262306a36Sopenharmony_ci 3362306a36Sopenharmony_ci#define DESC_RFC4106_BASE (3 * CAAM_CMD_SZ) 3462306a36Sopenharmony_ci#define DESC_RFC4106_ENC_LEN (DESC_RFC4106_BASE + 16 * CAAM_CMD_SZ) 3562306a36Sopenharmony_ci#define DESC_RFC4106_DEC_LEN (DESC_RFC4106_BASE + 13 * CAAM_CMD_SZ) 3662306a36Sopenharmony_ci#define DESC_QI_RFC4106_ENC_LEN (DESC_RFC4106_ENC_LEN + 5 * CAAM_CMD_SZ) 3762306a36Sopenharmony_ci#define DESC_QI_RFC4106_DEC_LEN (DESC_RFC4106_DEC_LEN + 5 * CAAM_CMD_SZ) 3862306a36Sopenharmony_ci 3962306a36Sopenharmony_ci#define DESC_RFC4543_BASE (3 * CAAM_CMD_SZ) 4062306a36Sopenharmony_ci#define DESC_RFC4543_ENC_LEN (DESC_RFC4543_BASE + 11 * CAAM_CMD_SZ) 4162306a36Sopenharmony_ci#define DESC_RFC4543_DEC_LEN (DESC_RFC4543_BASE + 12 * CAAM_CMD_SZ) 4262306a36Sopenharmony_ci#define DESC_QI_RFC4543_ENC_LEN (DESC_RFC4543_ENC_LEN + 4 * CAAM_CMD_SZ) 4362306a36Sopenharmony_ci#define DESC_QI_RFC4543_DEC_LEN (DESC_RFC4543_DEC_LEN + 4 * CAAM_CMD_SZ) 4462306a36Sopenharmony_ci 4562306a36Sopenharmony_ci#define DESC_SKCIPHER_BASE (3 * CAAM_CMD_SZ) 4662306a36Sopenharmony_ci#define DESC_SKCIPHER_ENC_LEN (DESC_SKCIPHER_BASE + \ 4762306a36Sopenharmony_ci 21 * CAAM_CMD_SZ) 4862306a36Sopenharmony_ci#define DESC_SKCIPHER_DEC_LEN (DESC_SKCIPHER_BASE + \ 4962306a36Sopenharmony_ci 16 * CAAM_CMD_SZ) 5062306a36Sopenharmony_ci 5162306a36Sopenharmony_civoid cnstr_shdsc_aead_null_encap(u32 * const desc, struct alginfo *adata, 5262306a36Sopenharmony_ci unsigned int icvsize, int era); 5362306a36Sopenharmony_ci 5462306a36Sopenharmony_civoid cnstr_shdsc_aead_null_decap(u32 * const desc, struct alginfo *adata, 5562306a36Sopenharmony_ci unsigned int icvsize, int era); 5662306a36Sopenharmony_ci 5762306a36Sopenharmony_civoid cnstr_shdsc_aead_encap(u32 * const desc, struct alginfo *cdata, 5862306a36Sopenharmony_ci struct alginfo *adata, unsigned int ivsize, 5962306a36Sopenharmony_ci unsigned int icvsize, const bool is_rfc3686, 6062306a36Sopenharmony_ci u32 *nonce, const u32 ctx1_iv_off, 6162306a36Sopenharmony_ci const bool is_qi, int era); 6262306a36Sopenharmony_ci 6362306a36Sopenharmony_civoid cnstr_shdsc_aead_decap(u32 * const desc, struct alginfo *cdata, 6462306a36Sopenharmony_ci struct alginfo *adata, unsigned int ivsize, 6562306a36Sopenharmony_ci unsigned int icvsize, const bool geniv, 6662306a36Sopenharmony_ci const bool is_rfc3686, u32 *nonce, 6762306a36Sopenharmony_ci const u32 ctx1_iv_off, const bool is_qi, int era); 6862306a36Sopenharmony_ci 6962306a36Sopenharmony_civoid cnstr_shdsc_aead_givencap(u32 * const desc, struct alginfo *cdata, 7062306a36Sopenharmony_ci struct alginfo *adata, unsigned int ivsize, 7162306a36Sopenharmony_ci unsigned int icvsize, const bool is_rfc3686, 7262306a36Sopenharmony_ci u32 *nonce, const u32 ctx1_iv_off, 7362306a36Sopenharmony_ci const bool is_qi, int era); 7462306a36Sopenharmony_ci 7562306a36Sopenharmony_civoid cnstr_shdsc_gcm_encap(u32 * const desc, struct alginfo *cdata, 7662306a36Sopenharmony_ci unsigned int ivsize, unsigned int icvsize, 7762306a36Sopenharmony_ci const bool is_qi); 7862306a36Sopenharmony_ci 7962306a36Sopenharmony_civoid cnstr_shdsc_gcm_decap(u32 * const desc, struct alginfo *cdata, 8062306a36Sopenharmony_ci unsigned int ivsize, unsigned int icvsize, 8162306a36Sopenharmony_ci const bool is_qi); 8262306a36Sopenharmony_ci 8362306a36Sopenharmony_civoid cnstr_shdsc_rfc4106_encap(u32 * const desc, struct alginfo *cdata, 8462306a36Sopenharmony_ci unsigned int ivsize, unsigned int icvsize, 8562306a36Sopenharmony_ci const bool is_qi); 8662306a36Sopenharmony_ci 8762306a36Sopenharmony_civoid cnstr_shdsc_rfc4106_decap(u32 * const desc, struct alginfo *cdata, 8862306a36Sopenharmony_ci unsigned int ivsize, unsigned int icvsize, 8962306a36Sopenharmony_ci const bool is_qi); 9062306a36Sopenharmony_ci 9162306a36Sopenharmony_civoid cnstr_shdsc_rfc4543_encap(u32 * const desc, struct alginfo *cdata, 9262306a36Sopenharmony_ci unsigned int ivsize, unsigned int icvsize, 9362306a36Sopenharmony_ci const bool is_qi); 9462306a36Sopenharmony_ci 9562306a36Sopenharmony_civoid cnstr_shdsc_rfc4543_decap(u32 * const desc, struct alginfo *cdata, 9662306a36Sopenharmony_ci unsigned int ivsize, unsigned int icvsize, 9762306a36Sopenharmony_ci const bool is_qi); 9862306a36Sopenharmony_ci 9962306a36Sopenharmony_civoid cnstr_shdsc_chachapoly(u32 * const desc, struct alginfo *cdata, 10062306a36Sopenharmony_ci struct alginfo *adata, unsigned int ivsize, 10162306a36Sopenharmony_ci unsigned int icvsize, const bool encap, 10262306a36Sopenharmony_ci const bool is_qi); 10362306a36Sopenharmony_ci 10462306a36Sopenharmony_civoid cnstr_shdsc_skcipher_encap(u32 * const desc, struct alginfo *cdata, 10562306a36Sopenharmony_ci unsigned int ivsize, const bool is_rfc3686, 10662306a36Sopenharmony_ci const u32 ctx1_iv_off); 10762306a36Sopenharmony_ci 10862306a36Sopenharmony_civoid cnstr_shdsc_skcipher_decap(u32 * const desc, struct alginfo *cdata, 10962306a36Sopenharmony_ci unsigned int ivsize, const bool is_rfc3686, 11062306a36Sopenharmony_ci const u32 ctx1_iv_off); 11162306a36Sopenharmony_ci 11262306a36Sopenharmony_civoid cnstr_shdsc_xts_skcipher_encap(u32 * const desc, struct alginfo *cdata); 11362306a36Sopenharmony_ci 11462306a36Sopenharmony_civoid cnstr_shdsc_xts_skcipher_decap(u32 * const desc, struct alginfo *cdata); 11562306a36Sopenharmony_ci 11662306a36Sopenharmony_ci#endif /* _CAAMALG_DESC_H_ */ 117