调用TPM生成随机数

这篇博客详细介绍了如何通过代码调用TPM( Trusted Platform Module)来生成随机数,包括编译方法和两个关键部分:头文件的引用及具体源文件的实现。
摘要由CSDN通过智能技术生成

本文以代码的方式描述如何调用TPM生成随机数。

编译方式

gcc -Wall -Wextra -std=c99 -g xxx.c -o xxx

1.头文件

#ifndef _ELTT2_H_
#define _ELTT2_H_
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <fcntl.h>
#include <unistd.h>
#include <ctype.h>
//-------------"Defines"-------------
#define ERR_COMMUNICATION		-1	///< Return error check for read and write to the TPM.
#define PRINT_RESPONSE_WITHOUT_HEADER		12	///< Prints the response buffer from byte 12.
static const uint8_t tpm2_getrandom[] = {
   
	0x80, 0x01,			// TPM_ST_NO_SESSIONS
	0x00, 0x00, 0x00, 0x0C,
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值