qemu/tests/tpm-util.h
<<
>>
Prefs
   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
  19typedef void (tx_func)(QTestState *s,
  20                       const unsigned char *req, size_t req_size,
  21                       unsigned char *rsp, size_t rsp_size);
  22
  23void tpm_util_crb_transfer(QTestState *s,
  24                           const unsigned char *req, size_t req_size,
  25                           unsigned char *rsp, size_t rsp_size);
  26void tpm_util_tis_transfer(QTestState *s,
  27                           const unsigned char *req, size_t req_size,
  28                           unsigned char *rsp, size_t rsp_size);
  29
  30void tpm_util_startup(QTestState *s, tx_func *tx);
  31void tpm_util_pcrextend(QTestState *s, tx_func *tx);
  32void tpm_util_pcrread(QTestState *s, tx_func *tx,
  33                      const unsigned char *exp_resp, size_t exp_resp_size);
  34
  35bool tpm_util_swtpm_has_tpm2(void);
  36
  37gboolean tpm_util_swtpm_start(const char *path, GPid *pid,
  38                              SocketAddress **addr, GError **error);
  39void tpm_util_swtpm_kill(GPid pid);
  40
  41void tpm_util_migrate(QTestState *who, const char *uri);
  42
  43void tpm_util_migration_start_qemu(QTestState **src_qemu,
  44                                   QTestState **dst_qemu,
  45                                   SocketAddress *src_tpm_addr,
  46                                   SocketAddress *dst_tpm_addr,
  47                                   const char *miguri,
  48                                   const char *ifmodel);
  49
  50void tpm_util_wait_for_migration_complete(QTestState *who);
  51
  52#endif /* TESTS_TPM_UTIL_H */
  53