cipherpriv.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. * QEMU Crypto cipher driver supports
  3. *
  4. * Copyright (c) 2017 HUAWEI TECHNOLOGIES CO., LTD.
  5. *
  6. * Authors:
  7. * Longpeng(Mike) <longpeng2@huawei.com>
  8. *
  9. * This work is licensed under the terms of the GNU GPL, version 2 or
  10. * (at your option) any later version. See the COPYING file in the
  11. * top-level directory.
  12. *
  13. */
  14. #ifndef QCRYPTO_CIPHERPRIV_H
  15. #define QCRYPTO_CIPHERPRIV_H
  16. #include "qapi/qapi-types-crypto.h"
  17. struct QCryptoCipherDriver {
  18. int (*cipher_encrypt)(QCryptoCipher *cipher,
  19. const void *in,
  20. void *out,
  21. size_t len,
  22. Error **errp);
  23. int (*cipher_decrypt)(QCryptoCipher *cipher,
  24. const void *in,
  25. void *out,
  26. size_t len,
  27. Error **errp);
  28. int (*cipher_setiv)(QCryptoCipher *cipher,
  29. const uint8_t *iv, size_t niv,
  30. Error **errp);
  31. void (*cipher_free)(QCryptoCipher *cipher);
  32. };
  33. #ifdef CONFIG_AF_ALG
  34. #include "afalgpriv.h"
  35. extern QCryptoCipher *
  36. qcrypto_afalg_cipher_ctx_new(QCryptoCipherAlgorithm alg,
  37. QCryptoCipherMode mode,
  38. const uint8_t *key,
  39. size_t nkey, Error **errp);
  40. #endif
  41. #endif