caamhash_desc.h 964 B

123456789101112131415161718192021222324252627282930
  1. /* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */
  2. /*
  3. * Shared descriptors for ahash algorithms
  4. *
  5. * Copyright 2017 NXP
  6. */
  7. #ifndef _CAAMHASH_DESC_H_
  8. #define _CAAMHASH_DESC_H_
  9. /* length of descriptors text */
  10. #define DESC_AHASH_BASE (3 * CAAM_CMD_SZ)
  11. #define DESC_AHASH_UPDATE_LEN (6 * CAAM_CMD_SZ)
  12. #define DESC_AHASH_UPDATE_FIRST_LEN (DESC_AHASH_BASE + 4 * CAAM_CMD_SZ)
  13. #define DESC_AHASH_FINAL_LEN (DESC_AHASH_BASE + 5 * CAAM_CMD_SZ)
  14. #define DESC_AHASH_DIGEST_LEN (DESC_AHASH_BASE + 4 * CAAM_CMD_SZ)
  15. static inline bool is_xcbc_aes(u32 algtype)
  16. {
  17. return (algtype & (OP_ALG_ALGSEL_MASK | OP_ALG_AAI_MASK)) ==
  18. (OP_ALG_ALGSEL_AES | OP_ALG_AAI_XCBC_MAC);
  19. }
  20. void cnstr_shdsc_ahash(u32 * const desc, struct alginfo *adata, u32 state,
  21. int digestsize, int ctx_len, bool import_ctx, int era);
  22. void cnstr_shdsc_sk_hash(u32 * const desc, struct alginfo *adata, u32 state,
  23. int digestsize, int ctx_len);
  24. #endif /* _CAAMHASH_DESC_H_ */