kpp.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. * Key-agreement Protocol Primitives (KPP)
  3. *
  4. * Copyright (c) 2016, Intel Corporation
  5. * Authors: Salvatore Benedetto <salvatore.benedetto@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_KPP_INT_H
  14. #define _CRYPTO_KPP_INT_H
  15. #include <crypto/kpp.h>
  16. #include <crypto/algapi.h>
  17. /*
  18. * Transform internal helpers.
  19. */
  20. static inline void *kpp_request_ctx(struct kpp_request *req)
  21. {
  22. return req->__ctx;
  23. }
  24. static inline void *kpp_tfm_ctx(struct crypto_kpp *tfm)
  25. {
  26. return tfm->base.__crt_ctx;
  27. }
  28. static inline void kpp_request_complete(struct kpp_request *req, int err)
  29. {
  30. req->base.complete(&req->base, err);
  31. }
  32. static inline const char *kpp_alg_name(struct crypto_kpp *tfm)
  33. {
  34. return crypto_kpp_tfm(tfm)->__crt_alg->cra_name;
  35. }
  36. /**
  37. * crypto_register_kpp() -- Register key-agreement protocol primitives algorithm
  38. *
  39. * Function registers an implementation of a key-agreement protocol primitive
  40. * algorithm
  41. *
  42. * @alg: algorithm definition
  43. *
  44. * Return: zero on success; error code in case of error
  45. */
  46. int crypto_register_kpp(struct kpp_alg *alg);
  47. /**
  48. * crypto_unregister_kpp() -- Unregister key-agreement protocol primitive
  49. * algorithm
  50. *
  51. * Function unregisters an implementation of a key-agreement protocol primitive
  52. * algorithm
  53. *
  54. * @alg: algorithm definition
  55. */
  56. void crypto_unregister_kpp(struct kpp_alg *alg);
  57. #endif