18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Shared descriptors for ahash algorithms
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright 2017 NXP
68c2ecf20Sopenharmony_ci */
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci#ifndef _CAAMHASH_DESC_H_
98c2ecf20Sopenharmony_ci#define _CAAMHASH_DESC_H_
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci/* length of descriptors text */
128c2ecf20Sopenharmony_ci#define DESC_AHASH_BASE			(3 * CAAM_CMD_SZ)
138c2ecf20Sopenharmony_ci#define DESC_AHASH_UPDATE_LEN		(6 * CAAM_CMD_SZ)
148c2ecf20Sopenharmony_ci#define DESC_AHASH_UPDATE_FIRST_LEN	(DESC_AHASH_BASE + 4 * CAAM_CMD_SZ)
158c2ecf20Sopenharmony_ci#define DESC_AHASH_FINAL_LEN		(DESC_AHASH_BASE + 5 * CAAM_CMD_SZ)
168c2ecf20Sopenharmony_ci#define DESC_AHASH_DIGEST_LEN		(DESC_AHASH_BASE + 4 * CAAM_CMD_SZ)
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_cistatic inline bool is_xcbc_aes(u32 algtype)
198c2ecf20Sopenharmony_ci{
208c2ecf20Sopenharmony_ci	return (algtype & (OP_ALG_ALGSEL_MASK | OP_ALG_AAI_MASK)) ==
218c2ecf20Sopenharmony_ci	       (OP_ALG_ALGSEL_AES | OP_ALG_AAI_XCBC_MAC);
228c2ecf20Sopenharmony_ci}
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_civoid cnstr_shdsc_ahash(u32 * const desc, struct alginfo *adata, u32 state,
258c2ecf20Sopenharmony_ci		       int digestsize, int ctx_len, bool import_ctx, int era);
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_civoid cnstr_shdsc_sk_hash(u32 * const desc, struct alginfo *adata, u32 state,
288c2ecf20Sopenharmony_ci			 int digestsize, int ctx_len);
298c2ecf20Sopenharmony_ci#endif /* _CAAMHASH_DESC_H_ */
30