当前位置:网站首页>[tpm2.0 principle and Application guide] Chapter 16, 17 and 18
[tpm2.0 principle and Application guide] Chapter 16, 17 and 18
2022-07-07 19:04:00 【Godams】
The first 16 Chapter Order audit
The audit is responsible for recording in the host and TPM Between TPM Commands and parameters . The host is responsible for maintaining logs , Logs may exist in the host memory or hard disk .TPM Use similar PCR The extended record of records these parameters , Then return a signature summary of the audit log . The recipient of the signature summary can verify the signature , To verify the integrity of the log .
TPM Expand the hash of command and response parameters into an audit summary
16.1 Why audit ?
stay TPM in , The audit is responsible for recording in the host and TPM Between TPM Command and corresponding parameters , And only audit successfully executed orders . The host is responsible for maintaining logs , The log may exist in the memory or disk of the host . When the host saves the actual parameters ,TPM By analogy for PCR To record these parameters . after ,TPM Return a signature summary of the audit log . The recipient of the signature digest can verify the signature , To verify the integrity of the log .
16.3 Types of audit
- Order audit : Responsible for recording all instances of a selected command set , Regardless of the conversation .
- Session audit : Session audit records all commands in a session , Regardless of orders .
A dedicated session allows the receiver to detect whether the audit session is interrupted by an unaudited intervention command . Exclusive sessions can also be used to ensure that there are no intervening commands .
16.4 The audit log
The required steps :
(1) The auditor first reads the list of command and response parameters from an audit log – The storage of logs and the execution of commands are on the host side , Then calculate the hash values of command parameters and response parameters .
(2) Auditors perform a calculation equivalent to expansion – Follow the steps 1 Calculate the hash value of each command and corresponding parameters and add the results to an audit summary .
(3) Verify the digital signature . utilize TPM Signature and a public key pair step 2 Verify the audit summary calculated in .
(4) The auditor returns to a trusted root certificate through a certificate chain , So as to establish trust in the verification public key .
The first 17 Chapter Decrypt and encrypt the session
Decryption and encryption sessions are in connection with TPM Provide confidentiality for sensitive information in the process of exchanging sensitive information
17.1 The role of encrypting and decrypting sessions
Encryption and decryption sessions protect secret information transmitted on insecure media .
The calling program is to protect the confidentiality of data , You can use a call only program and TPM Know the command encryption key to encrypt data . Part of the key is determined by the parameters used to open the session .
A decryption session notification TPM The first parameter is encrypted . It means to be TPM After receiving the parameter , It needs to be decrypted , Therefore, it is named decryption session .
For a response , An encrypted session indicates TPM This parameter has been encrypted before the first response parameter is returned . After receiving the encrypted response parameters , The caller uses the response decryption key to decrypt the data .
17.3 Restrictions on decryption and encryption
Only the first command parameter can be encrypted , And the first command parameter can be decrypted .
17.4 Decryption and encryption settings

17.5 XOR and CFB Patterns and their general processes ?
There are two different symmetric key patterns that can be used to encrypt and decrypt sessions :XOR and CFB.
CFB Mode provides high-strength encryption , But need TPM And calling programs support a hash algorithm and an encryption algorithm .
XOR Only hash algorithm is needed , And it is the right choice for scenarios that require a very small amount of code , But this method is less secure .
When a session begins ,TPM Generate a session key . To use encryption and decryption sessions , The caller needs to generate the session key for the two sessions separately . Unify all processes into one flow , The steps related to the encryption and decryption session life cycle are as follows :
(1) Use Tpm2_startAuthSession Start session , Set the symmetry parameter to
·CFB Pattern :
Symmetric.algorithm=TPM_ALG_AES;
Symmetric.keyBits.aes=128;
Symmetric.mode.aes=TPM_ALG_CFB;
·XOR Pattern :
Symmetric.algorithm=TPM_ALG_XOR;
Symmetric.keyBits.exclusiveOr=TPM_ALG_SHA256;
(2) Generate the session key and save
(3) For a, the first parameter is TPM2B The order of , If you want to encrypt this parameter , You can do the following :
· In order to use this session to generate a Hmac secret key , The session key is also included in the generation process of this key .
· about CFB Pattern :
· Use session hash algorithm 、HMAC secret key 、 Special labels (CFB)、nonceNewer、nonceOlder as well as Encrypted bits to generate encryption key and initial vector IV.
· Use encryption keys and IV Encrypt the first parameter
· about XOR Pattern :
· Use HMAC secret key 、 Session hash algorithm 、nonceNewer、nonceOlder And encrypted bits to generate Mask
· XOR the plaintext data with the mask , Generate encrypted data
· Set up sessionAttributes.decyrpt position
(4) If the first response parameter is TPM2B, And hope TPM Send this parameter in encrypted form , Set up sessionAttributes.encrypt position
(5) Send command to TPM
(6) receive TPM Response returned
(7) If the first response parameter is TPM2B And sessionAttributes.encrypt Has been set up , Follow these steps :
· In order to use this session to generate a Hmac secret key , The session key is also included in the generation process of this key .
· about CFB Pattern :
· Use session hash algorithm 、HMAC secret key 、 Special labels (CFB)、nonceNewer、nonceOlder as well as Decrypted bits to generate decryption key and initial vector IV.
· Use decryption key and IV Encrypt the first parameter
· about XOR Pattern :
· Use HMAC secret key 、 Session hash algorithm 、nonceNewer、nonceOlder And decrypted bits to generate Mask
· XOR ciphertext data with mask , Generate clear text data
The first 18 Chapter Context management

TAB and RM: A higher level description 
TAB:
RM
RM Basic operations that must be performed :
- Virtualize all and TPM Exchange operation
- Maintain tables that record the context of objects and sequences
- For loading into TPM Objects and sequences in , Maintain a virtual handle to TPM Mapping relationship of handle
- For being sent to TPM The order of
Sending to TPM Before , Capture all command byte streams
Check all handles in the authorization domain and handle domain
边栏推荐
- Redis cluster and expansion
- Mathematical analysis_ Notes_ Chapter 11: Fourier series
- [Blue Bridge Cup training 100 questions] sort scratch from small to large. Blue Bridge Cup scratch competition special prediction programming question centralized training simulation exercise question
- UVALive – 4621 Cav 贪心 + 分析「建议收藏」
- 小试牛刀之NunJucks模板引擎
- 静态路由配置
- 高考填志愿规则
- 低代码助力企业数字化转型会让程序员失业?
- How to choose the appropriate automated testing tools?
- AntiSamy:防 XSS 攻击的一种解决方案使用教程
猜你喜欢
随机推荐
How to implement safety practice in software development stage
Learn open62541 -- [67] add custom enum and display name
【软件测试】从企业版BOSS直聘,看求职简历,你没被面上是有原因的
Cloud security daily 220707: Cisco Expressway series and telepresence video communication server have found remote attack vulnerabilities and need to be upgraded as soon as possible
50亿,福建又诞生一只母基金
如何选择合适的自动化测试工具?
Thread pool and singleton mode and file operation
Nat address translation
完整的电商系统
咋吃都不胖的朋友,Nature告诉你原因:是基因突变了
Reuse of data validation framework Apache bval
AntiSamy:防 XSS 攻击的一种解决方案使用教程
I feel cheated. Wechat tests the function of "size number" internally, and two wechat can be registered with the same mobile number
伺服力矩控制模式下的力矩目标值(fTorque)计算
A few simple steps to teach you how to see the K-line diagram
Kirk Borne的本周学习资源精选【点击标题直接下载】
POJ 1182 :食物链(并查集)[通俗易懂]
GSAP animation library
How to choose the appropriate automated testing tools?
Yunjing network technology interview question [Hangzhou multi tester] [Hangzhou multi tester _ Wang Sir]









