⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ps_utils.c

📁 TCG软件栈 linux系统上使用 为可信应用软件提供和 TPM通信的 接口 其网站上有很多关于使用此软件的测试用例
💻 C
字号:
/* * Licensed Materials - Property of IBM * * trousers - An open source TCG Software Stack * * (C) Copyright International Business Machines Corp. 2006 * */#include <stdlib.h>#include <stdio.h>#include <unistd.h>#include <string.h>#include <errno.h>#include "trousers/tss.h"#include "trousers_types.h"#include "tcs_tsp.h"#include "spi_utils.h"#include "tspps.h"#include "tsplog.h"inline TSS_RESULTread_data(int fd, void *data, UINT32 size){	int rc;	rc = read(fd, data, size);	if (rc == -1) {		LogError("read of %d bytes: %s", size, strerror(errno));		return TCSERR(TSS_E_INTERNAL_ERROR);	} else if ((unsigned)rc != size) {		LogError("read of %d bytes (only %d read)", size, rc);		return TCSERR(TSS_E_INTERNAL_ERROR);	}	return TSS_SUCCESS;}inline TSS_RESULTwrite_data(int fd, void *data, UINT32 size){	int rc;	rc = write(fd, data, size);	if (rc == -1) {		LogError("write of %d bytes: %s", size, strerror(errno));		return TCSERR(TSS_E_INTERNAL_ERROR);	} else if ((unsigned)rc != size) {		LogError("write of %d bytes (only %d written)", size, rc);		return TCSERR(TSS_E_INTERNAL_ERROR);	}	return TSS_SUCCESS;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -