cryptd.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Software async crypto daemon
  4. *
  5. * Added AEAD support to cryptd.
  6. * Authors: Tadeusz Struk ([email protected])
  7. * Adrian Hoban <[email protected]>
  8. * Gabriele Paoloni <[email protected]>
  9. * Aidan O'Mahony ([email protected])
  10. * Copyright (c) 2010, Intel Corporation.
  11. */
  12. #ifndef _CRYPTO_CRYPT_H
  13. #define _CRYPTO_CRYPT_H
  14. #include <linux/types.h>
  15. #include <crypto/aead.h>
  16. #include <crypto/hash.h>
  17. #include <crypto/skcipher.h>
  18. struct cryptd_skcipher {
  19. struct crypto_skcipher base;
  20. };
  21. /* alg_name should be algorithm to be cryptd-ed */
  22. struct cryptd_skcipher *cryptd_alloc_skcipher(const char *alg_name,
  23. u32 type, u32 mask);
  24. struct crypto_skcipher *cryptd_skcipher_child(struct cryptd_skcipher *tfm);
  25. /* Must be called without moving CPUs. */
  26. bool cryptd_skcipher_queued(struct cryptd_skcipher *tfm);
  27. void cryptd_free_skcipher(struct cryptd_skcipher *tfm);
  28. struct cryptd_ahash {
  29. struct crypto_ahash base;
  30. };
  31. static inline struct cryptd_ahash *__cryptd_ahash_cast(
  32. struct crypto_ahash *tfm)
  33. {
  34. return (struct cryptd_ahash *)tfm;
  35. }
  36. /* alg_name should be algorithm to be cryptd-ed */
  37. struct cryptd_ahash *cryptd_alloc_ahash(const char *alg_name,
  38. u32 type, u32 mask);
  39. struct crypto_shash *cryptd_ahash_child(struct cryptd_ahash *tfm);
  40. struct shash_desc *cryptd_shash_desc(struct ahash_request *req);
  41. /* Must be called without moving CPUs. */
  42. bool cryptd_ahash_queued(struct cryptd_ahash *tfm);
  43. void cryptd_free_ahash(struct cryptd_ahash *tfm);
  44. struct cryptd_aead {
  45. struct crypto_aead base;
  46. };
  47. static inline struct cryptd_aead *__cryptd_aead_cast(
  48. struct crypto_aead *tfm)
  49. {
  50. return (struct cryptd_aead *)tfm;
  51. }
  52. struct cryptd_aead *cryptd_alloc_aead(const char *alg_name,
  53. u32 type, u32 mask);
  54. struct crypto_aead *cryptd_aead_child(struct cryptd_aead *tfm);
  55. /* Must be called without moving CPUs. */
  56. bool cryptd_aead_queued(struct cryptd_aead *tfm);
  57. void cryptd_free_aead(struct cryptd_aead *tfm);
  58. #endif