acompress.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. * Asynchronous Compression operations
  3. *
  4. * Copyright (c) 2016, Intel Corporation
  5. * Authors: Weigang Li <weigang.li@intel.com>
  6. * Giovanni Cabiddu <giovanni.cabiddu@intel.com>
  7. *
  8. * This program is free software; you can redistribute it and/or modify it
  9. * under the terms of the GNU General Public License as published by the Free
  10. * Software Foundation; either version 2 of the License, or (at your option)
  11. * any later version.
  12. *
  13. */
  14. #ifndef _CRYPTO_ACOMP_INT_H
  15. #define _CRYPTO_ACOMP_INT_H
  16. #include <crypto/acompress.h>
  17. /*
  18. * Transform internal helpers.
  19. */
  20. static inline void *acomp_request_ctx(struct acomp_req *req)
  21. {
  22. return req->__ctx;
  23. }
  24. static inline void *acomp_tfm_ctx(struct crypto_acomp *tfm)
  25. {
  26. return tfm->base.__crt_ctx;
  27. }
  28. static inline void acomp_request_complete(struct acomp_req *req,
  29. int err)
  30. {
  31. req->base.complete(&req->base, err);
  32. }
  33. static inline const char *acomp_alg_name(struct crypto_acomp *tfm)
  34. {
  35. return crypto_acomp_tfm(tfm)->__crt_alg->cra_name;
  36. }
  37. /**
  38. * crypto_register_acomp() -- Register asynchronous compression algorithm
  39. *
  40. * Function registers an implementation of an asynchronous
  41. * compression algorithm
  42. *
  43. * @alg: algorithm definition
  44. *
  45. * Return: zero on success; error code in case of error
  46. */
  47. int crypto_register_acomp(struct acomp_alg *alg);
  48. /**
  49. * crypto_unregister_acomp() -- Unregister asynchronous compression algorithm
  50. *
  51. * Function unregisters an implementation of an asynchronous
  52. * compression algorithm
  53. *
  54. * @alg: algorithm definition
  55. *
  56. * Return: zero on success; error code in case of error
  57. */
  58. int crypto_unregister_acomp(struct acomp_alg *alg);
  59. #endif