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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? keys.c

?? IBM開發(fā)的TPM的驅(qū)動, 有少量的例子可以供參考
?? C
?? 第 1 頁 / 共 3 頁
字號:
/****************************************************************************//*                                                                          *//*                         TPM Key Handling Routines                        *//*                                                                          *//*                           Written by J. Kravitz                          *//*                                                                          *//*                     IBM Thomas J. Watson Research Center                 *//*                                                                          *//*                               Version 2.2                                *//*                                                                          *//*                         Last Revision 15 Sep 2004                        *//*                                                                          *//*                           Copyright (C) 2004 IBM                         *//*                                                                          *//****************************************************************************/#include <stdio.h>#include <stdlib.h>#include <string.h>#include <netinet/in.h>#include <tpm.h>#include <tpmfunc.h>#include <tpmutil.h>#include <tpmkeys.h>#include <oiaposap.h>#include <hmac.h>#include <openssl/rsa.h>#include <openssl/bn.h>/****************************************************************************//*                                                                          *//* Read the TPM Endorsement public key                                      *//*                                                                          *//****************************************************************************/uint32_t TPM_ReadPubek(pubkeydata * k){	unsigned char read_pubek_fmt[] = "00 c1 T 00 00 00 7c %";	unsigned char tpmdata[TPM_MAX_BUFF_SIZE];	unsigned char nonce[TPM_HASH_SIZE];	uint32_t ret;	/* check input argument */	if (k == NULL)		return ERR_NULL_ARG;	/* generate random nonce */	ret = TSS_gennonce(nonce);	if (ret == 0)		return ERR_CRYPT_ERR;	/* copy Read PubKey request template to buffer */	ret = TSS_buildbuff(read_pubek_fmt, tpmdata, TPM_HASH_SIZE, nonce);	if ((ret & ERR_MASK) != 0)		return ret;	ret = TPM_Transmit(tpmdata, "tpm_readpubek");	if (ret)		return ret;	TSS_PubKeyExtract(tpmdata + TPM_DATA_OFFSET, k, 0);	return 0;}/****************************************************************************//*                                                                          *//* Owner Read the TPM Endorsement Key                                       *//*                                                                          *//****************************************************************************/uint32_t TPM_OwnerReadPubek(unsigned char *ownauth, pubkeydata * k){	unsigned char owner_read_ekey_fmt[] = "00 c2 T l l % o %";	uint32_t ret;	unsigned char tpmdata[TPM_MAX_BUFF_SIZE];	unsigned char nonceodd[TPM_NONCE_SIZE];	unsigned char evennonce[TPM_NONCE_SIZE];	unsigned char authdata[TPM_NONCE_SIZE];	unsigned char c;	uint32_t ordinal;	uint32_t authhandle;	int size;	/* generate odd nonce */	TSS_gennonce(nonceodd);	/* Open OIAP Session */	ret = TSS_OIAPopen(&authhandle, evennonce);	if (ret != 0)		return ret;	/* move Network byte order data to variables for hmac calculation */	ordinal = htonl(0x7D);	c = 0;	/* calculate authorization HMAC value */	ret =	    TSS_authhmac(authdata, ownauth, TPM_HASH_SIZE, evennonce,			 nonceodd, c, TPM_U32_SIZE, &ordinal, 0, 0);	if (ret < 0) {		TSS_OIAPclose(authhandle);		return ret;	}	/* build the request buffer */	ret = TSS_buildbuff(owner_read_ekey_fmt, tpmdata,			    ordinal,			    authhandle,			    TPM_NONCE_SIZE, nonceodd,			    c, TPM_HASH_SIZE, authdata);	if ((ret & ERR_MASK) != 0) {		TSS_OIAPclose(authhandle);		return ret;	}	/* transmit the request buffer to the TPM device and read the reply */	ret = TPM_Transmit(tpmdata, "OwnerReadEkey");	if (ret != 0) {		TSS_OIAPclose(authhandle);		return ret;	}	TSS_OIAPclose(authhandle);	size = TSS_PubKeySize(tpmdata + TPM_DATA_OFFSET, 0);	ret =	    TSS_checkhmac1(tpmdata, ordinal, nonceodd, ownauth,			   TPM_HASH_SIZE, size, TPM_DATA_OFFSET, 0, 0);	if (ret != 0)		return ret;	TSS_PubKeyExtract(tpmdata + TPM_DATA_OFFSET, k, 0);	return 0;}/****************************************************************************//*                                                                          *//* Disable Reading of the Public Encorsement Key                            *//*                                                                          *//****************************************************************************/uint32_t TPM_DisableReadPubek(unsigned char *ownauth){	unsigned char disable_ekey_fmt[] = "00 c2 T l l % o %";	uint32_t ret;	unsigned char tpmdata[TPM_MAX_BUFF_SIZE];	unsigned char nonceodd[TPM_NONCE_SIZE];	unsigned char evennonce[TPM_NONCE_SIZE];	unsigned char authdata[TPM_NONCE_SIZE];	unsigned char c;	uint32_t ordinal;	uint32_t authhandle;	/* generate odd nonce */	TSS_gennonce(nonceodd);	/* Open OIAP Session */	ret = TSS_OIAPopen(&authhandle, evennonce);	if (ret != 0)		return ret;	/* move Network byte order data to variables for hmac calculation */	ordinal = htonl(0x7E);	c = 0;	/* calculate authorization HMAC value */	ret =	    TSS_authhmac(authdata, ownauth, TPM_HASH_SIZE, evennonce,			 nonceodd, c, TPM_U32_SIZE, &ordinal, 0, 0);	if (ret < 0) {		TSS_OIAPclose(authhandle);		return ret;	}	/* build the request buffer */	ret = TSS_buildbuff(disable_ekey_fmt, tpmdata,			    ordinal,			    authhandle,			    TPM_NONCE_SIZE, nonceodd,			    c, TPM_HASH_SIZE, authdata);	if ((ret & ERR_MASK) != 0) {		TSS_OIAPclose(authhandle);		return ret;	}	/* transmit the request buffer to the TPM device and read the reply */	ret = TPM_Transmit(tpmdata, "DisableEkey");	if (ret != 0) {		TSS_OIAPclose(authhandle);		return ret;	}	TSS_OIAPclose(authhandle);	ret =	    TSS_checkhmac1(tpmdata, ordinal, nonceodd, ownauth,			   TPM_HASH_SIZE, 0, 0);	if (ret != 0)		return ret;	return 0;}/****************************************************************************//*                                                                          *//* Create and Wrap a Key                                                    *//*                                                                          *//* The arguments are...                                                     *//*                                                                          *//* keyhandle is the handle of the parent key of the new key                 *//*           0x40000000 for the SRK                                         *//* parauth   is the authorization data (password) for the parent key        *//*           if NULL, the default auth data of all zeros is assumed         *//* newauth   is the authorization data (password) for the new key           *//* migauth   is the authorization data (password) for migration of the new  *//*           key, or NULL if the new key is not migratable                  *//*           all authorization values must be 20 bytes long                 *//* keyparms  is a pointer to a keydata structure with parms set for the new *//*           key                                                            *//* key       is a pointer to a keydata structure returned filled in         *//*           with the public key data for the new key, or NULL if no        *//*           keydata is to be returned                                      *//* keyblob   is a pointer to an area which will receive a copy of the       *//*           encrypted key blob.  If NULL no copy is returned               *//* bloblen   is a pointer to an integer which will receive the length of    *//*           the key blob, or NULL if no length is to be returned           *//*                                                                          *//****************************************************************************/uint32_t TPM_CreateWrapKey(uint32_t keyhandle,			   unsigned char *parauth,			   unsigned char *newauth,			   unsigned char *migauth,			   keydata * keyparms,			   keydata * key,			   unsigned char *keyblob, unsigned int *bloblen){	unsigned char create_key_fmt[] = "00 c2 T l l % % % l % o %";	uint32_t ret;	int i;	unsigned char tpmdata[TPM_MAX_BUFF_SIZE];	unsigned char kparmbuf[TPM_MAX_BUFF_SIZE];	osapsess sess;	unsigned char encauth1[TPM_HASH_SIZE];	unsigned char encauth2[TPM_HASH_SIZE];	unsigned char xorwork[TPM_HASH_SIZE * 2];	unsigned char xorhash[TPM_HASH_SIZE];	unsigned char nonceodd[TPM_NONCE_SIZE];	unsigned char pubauth[TPM_HASH_SIZE];	unsigned char dummyauth[TPM_HASH_SIZE];	unsigned char *cparauth;	unsigned char *cnewauth;	unsigned char c;	uint32_t ordinal;	uint32_t keyhndl;	uint16_t keytype;	int kparmbufsize;	memset(dummyauth, 0, sizeof dummyauth);	/* check input arguments */	if (keyparms == NULL)		return ERR_NULL_ARG;	if (parauth == NULL)		cparauth = dummyauth;	else		cparauth = parauth;	if (newauth == NULL)		cnewauth = dummyauth;	else		cnewauth = newauth;	if (keyhandle == 0x40000000)		keytype = 0x0004;	else		keytype = 0x0001;	/* get the TPM version and put into the keyparms structure */	ret =	    TPM_GetCapability(0x00000006, NULL, 0, &(keyparms->version[0]),			      &i);	if (ret != 0)		return ret;	/* generate odd nonce */	TSS_gennonce(nonceodd);	/* Open OSAP Session */	ret = TSS_OSAPopen(&sess, cparauth, keytype, keyhandle);	if (ret != 0)		return ret;	/* calculate encrypted authorization value for new key */	memcpy(xorwork, sess.ssecret, TPM_HASH_SIZE);	memcpy(xorwork + TPM_HASH_SIZE, sess.enonce, TPM_HASH_SIZE);	TSS_sha1(xorwork, TPM_HASH_SIZE * 2, xorhash);	for (i = 0; i < TPM_HASH_SIZE; ++i)		encauth1[i] = xorhash[i] ^ cnewauth[i];	/* calculate encrypted authorization value for migration of new key */	if (migauth != NULL) {		memcpy(xorwork, sess.ssecret, TPM_HASH_SIZE);		memcpy(xorwork + TPM_HASH_SIZE, nonceodd, TPM_HASH_SIZE);		TSS_sha1(xorwork, TPM_HASH_SIZE * 2, xorhash);		for (i = 0; i < TPM_HASH_SIZE; ++i)			encauth2[i] = xorhash[i] ^ migauth[i];	} else		memset(encauth2, 0, TPM_HASH_SIZE);	/* move Network byte order data to variables for hmac calculation */	ordinal = htonl(0x1F);	keyhndl = htonl(keyhandle);	c = 0;	/* convert keyparm structure to buffer */	ret = TPM_BuildKey(kparmbuf, keyparms);	if ((ret & ERR_MASK) != 0) {		TSS_OSAPclose(&sess);		return ret;	}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人自拍视频在线| 26uuu成人网一区二区三区| 午夜视频在线观看一区| 精品国产乱码久久久久久久久| 91丝袜呻吟高潮美腿白嫩在线观看| 蜜桃视频在线观看一区| 亚洲精品国产精品乱码不99| 欧美激情一区在线观看| 久久精品亚洲精品国产欧美 | 亚洲人精品午夜| 久久尤物电影视频在线观看| 成人精品在线视频观看| 91丨porny丨户外露出| 欧美电影免费观看高清完整版| 欧美日韩一区二区在线观看视频| 国产69精品久久久久毛片| 成人小视频在线| 欧美mv日韩mv亚洲| 这里只有精品99re| 欧美精品少妇一区二区三区| 日韩一区二区电影| 国产色婷婷亚洲99精品小说| 久久精品999| 成人丝袜18视频在线观看| 精品理论电影在线观看| 免费人成在线不卡| 国产成人亚洲精品狼色在线| 成人国产精品免费观看视频| 91视频观看视频| 国产精品久久久久久福利一牛影视| 亚洲人成网站精品片在线观看| 国产精品一区二区无线| 欧美mv日韩mv国产网站| 一级精品视频在线观看宜春院| 亚洲狠狠爱一区二区三区| 视频一区中文字幕国产| 国产最新精品精品你懂的| 成人国产精品免费观看动漫| 国产欧美日韩卡一| 亚洲国产一区在线观看| 欧美自拍偷拍午夜视频| 精品不卡在线视频| 国产真实乱偷精品视频免| 精品国产成人在线影院| 国产精品一区一区| 中文字幕一区二区三区不卡在线| 偷拍亚洲欧洲综合| 欧美肥大bbwbbw高潮| 日本不卡视频在线| 国产女人水真多18毛片18精品视频| 国产精品一卡二| 中文字幕一区二区视频| 欧美日韩一区二区在线观看| 免费久久99精品国产| 精品久久五月天| 国产高清一区日本| 欧美大片顶级少妇| 国产一区999| 欧美丝袜丝交足nylons图片| 精品国产一区二区三区av性色| 狠狠色综合日日| 国产精品第13页| 欧美日韩在线播放三区| 美女视频网站久久| 国产精品久久久久久福利一牛影视| 欧美自拍偷拍一区| 国产精品一区在线观看乱码| 亚洲精品免费在线观看| 日韩免费性生活视频播放| 国产精品一级在线| 亚洲成人1区2区| 91欧美一区二区| 麻豆精品在线视频| 亚洲免费av在线| 精品免费国产一区二区三区四区| 不卡av在线免费观看| 男人操女人的视频在线观看欧美| 国产三级三级三级精品8ⅰ区| 在线一区二区三区四区五区| 中文字幕一区二区三区视频| 欧美一区二区大片| 色妞www精品视频| 亚洲精品一区二区三区蜜桃下载| 国产1区2区3区精品美女| 午夜精品一区二区三区三上悠亚| 久久夜色精品国产噜噜av| 欧美亚洲国产一区二区三区| 国产一区在线观看视频| 亚洲午夜免费电影| 国产精品久久毛片av大全日韩| 日韩一区二区三区精品视频| 91麻豆福利精品推荐| 韩日av一区二区| 天天综合天天综合色| 亚洲精品欧美二区三区中文字幕| 国产欧美中文在线| 欧美一区二视频| 欧美日韩中字一区| 欧美亚洲综合另类| 91蝌蚪porny| 99国产精品久久久| 亚洲摸摸操操av| 国产精品情趣视频| 欧洲av一区二区嗯嗯嗯啊| va亚洲va日韩不卡在线观看| 亚洲午夜三级在线| 悠悠色在线精品| 亚洲黄色免费网站| 亚洲视频一区在线| 555www色欧美视频| 欧美日韩国产天堂| 韩国在线一区二区| 韩国女主播成人在线观看| 秋霞影院一区二区| 天天影视涩香欲综合网| 日韩—二三区免费观看av| 国产亚洲成年网址在线观看| 欧美精品一区二区三区在线播放 | 成人福利视频在线| 国产精品综合av一区二区国产馆| 精品一区二区在线看| 国产精品毛片久久久久久| 国产亚洲短视频| 久久久噜噜噜久噜久久综合| 91在线观看美女| 成人网在线免费视频| 丁香五精品蜜臀久久久久99网站| 大美女一区二区三区| 成人激情免费视频| 一本色道久久综合亚洲精品按摩| 在线视频一区二区免费| 91精品国产综合久久精品| 精品国产乱码久久久久久1区2区| 国产日韩av一区| 亚洲欧美一区二区久久| 午夜一区二区三区视频| 蜜臀国产一区二区三区在线播放| 久久国产精品免费| 9l国产精品久久久久麻豆| 91豆麻精品91久久久久久| 欧美一卡二卡三卡| 国产精品人成在线观看免费| 亚洲麻豆国产自偷在线| 日韩高清中文字幕一区| 国产精品亚洲一区二区三区妖精| 成人小视频在线观看| 欧美人狂配大交3d怪物一区| 日韩精品一区二区三区视频| 中文字幕日韩一区| 奇米在线7777在线精品| 成人app软件下载大全免费| 欧美视频精品在线观看| 久久久久国产免费免费| 亚洲综合丁香婷婷六月香| 精品欧美乱码久久久久久| 国产精品日韩精品欧美在线| 亚洲午夜一区二区| 国产91精品一区二区| 欧美撒尿777hd撒尿| 国产女人水真多18毛片18精品视频| 亚洲在线视频网站| 国产一区二区不卡| 久久精子c满五个校花| 激情文学综合网| 95精品视频在线| 日韩视频一区在线观看| 亚洲欧美日韩中文播放| 久久精品国产99| 91久久精品国产91性色tv| www国产精品av| 午夜国产精品影院在线观看| av在线这里只有精品| 久久久久久97三级| 青青草精品视频| 欧洲精品视频在线观看| 综合分类小说区另类春色亚洲小说欧美| 日本亚洲视频在线| 欧美视频完全免费看| 亚洲天堂网中文字| 国产成人无遮挡在线视频| 欧美v国产在线一区二区三区| 亚洲国产精品影院| 91成人在线观看喷潮| 亚洲天堂网中文字| 北岛玲一区二区三区四区| 国产视频一区不卡| 国产成人av一区二区三区在线观看| 欧美日韩国产欧美日美国产精品| 日韩理论片网站| 99国产精品久久久久久久久久| 国产欧美精品国产国产专区 | 精品va天堂亚洲国产| 免费观看30秒视频久久| 欧美蜜桃一区二区三区| 亚洲男同1069视频| 色视频成人在线观看免| 亚洲欧洲综合另类| 色噜噜狠狠成人网p站| 亚洲精品成人少妇| 色综合网站在线|