亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? tcgbios.c

?? xen 3.2.2 源碼
?? C
?? 第 1 頁 / 共 3 頁
字號:
/* *  Implementation of the TCG BIOS extension according to the specification *  described in *  https://www.trustedcomputinggroup.org/specs/PCClient/TCG_PCClientImplementationforBIOS_1-20_1-00.pdf * *  This library is free software; you can redistribute it and/or *  modify it under the terms of the GNU Lesser General Public *  License as published by the Free Software Foundation; either *  version 2 of the License, or (at your option) any later version. * *  This library is distributed in the hope that it will be useful, *  but WITHOUT ANY WARRANTY; without even the implied warranty of *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU *  Lesser General Public License for more details. * *  You should have received a copy of the GNU Lesser General Public *  License along with this library; if not, write to the Free Software *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA * * Copyright (C) IBM Corporation, 2006 * * Author: Stefan Berger <stefanb@us.ibm.com> */#include "rombios_compat.h"#include "tpm_drivers.h"#include "tcgbios.h"#include "32bitprotos.h"#include "util.h"/* local structure and variables */struct ptti_cust {	uint16_t    ipblength;	uint16_t    reserved;	uint16_t    opblength;	uint16_t    reserved2;	uint8_t     tpmoperandin[18];} __attribute__((packed));struct ptti_cust CMD_TPM_Startup_0x01_IPB = {    0x8+0xc, 0x00, 4+10, 0x00,    { 0x00, 0xc1, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x99, 0x00, 0x01 },};struct ptti_cust CMD_TSC_PhysicalPresence_0x20_IPB = {    0x8+0xc, 0x00, 4+10, 0x00,    { 0x00, 0xc1, 0x00, 0x00, 0x00, 0x0c, 0x40, 0x00, 0x00, 0x0a, 0x00, 0x20 },};struct ptti_cust CMD_TSC_PhysicalPresence_0x08_IPB = {    0x8+0xc, 0x00, 4+10, 0x00,    { 0x00, 0xc1, 0x00, 0x00, 0x00, 0x0c, 0x40, 0x00, 0x00, 0x0a, 0x00, 0x08 },};struct ptti_cust CMD_TSC_PhysicalPresence_0x100_IPB = {    0x8+0xc, 0x00, 4+10, 0x00,    { 0x00, 0xc1, 0x00, 0x00, 0x00, 0x0c, 0x40, 0x00, 0x00, 0x0a, 0x01, 0x00 },};struct ptti_cust CMD_TSC_PhysicalPresence_0x10_IPB = {    0x8+0xc, 0x00, 4+10, 0x00,    { 0x00, 0xc1, 0x00, 0x00, 0x00, 0x0c, 0x40, 0x00, 0x00, 0x0a, 0x00, 0x10 },};struct ptti_cust CMD_TPM_PhysicalEnable_IPB = {    0x8+0xa, 0x00, 4+10, 0x00,    { 0x00, 0xc1, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x6f },};struct ptti_cust CMD_TPM_PhysicalSetDeactivated_0x00_IPB = {    0x8+0xb, 0x00, 4+10, 0x00,    { 0x00, 0xc1, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x72, 0x00 }};struct ptti_cust CMD_TPM_SHA1Start_IPB = {    0x8+0xa, 0x00, 4+10, 0x00,    { 0x00, 0xc1, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0xa0 },};struct ptti_cust CMD_TPM_GetCap_Version_IPB = {    0x8+0x12, 0x00, 4+18, 0x00,    {0x00, 0xc1, 0x00, 0x00, 0x00, 0x12,     0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00 },};struct ptti_cust *TCG_CommandList[] = {	&CMD_TPM_Startup_0x01_IPB,	&CMD_TSC_PhysicalPresence_0x20_IPB,	&CMD_TSC_PhysicalPresence_0x08_IPB,	&CMD_TSC_PhysicalPresence_0x100_IPB,	&CMD_TSC_PhysicalPresence_0x10_IPB,	&CMD_TPM_PhysicalEnable_IPB,	&CMD_TPM_PhysicalSetDeactivated_0x00_IPB,	&CMD_TPM_SHA1Start_IPB,};/* local function prototypes */static void sha1(const unsigned char *data, uint32_t length,                 unsigned char *hash);static uint32_t TCG_ShutdownPreBootInterface(uint32_t ebx);static uint32_t HashAll32(struct hai *hai, unsigned char *hash,                          uint32_t magic, uint32_t ecx, uint32_t edx);static uint32_t HashLogExtendEvent32(struct hleei_short *hleei_s,                                     struct hleeo *hleeo,                                     uint32_t magic, uint32_t ecx,                                     uint32_t edx);static uint32_t HashLogEvent32(struct hlei *hlei, struct hleo *hleo,                               uint32_t ebx, uint32_t ecx, uint32_t edx);static uint32_t PassThroughToTPM32(struct pttti *pttti, struct pttto *pttto,                                   uint32_t magic, uint32_t ecx, uint32_t edx);static uint32_t MA_Transmit(unsigned char *cmdbuffer,                            unsigned char *respbuffer,                            uint32_t respbufferlen);static unsigned char *tcpa_get_lasa_last_ptr(void);static unsigned char *tcpa_get_lasa_base_ptr(void);static void tcpa_reset_acpi_log(void);static uint32_t tcpa_get_laml(void);extern struct tpm_driver tpm_drivers[];/* utility functions */static inline uint32_t bswap(uint32_t a){	return ( ( a >> 24 ) & 0x000000ff) |	       ( ( a >> 8  ) & 0x0000ff00) |	       ( ( a << 8  ) & 0x00ff0000) |	       ( ( a << 24 ) & 0xff000000);}/********************************************************  Extensions for TCG-enabled BIOS *******************************************************/typedef struct {	struct acpi_20_tcpa *tcpa_ptr;	unsigned char       *lasa_last_ptr;	uint16_t            entry_count;	uint16_t            flags;} tcpa_acpi_t;static tcpa_acpi_t tcpa_acpi;/* low level driver implementation */static int tpm_driver_to_use = TPM_INVALID_DRIVER;staticuint32_t MA_IsTPMPresent(void){	uint32_t rc = 0;	unsigned int i;	for (i = 0; i < TPM_NUM_DRIVERS; i++) {		struct tpm_driver *td = &tpm_drivers[i];		if (td->probe(td->baseaddr) != 0) {			tpm_driver_to_use = i;			rc = 1;			break;		}	}	return rc;}staticuint32_t MA_InitTPM(uint16_t startupcode){	uint32_t rc = 0;	/* low-level initialize the TPM */	unsigned char command[sizeof(CMD_TPM_Startup_0x01_IPB.tpmoperandin)];	unsigned char response[10];	uint32_t response_size = sizeof(response);	memcpy(command,	       CMD_TPM_Startup_0x01_IPB.tpmoperandin,	       sizeof(CMD_TPM_Startup_0x01_IPB.tpmoperandin));	command[10] = (startupcode >> 8) & 0xff;	command[11] = (startupcode >> 0) & 0xff;	rc = MA_Transmit(command, response, response_size);	return rc;}staticuint32_t MA_Transmit(unsigned char *cmdbuffer, unsigned char *respbuffer,                     uint32_t respbufferlen){	uint32_t rc = 0;	uint32_t irc;	struct tpm_driver *td;	if (tpm_driver_to_use == TPM_INVALID_DRIVER)		return TCG_FATAL_COM_ERROR;	td = &tpm_drivers[tpm_driver_to_use];	if (rc == 0) {		irc = td->activate(td->baseaddr);		if (irc == 0) {			/* tpm could not be activated */			rc = TCG_FATAL_COM_ERROR;		}	}	if (rc == 0) {		uint32_t *tmp = (uint32_t *)&cmdbuffer[2];		uint32_t len = bswap(*tmp);		irc = td->senddata(td->baseaddr,		                   cmdbuffer,		                   len);		if (irc != 0) {			rc = TCG_FATAL_COM_ERROR;		}	}	if (rc == 0) {		irc = td->waitdatavalid(td->baseaddr);		if (irc != 0) {			rc = TCG_FATAL_COM_ERROR;		}	}	if (rc == 0) {		irc = td->waitrespready(td->baseaddr, 2000);		if (irc != 0) {			rc = TCG_FATAL_COM_ERROR;		}	}	if (rc == 0) {		irc = td->readresp(td->baseaddr,		                   respbuffer,		                   respbufferlen);		if (irc != 0) {			rc = TCG_FATAL_COM_ERROR;		}	}	if (rc == 0) {		irc = td->ready(td->baseaddr);	}	return rc;}staticuint8_t acpi_validate_entry(struct acpi_header *hdr){	uint8_t sum = 0;	unsigned int length = hdr->length;	unsigned int ctr;	unsigned char *addr = (unsigned char *)hdr;	for (ctr = 0; ctr < length; ctr++)		sum += addr[ctr];	return sum;}/* * Search for the RSDP ACPI table in the memory starting at addr and * ending at addr + len - 1. */static struct acpi_20_rsdp *find_rsdp(const void *start, unsigned int len){	char *rsdp = (char *)start;	char *end = rsdp + len;	/* scan memory in steps of 16 bytes */	while (rsdp < end) {		/* check for expected string */		if (!strncmp( rsdp, "RSD PTR ", 8))			return (struct acpi_20_rsdp *)rsdp;		rsdp += 0x10;	}	return 0;}void tcpa_acpi_init(void){	struct acpi_20_rsdt *rsdt;	struct acpi_20_tcpa *tcpa = (void *)0;	struct acpi_20_rsdp *rsdp;	uint32_t length;	uint16_t off;	int found = 0;	uint16_t ebda_seg;	if (MA_IsTPMPresent() == 0) {		return;	}	/* RSDP in EBDA? */	ebda_seg = *(uint16_t *)ADDR_FROM_SEG_OFF(0x40, 0xe);	rsdp = find_rsdp((void *)(ebda_seg << 16), 1024);	if (!rsdp)		rsdp = find_rsdp((void *)(ACPI_SEGMENT << 4), 0x20000);	if (rsdp) {		uint32_t ctr = 0;		/* get RSDT from RSDP */		rsdt   = (struct acpi_20_rsdt *)rsdp->rsdt_address;		length = rsdt->header.length;		off = 36;		while ((off + 3) < length) {			/* try all pointers to structures */			tcpa = (struct acpi_20_tcpa *)rsdt->entry[ctr];			/* valid TCPA ACPI table ? */			if (ACPI_2_0_TCPA_SIGNATURE == tcpa->header.signature			    && acpi_validate_entry(&tcpa->header) == 0) {				found = 1;				break;			}			off += 4;			ctr++;		}	}	if (found == 0) {		printf("TCPA ACPI was NOT found!\n");		tcpa = 0;	}	tcpa_acpi.tcpa_ptr = tcpa;	tcpa_acpi.lasa_last_ptr = 0;	tcpa_acpi.entry_count = 0;	tcpa_acpi.flags = 0;	tcpa_reset_acpi_log();}/* clear the ACPI log */static void tcpa_reset_acpi_log(void){	unsigned char *lasa = tcpa_get_lasa_base_ptr();	if (lasa)		memset(lasa, 0x0, tcpa_get_laml());}uint32_t tcpa_extend_acpi_log(uint32_t entry_ptr){	uint32_t res = 0;	unsigned char *lasa_last = tcpa_get_lasa_last_ptr();	unsigned char *lasa_base = tcpa_get_lasa_base_ptr();	uint32_t size;	uint16_t entry_count = tcpa_acpi.entry_count;	struct pcpes *pcpes = (struct pcpes *)entry_ptr;	if (lasa_last == 0) {		lasa_last = lasa_base;	} else {		struct pcpes *pcpes = (struct pcpes *)lasa_last;		/* skip the last entry in the log */		size = pcpes->eventdatasize;		size += 32;		lasa_last += size;	}	if (lasa_last == 0) {		res = ((uint32_t)TCG_PC_LOGOVERFLOW << 16);	}	if (res == 0) {		uint32_t laml = tcpa_get_laml();		size = pcpes->eventdatasize;		size += 32;		if ((lasa_last + size - lasa_base) > laml) {			res = (TCG_PC_LOGOVERFLOW << 16);		}	}	if (res == 0) {		/* copy the log entry into the ACPI log */		memcpy((char *)lasa_last, (char *)entry_ptr, size);		/*		 * update the pointers and entry counter that were modified		 * due to the new entry in the log		 */		tcpa_acpi.lasa_last_ptr = lasa_last;		entry_count++;		tcpa_acpi.entry_count = entry_count;		res = entry_count;	}	return res;}staticunsigned char *tcpa_get_lasa_last_ptr(void){	return tcpa_acpi.lasa_last_ptr;}staticunsigned char *tcpa_get_lasa_base_ptr(void){	unsigned char *lasa = 0;	struct acpi_20_tcpa *tcpa = tcpa_acpi.tcpa_ptr;	if (tcpa != 0) {		uint32_t class = tcpa->platform_class;		if (class == TCPA_ACPI_CLASS_CLIENT) {			/* client type */			lasa = (unsigned char *)(long)tcpa->u.client.lasa;		} else if (class == TCPA_ACPI_CLASS_SERVER) {			/* server type */			lasa = (unsigned char *)(long)tcpa->u.server.lasa;		}	}	return lasa;}staticuint32_t tcpa_get_laml(void){	uint32_t laml = 0;	struct acpi_20_tcpa *tcpa = tcpa_acpi.tcpa_ptr;	if (tcpa != 0) {		uint32_t class = tcpa->platform_class;		if (class == TCPA_ACPI_CLASS_CLIENT) {			/* client type */			laml = tcpa->u.client.laml;		} else if (class == TCPA_ACPI_CLASS_SERVER) {			laml = tcpa->u.server.laml;		}	}	return laml;}/* * Add a measurement to the log; the data at data_seg:data/length are * appended to the TCG_PCClientPCREventStruct * * Input parameters: *  pcrIndex   : which PCR to extend *  event_type : type of event; specs 10.4.1 *  event_id   : (unused) *  data       : pointer to the data (i.e., string) to be added to the log *  length     : length of the data */static uint16_ttcpa_add_measurement_to_log(uint32_t pcrIndex,                            uint32_t event_type,                            uint32_t event_id,                            const char *data_ptr,                            uint32_t length){	uint32_t rc = 0;	struct hleei_short hleei;	struct hleeo hleeo;	uint8_t _pcpes[32+400];	struct pcpes *pcpes = (struct pcpes *)_pcpes;	uint8_t *data = (uint8_t *)data_ptr;	if (length < sizeof(_pcpes)-32) {		memset(pcpes, 0x0, 32);		pcpes->pcrindex   = pcrIndex;		pcpes->eventtype = event_type;		pcpes->eventdatasize = length;		memcpy(&_pcpes[32], data, length);		hleei.ipblength = 0x18;		hleei.reserved  = 0x0;		hleei.hashdataptr = (uint32_t)&_pcpes[32];		hleei.hashdatalen = length;		hleei.pcrindex    = pcrIndex;		hleei.logdataptr  = (uint32_t)_pcpes;		hleei.logdatalen  = length + 32;		rc = HashLogExtendEvent32(&hleei,		                          &hleeo,			                  TCG_MAGIC,		                          0x0,		                          0x0);	} else {		rc = (TCG_PC_TPMERROR |		      ((uint32_t)TCG_GENERAL_ERROR << 16));	}	return rc;}staticuint16_t tcpa_add_pcpes_to_log(struct pcpes *pcpes){	uint32_t rc = 0;	struct hleei_short hleei;	struct hleeo hleeo;	hleei.ipblength = 0x18;	hleei.reserved  = 0x0;	hleei.hashdataptr = 0;	hleei.hashdatalen = 0;	hleei.pcrindex    = pcpes->pcrindex;	hleei.logdataptr  = (uint32_t)pcpes;	hleei.logdatalen  = sizeof(pcpes);	rc = HashLogExtendEvent32(&hleei,	                          &hleeo,		                  TCG_MAGIC,	                          0x0,	                          0x0);	return rc;}/* * Add a measurement to the log; further description of the data * that are to be hashed are NOT appended to the TCG_PCClientPCREventStruc. * Input parameters:

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
一本色道综合亚洲| 国产精品久久久久久久午夜片| 亚洲国产欧美在线| 欧美视频在线观看一区二区| 亚洲成人在线观看视频| 91精品国产免费久久综合| 日本不卡一二三区黄网| 欧美第一区第二区| 高清视频一区二区| 亚洲制服丝袜av| 91精品国产综合久久久蜜臀粉嫩| 久久精品久久久精品美女| 精品国产乱码久久久久久老虎| 国产精品亚洲人在线观看| 国产精品美女久久久久久| 日本精品免费观看高清观看| 9i在线看片成人免费| 成人禁用看黄a在线| k8久久久一区二区三区| 91蝌蚪porny| 777色狠狠一区二区三区| 日韩一区二区三区在线视频| 国产欧美日韩综合精品一区二区| 国产精品久久久久久久久图文区| 午夜精品影院在线观看| 国产曰批免费观看久久久| 色美美综合视频| 91精品免费在线观看| 国产精品国产三级国产aⅴ入口 | 日韩三级精品电影久久久| 日韩av一级电影| 视频在线观看一区二区三区| 国精产品一区一区三区mba视频 | 亚洲精品你懂的| 欧美精品日韩综合在线| 国产精品一区二区不卡| 亚洲视频 欧洲视频| 日韩欧美一区二区在线视频| jizz一区二区| 蜜臀av亚洲一区中文字幕| 欧美剧在线免费观看网站| 久久精品一区二区三区av| 亚洲一区二区三区视频在线 | 亚洲色图自拍偷拍美腿丝袜制服诱惑麻豆 | 精品亚洲国内自在自线福利| 91麻豆精品国产91| 国产日韩欧美精品综合| 欧美片网站yy| 97aⅴ精品视频一二三区| 美女久久久精品| 一区二区激情小说| 国产精品沙发午睡系列990531| 久久精品网站免费观看| 日韩一区二区免费视频| 欧洲日韩一区二区三区| 99久久综合色| 成人性生交大合| 韩国欧美国产一区| 日韩高清在线一区| 亚洲精品成人精品456| 国产欧美一区二区精品性| 精品国产免费人成电影在线观看四季 | 久久精品国产澳门| 婷婷开心久久网| 亚洲一线二线三线久久久| 亚洲欧美日韩在线| 国产精品三级在线观看| 久久品道一品道久久精品| 欧美一区二区女人| 欧美肥胖老妇做爰| 欧美写真视频网站| 欧美三片在线视频观看| 91精品1区2区| 在线观看日韩电影| 欧美性大战久久久久久久蜜臀| 91国在线观看| 欧美午夜一区二区| 欧美精品日韩综合在线| 欧美一区二区在线不卡| 日韩免费观看高清完整版 | 国产欧美一区二区精品秋霞影院| 精品国产不卡一区二区三区| 精品久久人人做人人爽| 精品国产亚洲一区二区三区在线观看| 日韩欧美一区二区免费| 欧美一区二区私人影院日本| 欧洲精品在线观看| 国产综合久久久久久久久久久久 | 亚洲欧美偷拍另类a∨色屁股| 亚洲精品在线免费播放| 欧美视频日韩视频| 丁香啪啪综合成人亚洲小说| 久久丁香综合五月国产三级网站| 综合欧美亚洲日本| 久久精品人人做人人综合 | 国产乱子轮精品视频| 亚洲超碰97人人做人人爱| 国产精品九色蝌蚪自拍| 性欧美大战久久久久久久久| 国产精品久久久一本精品| 91.成人天堂一区| 日韩高清一区二区| 亚洲欧美一区二区三区孕妇| 黑人巨大精品欧美一区| 欧美视频一区二| 欧美日韩高清一区| 欧美嫩在线观看| 精品国产一区二区亚洲人成毛片| 国产亚洲精品精华液| 伊人婷婷欧美激情| av在线综合网| 在线免费观看日本一区| 日韩一级完整毛片| 国产午夜一区二区三区| 亚洲精品中文在线观看| 日本欧美久久久久免费播放网| 成人性生交大合| 一本色道久久综合亚洲精品按摩 | 国产高清成人在线| 国产成人日日夜夜| 在线观看视频91| 精品免费视频一区二区| 日韩精品一区二区三区视频播放 | 国产欧美一区二区在线观看| 亚洲免费毛片网站| 国产成人精品网址| 亚洲一区二区三区小说| 国产女人18毛片水真多成人如厕 | 久久精品二区亚洲w码| 99久久综合色| 欧美成人一区二区三区在线观看| 亚洲人成精品久久久久久| 久久99这里只有精品| 欧美在线视频全部完| 久久久久9999亚洲精品| 亚洲国产aⅴ成人精品无吗| 本田岬高潮一区二区三区| 欧美精品一区男女天堂| 首页国产欧美久久| 欧美性猛交xxxx黑人交| 中文字幕一区二区三区四区不卡| 麻豆视频观看网址久久| 欧美亚洲高清一区| 中文字幕免费观看一区| 精品写真视频在线观看| 欧美一区二区三区视频| 亚洲一区二区综合| 99国产精品视频免费观看| 久久久久久久久久久久电影| 日韩专区在线视频| 欧美性猛交一区二区三区精品| 亚洲免费视频中文字幕| 99re这里只有精品6| 欧美激情在线观看视频免费| 狠狠网亚洲精品| 26uuu精品一区二区三区四区在线| 午夜精品一区在线观看| 欧美老肥妇做.爰bbww| 亚洲制服欧美中文字幕中文字幕| 91美女在线观看| 国产精品传媒在线| 成人sese在线| 国产精品黄色在线观看| 成人精品小蝌蚪| 国产精品久久三| 91丝袜高跟美女视频| 中文字幕亚洲在| av欧美精品.com| 有坂深雪av一区二区精品| 色综合一个色综合| 亚洲欧美另类在线| 欧美三级中文字幕在线观看| 亚洲综合一二区| 欧美精品久久天天躁| 日韩黄色片在线观看| 欧美一级黄色片| 国产又黄又大久久| 欧美激情综合五月色丁香小说| 成人小视频在线| 玉足女爽爽91| 51午夜精品国产| 韩国精品主播一区二区在线观看 | 日韩精品一区二区三区视频| 国产成人a级片| 麻豆成人av在线| 同产精品九九九| 亚洲免费在线看| 亚洲男人的天堂av| 久久美女艺术照精彩视频福利播放| 色狠狠av一区二区三区| 国产在线精品视频| 久久成人av少妇免费| 香蕉av福利精品导航| 一区二区免费看| 五月天婷婷综合| 亚洲午夜精品一区二区三区他趣| 中文字幕在线观看一区| 国产亚洲综合av| 国产欧美一区二区三区鸳鸯浴 | 午夜av一区二区|