ivgenpriv.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * QEMU Crypto block IV generator
  3. *
  4. * Copyright (c) 2015-2016 Red Hat, Inc.
  5. *
  6. * This library is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 2.1 of the License, or (at your option) any later version.
  10. *
  11. * This library is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public
  17. * License along with this library; if not, see <http://www.gnu.org/licenses/>.
  18. *
  19. */
  20. #ifndef QCRYPTO_IVGENPRIV_H
  21. #define QCRYPTO_IVGENPRIV_H
  22. #include "crypto/ivgen.h"
  23. typedef struct QCryptoIVGenDriver QCryptoIVGenDriver;
  24. struct QCryptoIVGenDriver {
  25. int (*init)(QCryptoIVGen *ivgen,
  26. const uint8_t *key, size_t nkey,
  27. Error **errp);
  28. int (*calculate)(QCryptoIVGen *ivgen,
  29. uint64_t sector,
  30. uint8_t *iv, size_t niv,
  31. Error **errp);
  32. void (*cleanup)(QCryptoIVGen *ivgen);
  33. };
  34. struct QCryptoIVGen {
  35. QCryptoIVGenDriver *driver;
  36. void *private;
  37. QCryptoIVGenAlgorithm algorithm;
  38. QCryptoCipherAlgorithm cipher;
  39. QCryptoHashAlgorithm hash;
  40. };
  41. #endif /* QCRYPTO_IVGENPRIV_H */