当前位置: 首页>>代码示例>>C++>>正文


C++ TSS_buildbuff函数代码示例

本文整理汇总了C++中TSS_buildbuff函数的典型用法代码示例。如果您正苦于以下问题:C++ TSS_buildbuff函数的具体用法?C++ TSS_buildbuff怎么用?C++ TSS_buildbuff使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了TSS_buildbuff函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: TPM_WriteKey

uint32_t TPM_WriteKey(struct tpm_buffer * buffer, keydata * k)
{
    uint16_t filler = 0;
    uint32_t ret;

    if (k->v.tag == TPM_TAG_KEY12)
	ret = TSS_buildbuff(FORMAT_TPM_KEY12_EMB_RSA, buffer,
			    PARAMS_TPM_KEY12_EMB_RSA_W(k));
    else
	ret = TSS_buildbuff(FORMAT_TPM_KEY_EMB_RSA, buffer,
			    PARAMS_TPM_KEY_EMB_RSA_W(k));
    return ret;
}
开发者ID:cmjonze,项目名称:rpm5_tarballs,代码行数:13,代码来源:serialize.c

示例2: TPM_WriteQuoteInfo

uint32_t TPM_WriteQuoteInfo(struct tpm_buffer *buffer, TPM_QUOTE_INFO * info)
{
	uint32_t ret = 0;
	ret = TSS_buildbuff(FORMAT_TPM_QUOTE_INFO, buffer,
	                    PARAMS_TPM_QUOTE_INFO_W(info));
	return ret;
}
开发者ID:liuersong,项目名称:828-ibmswtpm-fork,代码行数:7,代码来源:serialize.c

示例3: TPM_WriteDelegateOwnerBlob

uint32_t TPM_WriteDelegateOwnerBlob(struct tpm_buffer *buffer, TPM_DELEGATE_OWNER_BLOB * blob)
{
	uint32_t ret;
	ret = TSS_buildbuff(FORMAT_TPM_DELEGATE_OWNER_BLOB, buffer,
	                    PARAMS_TPM_DELEGATE_OWNER_BLOB_W(blob));
	return ret;
}
开发者ID:liuersong,项目名称:828-ibmswtpm-fork,代码行数:7,代码来源:serialize.c

示例4: TPM_WriteDelegatePublic

uint32_t TPM_WriteDelegatePublic(struct tpm_buffer *buffer, TPM_DELEGATE_PUBLIC * pub)
{
	uint32_t ret;
	ret = TSS_buildbuff(FORMAT_TPM_DELEGATE_PUBLIC,buffer,
	                      PARAMS_TPM_DELEGATE_PUBLIC_W(pub));
	return ret;
}
开发者ID:liuersong,项目名称:828-ibmswtpm-fork,代码行数:7,代码来源:serialize.c

示例5: TPM_WriteStoreAsymkey

uint32_t TPM_WriteStoreAsymkey(struct tpm_buffer *buffer, TPM_STORE_ASYMKEY * sak)
{
	uint32_t ret;
	ret = TSS_buildbuff(FORMAT_TPM_STORE_ASYMKEY, buffer,
	                      PARAMS_TPM_STORE_ASYMKEY_W(sak));
	return ret;
}
开发者ID:liuersong,项目名称:828-ibmswtpm-fork,代码行数:7,代码来源:serialize.c

示例6: TPM_WriteStoredData

uint32_t TPM_WriteStoredData(struct tpm_buffer *buffer, TPM_STORED_DATA *sd)
{
	uint32_t ret;
	ret = TSS_buildbuff(FORMAT_TPM_STORED_DATA, buffer,
	                     PARAMS_TPM_STORED_DATA_W(sd));
	return ret;
}
开发者ID:liuersong,项目名称:828-ibmswtpm-fork,代码行数:7,代码来源:serialize.c

示例7: TPM_SHA1CompleteExtend

uint32_t TPM_SHA1CompleteExtend(void *data, uint32_t datalen,
                                uint32_t pcrNum,
                                unsigned char * hash,
                                unsigned char * pcrValue) 
{
	uint32_t ordinal_no;
	uint32_t pcrNum_no = htonl(pcrNum);
	uint32_t ret;
	STACK_TPM_BUFFER(tpmdata)

	/* move Network byte order data to varaible for hmac calcualtion */
	ordinal_no = htonl(TPM_ORD_SHA1CompleteExtend);

	TSS_buildbuff("00 c1 T l l @", &tpmdata,
	                       ordinal_no,
	                         pcrNum_no,
	                           datalen, data);

	/* transmit the request buffer to the TPM device and read the reply */
	ret = TPM_Transmit(&tpmdata,"SHA1CompleteExtend");

	if (0 != ret) {
		return ret;
	}
	
	memcpy(hash, 
	       &tpmdata.buffer[TPM_DATA_OFFSET],
	       TPM_HASH_SIZE);
	       
	memcpy(pcrValue,
	       &tpmdata.buffer[TPM_DATA_OFFSET + TPM_HASH_SIZE],
	       TPM_HASH_SIZE);

	return ret;
}
开发者ID:Jnig,项目名称:tpm-luks,代码行数:35,代码来源:sha.c

示例8: TPM_SHA1Update

uint32_t TPM_SHA1Update(void * data, uint32_t datalen) {
	uint32_t ordinal_no;
	uint32_t ret;
	struct tpm_buffer *tpmdata = TSS_AllocTPMBuffer(datalen+20);
	/* move Network byte order data to variable for hmac calcualtion */
	ordinal_no = htonl(TPM_ORD_SHA1Update);
	
	if (NULL == tpmdata) {
		return ERR_BAD_SIZE;
	}

	ret = TSS_buildbuff("00 c1 T l @", tpmdata,
	                             ordinal_no,
	                               datalen, data);
	if (ret & ERR_MASK) {
		goto err_exit;
	}
	/* transmit the request buffer to the TPM device and read the reply */
	ret = TPM_Transmit(tpmdata,"SHA1Update");

err_exit:	
	TSS_FreeTPMBuffer(tpmdata);

	return ret;
}
开发者ID:Jnig,项目名称:tpm-luks,代码行数:25,代码来源:sha.c

示例9: TPM_DirRead

uint32_t TPM_DirRead(uint32_t dirIndex,
                     unsigned char * dirValueBuffer) 
{
	uint32_t ret;
	uint32_t ordinal_no = htonl(TPM_ORD_DirRead);
	STACK_TPM_BUFFER(tpmdata)
	uint32_t dirIndex_no = htonl(dirIndex);
	
	ret = TSS_buildbuff("00 c1 T l l",&tpmdata,
	                             ordinal_no,
	                               dirIndex_no);
	if ((ret & ERR_MASK)) {
		return ret;
	}
	
	ret = TPM_Transmit(&tpmdata,"DirRead");
	
	if (ret != 0) {
		return ret;
	}

	if (tpmdata.used != 30) {
		ret = ERR_BAD_RESP;
	}

	if (NULL != dirValueBuffer) {
		memcpy(dirValueBuffer, 
		       &tpmdata.buffer[TPM_DATA_OFFSET], 
		       20);
	}
	
	return ret;
}
开发者ID:Jnig,项目名称:tpm-luks,代码行数:33,代码来源:dir.c

示例10: TPM_LoadKeyContext

uint32_t TPM_LoadKeyContext(struct tpm_buffer *context,
                            uint32_t *keyhandle)
{
	uint32_t ret;
	uint32_t ordinal_no = htonl(TPM_ORD_LoadKeyContext);
	STACK_TPM_BUFFER(tpmdata);

	ret = TSS_buildbuff("00 c1 T l @",&tpmdata,
	                             ordinal_no,
	                               context->used, context->buffer);
	if ((ret & ERR_MASK) != 0) {
		return ret;
	}
	
	ret = TPM_Transmit(&tpmdata,"LoadKeyContext");
	
	if (ret != 0) {
		return ret;
	}
	
	ret = tpm_buffer_load32(&tpmdata, TPM_DATA_OFFSET, keyhandle);
	if ((ret & ERR_MASK)) {
		return ret;
	}
	
	return ret;
}
开发者ID:liuersong,项目名称:828-ibmswtpm-fork,代码行数:27,代码来源:context.c

示例11: TPM_LoadAuthContext

uint32_t TPM_LoadAuthContext(unsigned char *authContextBlob, uint32_t authContextSize,
                             uint32_t *authhandle)
{
	uint32_t ret;
	uint32_t ordinal_no = htonl(TPM_ORD_LoadAuthContext);
	STACK_TPM_BUFFER(tpmdata);

	ret = TSS_buildbuff("00 c1 T l @",&tpmdata,
	                             ordinal_no,
	                               authContextSize, authContextBlob);
	if ( ( ret & ERR_MASK ) != 0) {
		return ret;
	}
	
	ret = TPM_Transmit(&tpmdata,"LoadAuthContext");
	
	if (ret != 0) {
		return ret;
	}
	
	ret = tpm_buffer_load32(&tpmdata, TPM_DATA_OFFSET, authhandle);
	if ((ret & ERR_MASK)) {
		return ret;
	}
	
	return ret;
}
开发者ID:liuersong,项目名称:828-ibmswtpm-fork,代码行数:27,代码来源:context.c

示例12: TPM_WriteContextBlob

uint32_t TPM_WriteContextBlob(struct tpm_buffer *buffer, TPM_CONTEXT_BLOB * context)
{
	uint32_t ret;
	ret = TSS_buildbuff(FORMAT_TPM_CONTEXT_BLOB, buffer,
	                      PARAMS_TPM_CONTEXT_BLOB_W(context));
	return ret;
}
开发者ID:liuersong,项目名称:828-ibmswtpm-fork,代码行数:7,代码来源:serialize.c

示例13: TPM_WriteSymmetricKey

uint32_t TPM_WriteSymmetricKey(struct tpm_buffer *buffer, TPM_SYMMETRIC_KEY * key)
{
	uint32_t ret;
	ret = TSS_buildbuff(FORMAT_TPM_SYMMETRIC_KEY, buffer, 
	                    PARAMS_TPM_SYMMETRIC_KEY_W(key));
	return ret;
}
开发者ID:liuersong,项目名称:828-ibmswtpm-fork,代码行数:7,代码来源:serialize.c

示例14: TPM_GetRandom

uint32_t TPM_GetRandom(uint32_t bytesreq,
                       unsigned char * buffer, uint32_t * bytesret)
{
	uint32_t ret;
	STACK_TPM_BUFFER( tpmdata )
	
	uint32_t ordinal_no = htonl(TPM_ORD_GetRandom);
	uint32_t numbytes_no = htonl(bytesreq);

	TSS_buildbuff("00 c1 T l l",&tpmdata,
	                       ordinal_no,
	                         numbytes_no);

	ret = TPM_Transmit(&tpmdata,"GetRandom");

	if (0 != ret) {
		return ret;
	}
	
	ret = tpm_buffer_load32(&tpmdata, TPM_DATA_OFFSET, bytesret);
	if ((ret & ERR_MASK)) {
		return ret;
	}
	memcpy(buffer,
	       &tpmdata.buffer[TPM_DATA_OFFSET + TPM_U32_SIZE],
	       *bytesret);
	
	return ret;
}
开发者ID:Jnig,项目名称:tpm-luks,代码行数:29,代码来源:rng.c

示例15: TPM_Extend

uint32_t TPM_Extend(uint32_t pcrIndex,
                    unsigned char * event,
                    unsigned char * outDigest) {
	uint32_t ret;
	uint32_t ordinal_no = htonl(TPM_ORD_Extend);
	uint32_t pcrIndex_no = htonl(pcrIndex);
	STACK_TPM_BUFFER(tpmdata)
	
	ret = TSS_buildbuff("00 c1 T l l %",&tpmdata,
	                             ordinal_no,
	                               pcrIndex_no,
	                                 TPM_HASH_SIZE, event);
	if ((ret & ERR_MASK)) {
		return ret;
	}
	
	ret = TPM_Transmit(&tpmdata,"Extend");
	
	if (0 != ret) {
		return ret;
	}
	
	if (NULL != outDigest) {
		memcpy(outDigest, 
		       &tpmdata.buffer[TPM_DATA_OFFSET], 
		       TPM_HASH_SIZE);
	}
	
	return ret;
}
开发者ID:osresearch,项目名称:tpmtotp,代码行数:30,代码来源:pcrs.c


注:本文中的TSS_buildbuff函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。