162306a36Sopenharmony_ci/* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Shared descriptors for ahash algorithms
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * Copyright 2017 NXP
662306a36Sopenharmony_ci */
762306a36Sopenharmony_ci
862306a36Sopenharmony_ci#ifndef _CAAMHASH_DESC_H_
962306a36Sopenharmony_ci#define _CAAMHASH_DESC_H_
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ci/* length of descriptors text */
1262306a36Sopenharmony_ci#define DESC_AHASH_BASE			(3 * CAAM_CMD_SZ)
1362306a36Sopenharmony_ci#define DESC_AHASH_UPDATE_LEN		(6 * CAAM_CMD_SZ)
1462306a36Sopenharmony_ci#define DESC_AHASH_UPDATE_FIRST_LEN	(DESC_AHASH_BASE + 4 * CAAM_CMD_SZ)
1562306a36Sopenharmony_ci#define DESC_AHASH_FINAL_LEN		(DESC_AHASH_BASE + 5 * CAAM_CMD_SZ)
1662306a36Sopenharmony_ci#define DESC_AHASH_DIGEST_LEN		(DESC_AHASH_BASE + 4 * CAAM_CMD_SZ)
1762306a36Sopenharmony_ci
1862306a36Sopenharmony_cistatic inline bool is_xcbc_aes(u32 algtype)
1962306a36Sopenharmony_ci{
2062306a36Sopenharmony_ci	return (algtype & (OP_ALG_ALGSEL_MASK | OP_ALG_AAI_MASK)) ==
2162306a36Sopenharmony_ci	       (OP_ALG_ALGSEL_AES | OP_ALG_AAI_XCBC_MAC);
2262306a36Sopenharmony_ci}
2362306a36Sopenharmony_ci
2462306a36Sopenharmony_civoid cnstr_shdsc_ahash(u32 * const desc, struct alginfo *adata, u32 state,
2562306a36Sopenharmony_ci		       int digestsize, int ctx_len, bool import_ctx, int era);
2662306a36Sopenharmony_ci
2762306a36Sopenharmony_civoid cnstr_shdsc_sk_hash(u32 * const desc, struct alginfo *adata, u32 state,
2862306a36Sopenharmony_ci			 int digestsize, int ctx_len);
2962306a36Sopenharmony_ci#endif /* _CAAMHASH_DESC_H_ */
30