eip93-cipher.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /* SPDX-License-Identifier: GPL-2.0
  2. *
  3. * Copyright (C) 2019 - 2021
  4. *
  5. * Richard van Schagen <vschagen@icloud.com>
  6. * Christian Marangi <ansuelsmth@gmail.com
  7. */
  8. #ifndef _EIP93_CIPHER_H_
  9. #define _EIP93_CIPHER_H_
  10. #include "eip93-main.h"
  11. struct eip93_crypto_ctx {
  12. struct eip93_device *eip93;
  13. u32 flags;
  14. struct sa_record *sa_record;
  15. u32 sa_nonce;
  16. int blksize;
  17. dma_addr_t sa_record_base;
  18. /* AEAD specific */
  19. unsigned int authsize;
  20. unsigned int assoclen;
  21. bool set_assoc;
  22. enum eip93_alg_type type;
  23. };
  24. struct eip93_cipher_reqctx {
  25. u16 desc_flags;
  26. u16 flags;
  27. unsigned int blksize;
  28. unsigned int ivsize;
  29. unsigned int textsize;
  30. unsigned int assoclen;
  31. unsigned int authsize;
  32. dma_addr_t sa_record_base;
  33. struct sa_state *sa_state;
  34. dma_addr_t sa_state_base;
  35. struct eip93_descriptor *cdesc;
  36. struct scatterlist *sg_src;
  37. struct scatterlist *sg_dst;
  38. int src_nents;
  39. int dst_nents;
  40. struct sa_state *sa_state_ctr;
  41. dma_addr_t sa_state_ctr_base;
  42. };
  43. int check_valid_request(struct eip93_cipher_reqctx *rctx);
  44. void eip93_unmap_dma(struct eip93_device *eip93, struct eip93_cipher_reqctx *rctx,
  45. struct scatterlist *reqsrc, struct scatterlist *reqdst);
  46. void eip93_skcipher_handle_result(struct crypto_async_request *async, int err);
  47. int eip93_send_req(struct crypto_async_request *async,
  48. const u8 *reqiv, struct eip93_cipher_reqctx *rctx);
  49. void eip93_handle_result(struct eip93_device *eip93, struct eip93_cipher_reqctx *rctx,
  50. u8 *reqiv);
  51. #endif /* _EIP93_CIPHER_H_ */