当前位置:网站首页>[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 .
 The actual cases

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

 Insert picture description here

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

 Role of context management
TAB and RM: A higher level description
 transparency
TAB:
TAB A concept of lock is also used
RM
RM function
RM Basic operations that must be performed :

  1. Virtualize all and TPM Exchange operation
  2. Maintain tables that record the context of objects and sequences
  3. For loading into TPM Objects and sequences in , Maintain a virtual handle to TPM Mapping relationship of handle
  4. 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
原网站

版权声明
本文为[Godams]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/188/202207071521205181.html