2
0

tpm-util.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. * QTest TPM utilities
  3. *
  4. * Copyright (c) 2018 IBM Corporation
  5. *
  6. * Authors:
  7. * Stefan Berger <stefanb@linux.vnet.ibm.com>
  8. *
  9. * This work is licensed under the terms of the GNU GPL, version 2 or later.
  10. * See the COPYING file in the top-level directory.
  11. */
  12. #ifndef TESTS_TPM_UTIL_H
  13. #define TESTS_TPM_UTIL_H
  14. #include "io/channel-socket.h"
  15. typedef void (tx_func)(QTestState *s,
  16. const unsigned char *req, size_t req_size,
  17. unsigned char *rsp, size_t rsp_size);
  18. void tpm_util_crb_transfer(QTestState *s,
  19. const unsigned char *req, size_t req_size,
  20. unsigned char *rsp, size_t rsp_size);
  21. void tpm_util_tis_transfer(QTestState *s,
  22. const unsigned char *req, size_t req_size,
  23. unsigned char *rsp, size_t rsp_size);
  24. void tpm_util_startup(QTestState *s, tx_func *tx);
  25. void tpm_util_pcrextend(QTestState *s, tx_func *tx);
  26. void tpm_util_pcrread(QTestState *s, tx_func *tx,
  27. const unsigned char *exp_resp, size_t exp_resp_size);
  28. bool tpm_util_swtpm_has_tpm2(void);
  29. gboolean tpm_util_swtpm_start(const char *path, GPid *pid,
  30. SocketAddress **addr, GError **error);
  31. void tpm_util_swtpm_kill(GPid pid);
  32. void tpm_util_migrate(QTestState *who, const char *uri);
  33. void tpm_util_migration_start_qemu(QTestState **src_qemu,
  34. QTestState **dst_qemu,
  35. SocketAddress *src_tpm_addr,
  36. SocketAddress *dst_tpm_addr,
  37. const char *miguri,
  38. const char *ifmodel);
  39. void tpm_util_wait_for_migration_complete(QTestState *who);
  40. #endif /* TESTS_TPM_UTIL_H */