可信平台模块TPM(Trusted Platform Module)介绍及tpm-tools安装使用

可信平台模块TPM(Trusted Platform Module)是一种植于计算机内部为计算机提供可信根的芯片。该芯片的规格由可信计算组(Trusted Computing Group)来制定。 中国国内研究的TCM(trusted cryptography module,可信密码模块),与之对应。

文献

google开发的一个tpm开源工具。非常好的文档和测试用例。可在网页直接测试。

  • https://google.github.io/tpm-js

微软相关介绍

  • https://docs.microsoft.com/en-us/windows/security/information-protection/tpm/trusted-platform-module-top-node

相关书籍

Intel TPM2 Software Stack (TSS)等安装使用

  • tpm2-tss是根据TCG(Trusted Computing Group)组织定义的TPM2.0的一比一实现。
  • tpm2-abrmd是实现了TPM2 access broker (TAB) & Resource Manager (RM)的守护进程
  • tpm2-tools是命令行工具

检查依赖包:包的依赖关系

tpm2-tools versiontpm2-tss versiontpm2-abrmd version
mastermastermaster
4.2>=2.4.0>=2.3.1

安装TPM工具

具体安装过程及依赖包的安装可参考

  • 安装tss包 https://github.com/tpm2-software/tpm2-tss/blob/master/INSTALL.md
  • 安装abrmd包 https://github.com/tpm2-software/tpm2-abrmd/blob/master/INSTALL.md
  • 安装tools包 https://github.com/tpm2-software/tpm2-tools/blob/master/doc/INSTALL.md

注意,如果没有使用tpm模拟器,文档提到最好不要单元测试,不然对tpm硬件可能造成无法恢复的损伤。

若依然有缺乏的依赖,可以参考如下命令

sudo apt-get install lcov pandoc autoconf-archive
sudo apt-get install liburiparser-dev
sudo apt-get install libdbus-1-dev libglib2.0-dev dbus-x11
sudo apt-get install -y automake
sudo apt install autoconf -y
sudo apt install libtool -y
sudo apt-get install libjson-c-dev -y
sudo apt-get install libcurl3 -y
sudo apt-get install libcurl4 libcurl4-openssl-dev -y
sudo apt-get install -y doxygen
## How Install gio-unix-2.0
sudo apt-get install libglib2.0-dev

abrmd的安装和启动比较麻烦

按照文档,依然失败了很多次,要么dbus报错,要么*abrmd.service没起来,经测试,如下命令可行,下面命令来自参考自TOOLS-INSTALL.md

cd tpm2-abrmd
./bootstrap
./configure --with-dbuspolicydir=/etc/dbus-1/system.d --with-udevrulesdir=/usr/lib/udev/rules.d --with-systemdsystemunitdir=/usr/lib/systemd/system
make -j5
sudo make install

run

如果主板上有TPM,则可以不用模拟器。root权限启动abrmd。
启动前先执行

sudo ldconfig

然后启动

sudo tpm2-abrmd --allow-root  &

hello world

tpm2_pcrread
sha1:
  0 : 0xAAAB2F9467FB088B67F29B5437200FB631E92CC9
  1 : 0xD633C974C89C0B51CED6660BBBBAA7D4313A06D2
  2 : 0xB2A83B0EBF2F8374299A5B2BDFC31EA955AD7236
  3 : 0xB2A83B0EBF2F8374299A5B2BDFC31EA955AD7236
  4 : 0x3B5569D8B67CC4DF6228B9F5F0D24B0547762096
  5 : 0xC6B78F833B5A77B4CA16C72C5636981A08040CEC
  6 : 0xB2A83B0EBF2F8374299A5B2BDFC31EA955AD7236
  7 : 0x6653ABA680BF45C7130D897EA1D8A18FD32CADE6
  8 : 0x0000000000000000000000000000000000000000
  9 : 0x0000000000000000000000000000000000000000
  10: 0x517927AF9D3726175B51C021F190F089CDD186B4
  11: 0x0000000000000000000000000000000000000000
  12: 0x0000000000000000000000000000000000000000
  13: 0x0000000000000000000000000000000000000000
<snip>

如果使用了tpm模拟器

ibmtpm

$ mkdir ibmtpm && cd ibmtpm
$ wget https://sourceforge.net/projects/ibmswtpm2/files/latest/download -O ibmtpm.tar.gz
$ tar -zxvf ibmtpm.tar.gz
$ cd src
$ make -j5

启动模拟器

./tpm_server &
TPM command server listening on port 2321
Platform server listening on port 2322

启动 abrmd

tpm2-abrmd --allow-root --tcti=mssim

测试

tpm2_pcrread
sha1 :
  0  : 0000000000000000000000000000000000000003
  1  : 0000000000000000000000000000000000000000
  2  : 0000000000000000000000000000000000000000
  3  : 0000000000000000000000000000000000000000
  4  : 0000000000000000000000000000000000000000
  5  : 0000000000000000000000000000000000000000
<snip>

tpm2-tools的使用教程在man目录下,github wiki中的教程可能年久失修了。


参考https://github.com/tpm2-software/tpm2-tools/wiki/Getting-Started#installing

  • 4
    点赞
  • 27
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
A Practical Guide to TPM 2.0: Using the Trusted Platform Module in the New Age of Security is a straight-forward primer for developers. It shows security and TPM concepts, demonstrating their use in real applications that the reader can try out. Simply put, this book is designed to empower and excite the programming community to go out and do cool things with the TPM. The approach is to ramp the reader up quickly and keep their interest.A Practical Guide to TPM 2.0: Using the Trusted Platform Module in the New Age of Security explains security concepts, describes the TPM 2.0 architecture, and provides code and pseudo-code examples in parallel, from very simple concepts and code to highly complex concepts and pseudo-code. The book includes instructions for the available execution environments and real code examples to get readers up and talking to the TPM quickly. The authors then help the users expand on that with pseudo-code descriptions of useful applications using the TPM. What you’ll learn TPM 2.0 architecture fundamentals, including changes from TPM 1.2 TPM 2.0 security concepts Essential application development techniques A deep dive into the features of TPM 2.0 A primer on the execution environments available for application development. Learn as you go! Who this book is for Application software developers, OS developers, device-driver developers, and embedded-device specialists, who will benefit from mastering TPM 2.0 capabilities and building their own applications quickly. This book will give them the tools they need to experiment with and understand the technology. Software architects who need to understand the security guarantees provided by TPMs Managers who fund the projects that use TPMs. Non-technical users who may want to know why TPMs are on their computers and how to make use of them.

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值