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 13 #ifndef TESTS_TPM_UTIL_H 14 #define TESTS_TPM_UTIL_H 15 16 #include "qemu/osdep.h" 17 #include "io/channel-socket.h" 18 19 typedef void (tx_func)(QTestState *s, 20 const unsigned char *req, size_t req_size, 21 unsigned char *rsp, size_t rsp_size); 22 23 void tpm_util_crb_transfer(QTestState *s, 24 const unsigned char *req, size_t req_size, 25 unsigned char *rsp, size_t rsp_size); 26 27 void tpm_util_startup(QTestState *s, tx_func *tx); 28 void tpm_util_pcrextend(QTestState *s, tx_func *tx); 29 void tpm_util_pcrread(QTestState *s, tx_func *tx, 30 const unsigned char *exp_resp, size_t exp_resp_size); 31 32 gboolean tpm_util_swtpm_start(const char *path, GPid *pid, 33 SocketAddress **addr, GError **error); 34 void tpm_util_swtpm_kill(GPid pid); 35 36 #endif /* TESTS_TPM_UTIL_H */ 37