cipherpriv.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. typedef struct QCryptoCipherDriver QCryptoCipherDriver;
  18. struct QCryptoCipherDriver {
  19. int (*cipher_encrypt)(QCryptoCipher *cipher,
  20. const void *in,
  21. void *out,
  22. size_t len,
  23. Error **errp);
  24. int (*cipher_decrypt)(QCryptoCipher *cipher,
  25. const void *in,
  26. void *out,
  27. size_t len,
  28. Error **errp);
  29. int (*cipher_setiv)(QCryptoCipher *cipher,
  30. const uint8_t *iv, size_t niv,
  31. Error **errp);
  32. void (*cipher_free)(QCryptoCipher *cipher);
  33. };
  34. #ifdef CONFIG_AF_ALG
  35. #include "afalgpriv.h"
  36. extern QCryptoAFAlg *
  37. qcrypto_afalg_cipher_ctx_new(QCryptoCipherAlgorithm alg,
  38. QCryptoCipherMode mode,
  39. const uint8_t *key,
  40. size_t nkey, Error **errp);
  41. extern struct QCryptoCipherDriver qcrypto_cipher_afalg_driver;
  42. #endif
  43. #endif