caamalg_desc.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Shared descriptors for aead, ablkcipher algorithms
  4. *
  5. * Copyright 2016 NXP
  6. */
  7. #ifndef _CAAMALG_DESC_H_
  8. #define _CAAMALG_DESC_H_
  9. /* length of descriptors text */
  10. #define DESC_AEAD_BASE (4 * CAAM_CMD_SZ)
  11. #define DESC_AEAD_ENC_LEN (DESC_AEAD_BASE + 11 * CAAM_CMD_SZ)
  12. #define DESC_AEAD_DEC_LEN (DESC_AEAD_BASE + 15 * CAAM_CMD_SZ)
  13. #define DESC_AEAD_GIVENC_LEN (DESC_AEAD_ENC_LEN + 8 * CAAM_CMD_SZ)
  14. #define DESC_QI_AEAD_ENC_LEN (DESC_AEAD_ENC_LEN + 3 * CAAM_CMD_SZ)
  15. #define DESC_QI_AEAD_DEC_LEN (DESC_AEAD_DEC_LEN + 3 * CAAM_CMD_SZ)
  16. #define DESC_QI_AEAD_GIVENC_LEN (DESC_AEAD_GIVENC_LEN + 3 * CAAM_CMD_SZ)
  17. /* Note: Nonce is counted in cdata.keylen */
  18. #define DESC_AEAD_CTR_RFC3686_LEN (4 * CAAM_CMD_SZ)
  19. #define DESC_AEAD_NULL_BASE (3 * CAAM_CMD_SZ)
  20. #define DESC_AEAD_NULL_ENC_LEN (DESC_AEAD_NULL_BASE + 11 * CAAM_CMD_SZ)
  21. #define DESC_AEAD_NULL_DEC_LEN (DESC_AEAD_NULL_BASE + 13 * CAAM_CMD_SZ)
  22. #define DESC_GCM_BASE (3 * CAAM_CMD_SZ)
  23. #define DESC_GCM_ENC_LEN (DESC_GCM_BASE + 16 * CAAM_CMD_SZ)
  24. #define DESC_GCM_DEC_LEN (DESC_GCM_BASE + 12 * CAAM_CMD_SZ)
  25. #define DESC_QI_GCM_ENC_LEN (DESC_GCM_ENC_LEN + 6 * CAAM_CMD_SZ)
  26. #define DESC_QI_GCM_DEC_LEN (DESC_GCM_DEC_LEN + 3 * CAAM_CMD_SZ)
  27. #define DESC_RFC4106_BASE (3 * CAAM_CMD_SZ)
  28. #define DESC_RFC4106_ENC_LEN (DESC_RFC4106_BASE + 13 * CAAM_CMD_SZ)
  29. #define DESC_RFC4106_DEC_LEN (DESC_RFC4106_BASE + 13 * CAAM_CMD_SZ)
  30. #define DESC_QI_RFC4106_ENC_LEN (DESC_RFC4106_ENC_LEN + 5 * CAAM_CMD_SZ)
  31. #define DESC_QI_RFC4106_DEC_LEN (DESC_RFC4106_DEC_LEN + 5 * CAAM_CMD_SZ)
  32. #define DESC_RFC4543_BASE (3 * CAAM_CMD_SZ)
  33. #define DESC_RFC4543_ENC_LEN (DESC_RFC4543_BASE + 11 * CAAM_CMD_SZ)
  34. #define DESC_RFC4543_DEC_LEN (DESC_RFC4543_BASE + 12 * CAAM_CMD_SZ)
  35. #define DESC_QI_RFC4543_ENC_LEN (DESC_RFC4543_ENC_LEN + 4 * CAAM_CMD_SZ)
  36. #define DESC_QI_RFC4543_DEC_LEN (DESC_RFC4543_DEC_LEN + 4 * CAAM_CMD_SZ)
  37. #define DESC_ABLKCIPHER_BASE (3 * CAAM_CMD_SZ)
  38. #define DESC_ABLKCIPHER_ENC_LEN (DESC_ABLKCIPHER_BASE + \
  39. 20 * CAAM_CMD_SZ)
  40. #define DESC_ABLKCIPHER_DEC_LEN (DESC_ABLKCIPHER_BASE + \
  41. 15 * CAAM_CMD_SZ)
  42. void cnstr_shdsc_aead_null_encap(u32 * const desc, struct alginfo *adata,
  43. unsigned int icvsize, int era);
  44. void cnstr_shdsc_aead_null_decap(u32 * const desc, struct alginfo *adata,
  45. unsigned int icvsize, int era);
  46. void cnstr_shdsc_aead_encap(u32 * const desc, struct alginfo *cdata,
  47. struct alginfo *adata, unsigned int ivsize,
  48. unsigned int icvsize, const bool is_rfc3686,
  49. u32 *nonce, const u32 ctx1_iv_off,
  50. const bool is_qi, int era);
  51. void cnstr_shdsc_aead_decap(u32 * const desc, struct alginfo *cdata,
  52. struct alginfo *adata, unsigned int ivsize,
  53. unsigned int icvsize, const bool geniv,
  54. const bool is_rfc3686, u32 *nonce,
  55. const u32 ctx1_iv_off, const bool is_qi, int era);
  56. void cnstr_shdsc_aead_givencap(u32 * const desc, struct alginfo *cdata,
  57. struct alginfo *adata, unsigned int ivsize,
  58. unsigned int icvsize, const bool is_rfc3686,
  59. u32 *nonce, const u32 ctx1_iv_off,
  60. const bool is_qi, int era);
  61. void cnstr_shdsc_gcm_encap(u32 * const desc, struct alginfo *cdata,
  62. unsigned int ivsize, unsigned int icvsize,
  63. const bool is_qi);
  64. void cnstr_shdsc_gcm_decap(u32 * const desc, struct alginfo *cdata,
  65. unsigned int ivsize, unsigned int icvsize,
  66. const bool is_qi);
  67. void cnstr_shdsc_rfc4106_encap(u32 * const desc, struct alginfo *cdata,
  68. unsigned int ivsize, unsigned int icvsize,
  69. const bool is_qi);
  70. void cnstr_shdsc_rfc4106_decap(u32 * const desc, struct alginfo *cdata,
  71. unsigned int ivsize, unsigned int icvsize,
  72. const bool is_qi);
  73. void cnstr_shdsc_rfc4543_encap(u32 * const desc, struct alginfo *cdata,
  74. unsigned int ivsize, unsigned int icvsize,
  75. const bool is_qi);
  76. void cnstr_shdsc_rfc4543_decap(u32 * const desc, struct alginfo *cdata,
  77. unsigned int ivsize, unsigned int icvsize,
  78. const bool is_qi);
  79. void cnstr_shdsc_ablkcipher_encap(u32 * const desc, struct alginfo *cdata,
  80. unsigned int ivsize, const bool is_rfc3686,
  81. const u32 ctx1_iv_off);
  82. void cnstr_shdsc_ablkcipher_decap(u32 * const desc, struct alginfo *cdata,
  83. unsigned int ivsize, const bool is_rfc3686,
  84. const u32 ctx1_iv_off);
  85. void cnstr_shdsc_ablkcipher_givencap(u32 * const desc, struct alginfo *cdata,
  86. unsigned int ivsize, const bool is_rfc3686,
  87. const u32 ctx1_iv_off);
  88. void cnstr_shdsc_xts_ablkcipher_encap(u32 * const desc, struct alginfo *cdata);
  89. void cnstr_shdsc_xts_ablkcipher_decap(u32 * const desc, struct alginfo *cdata);
  90. #endif /* _CAAMALG_DESC_H_ */