mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2026-06-08 18:14:53 +00:00
DM: tpm emulator to communicate with swtpm
This patch will create control channel and command channel so as to communicate with swtpm. Based on the 2 channels, a set of APIs will be implemented and exposed. Tracked-On: #1924 Signed-off-by: Deng Wei <wei.a.deng@intel.com> Signed-off-by: Qi Yadong <yadong.qi@intel.com> Signed-off-by: yingbinx <yingbinx.zeng@intel.com> Reviewed-by: Zhu Bing <bing.zhu@intel.com> Reviewed-by: Jason Chen CJ <jason.cj.chen@intel.com> Acked-by: Yin Fengwei <fengwei.yin@intel.com>
This commit is contained in:
51
devicemodel/hw/platform/tpm/tpm_internal.h
Normal file
51
devicemodel/hw/platform/tpm/tpm_internal.h
Normal file
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Copyright (C) 2018 Intel Corporation
|
||||
* All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef _TPM_INTERNAL_H_
|
||||
#define _TPM_INTERNAL_H_
|
||||
|
||||
/* TPMCommBuffer will package TPM2 command and
|
||||
* response which are handled by TPM emulator
|
||||
*
|
||||
* locty: the locality TPM emulator used
|
||||
* in & in_len: To indicate the buffer and the
|
||||
* size for TPM command
|
||||
* out & out_len: To indicate the buffer and
|
||||
* the size for TPM response
|
||||
*/
|
||||
typedef struct TPMCommBuffer {
|
||||
uint8_t locty;
|
||||
const uint8_t *in;
|
||||
uint32_t in_len;
|
||||
uint8_t *out;
|
||||
uint32_t out_len;
|
||||
bool selftest_done;
|
||||
} TPMCommBuffer;
|
||||
|
||||
/* APIs by tpm_emulator.c */
|
||||
/* Create Ctrl channel and Cmd channel so as to communicate with SWTPM */
|
||||
int init_tpm_emulator(const char *sock_path);
|
||||
|
||||
/* Shutdown of SWTPM and close Ctrl channel and Cmd channel */
|
||||
void deinit_tpm_emulator(void);
|
||||
|
||||
/* Send Ctrl channel command CMD_GET_TPMESTABLISHED to SWTPM */
|
||||
bool swtpm_get_tpm_established_flag(void);
|
||||
|
||||
/* Send Ctrl channel command CMD_RESET_TPMESTABLISHED to SWTPM */
|
||||
int swtpm_reset_tpm_established_flag(void);
|
||||
|
||||
/* Send TPM2 command request to SWTPM by using Cmd channel */
|
||||
int swtpm_handle_request(TPMCommBuffer *cmd);
|
||||
|
||||
/* Initialization for SWTPM */
|
||||
int swtpm_startup(size_t buffersize);
|
||||
|
||||
/* Cancellation of the current TPM2 command */
|
||||
void swtpm_cancel_cmd(void);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user