akcipher.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * Public Key Encryption
  3. *
  4. * Copyright (c) 2015, Intel Corporation
  5. * Authors: Tadeusz Struk <tadeusz.struk@intel.com>
  6. *
  7. * This program is free software; you can redistribute it and/or modify it
  8. * under the terms of the GNU General Public License as published by the Free
  9. * Software Foundation; either version 2 of the License, or (at your option)
  10. * any later version.
  11. *
  12. */
  13. #ifndef _CRYPTO_AKCIPHER_INT_H
  14. #define _CRYPTO_AKCIPHER_INT_H
  15. #include <crypto/akcipher.h>
  16. /*
  17. * Transform internal helpers.
  18. */
  19. static inline void *akcipher_request_ctx(struct akcipher_request *req)
  20. {
  21. return req->__ctx;
  22. }
  23. static inline void *akcipher_tfm_ctx(struct crypto_akcipher *tfm)
  24. {
  25. return tfm->base.__crt_ctx;
  26. }
  27. static inline void akcipher_request_complete(struct akcipher_request *req,
  28. int err)
  29. {
  30. req->base.complete(&req->base, err);
  31. }
  32. static inline const char *akcipher_alg_name(struct crypto_akcipher *tfm)
  33. {
  34. return crypto_akcipher_tfm(tfm)->__crt_alg->cra_name;
  35. }
  36. /**
  37. * crypto_register_akcipher() -- Register public key algorithm
  38. *
  39. * Function registers an implementation of a public key verify algorithm
  40. *
  41. * @alg: algorithm definition
  42. *
  43. * Return: zero on success; error code in case of error
  44. */
  45. int crypto_register_akcipher(struct akcipher_alg *alg);
  46. /**
  47. * crypto_unregister_akcipher() -- Unregister public key algorithm
  48. *
  49. * Function unregisters an implementation of a public key verify algorithm
  50. *
  51. * @alg: algorithm definition
  52. */
  53. void crypto_unregister_akcipher(struct akcipher_alg *alg);
  54. #endif