可信平台模块的SPI硬件协议(寻找最小的工作示例)
我正在与 infineon optiga tpm slm 9670 tpm 2.0 通过其SPI接口。
我得到了一些第一个帮助在这里,但是再次挣扎。
对于初学者,我想读出TPM的状态寄存器 href =“ https://trustedcomputinggroup.org/wp-content/uploads/tcg_pc_pc_pc_pc_client_platform_tpm_tpm_profile_ptp_2.0_r1 r1 r1 r1 22name%22%3A%22xyz%22%7D%2C69%2C734%2C0%5D“ rel =“ nofollow noreferrer”>地址为0018H 。
Interpreting the table from the TPM's
0x83 // msb to 1 because I want to read, lower bits to 3 because my xfer consists of 4 bytes
0x00 0x00 0x18 // three register address bytes, naming the register address
当我对4个字节(状态寄存器的大小)进行SPI读取后,我总是会得到ffffffff。
这是预期的还是我做错了什么?
I am making my first steps in communication with an Infineon OPTIGA TPM SLM 9670 TPM 2.0 via its SPI interface.
I got some first help here, but struggling again.
For starters, I would like to read out the TPM's status register, whose address is given as 0018h.
Interpreting the table from the TPM's SPI Hardware Protocol specification (see below), I do an SPI write of the following four bytes:
0x83 // msb to 1 because I want to read, lower bits to 3 because my xfer consists of 4 bytes
0x00 0x00 0x18 // three register address bytes, naming the register address
When I do an SPI read of 4 bytes (size of the status register) afterwards, I always get FFFFFFFF.
Is this expected or am I doing something wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
spi硬件协议规范:
,您必须忘记将地址偏移到0xD4:
示例序列序列
TPM2_GetRandom
注意:这假设Linux内核初始化了TPM,包括已发送TPM2_STARTUP命令。如果您使用Mainline Linux,则无需担心这一点。
图例:
04-> 81
:读取寄存器0x04,读取值为0x8104< - 02
:写入值0x02至getrandom的注册0x04,我有以下序列。用一粒盐来拿这件盐,这只是我在阅读内核驾驶员时的猜测。问号可以检查是否设置了STS寄存器中的有效位(每当读取STS时也可以检查)。
04 - > 81
04< - 02
code> 04-> A1
18-> 44
18-> 44
18-> 44D00700
24< - 80010000000c0000017b00
18-> 8c
24< - 10
18-> 84
18< -20
18-> 94
18-> 94
18-> 941C0000
24-> 80010000001C00000000
18-> 94
18-> 94120000
24-> 0010755F8A5B158E44F5CD2EDF784156EED7
18-> 84
18-> 84
18< - 40
04< - 20
如果您'感兴趣,请参阅驱动程序的这部分。
SPI Hardware Protocol specification:
Basically, you must not forget to offset your address by 0xD4:
Example Sequence
Tpm2_GetRandom
Note: this assumes that the Linux Kernel initialized the TPM, including having sent the Tpm2_Startup command. If you use mainline linux, you do not need to worry about that.
Legend:
04 -> 81
: Read register 0x04, read value is 0x8104 <- 02
: Write value 0x02 to register 0x04For a GetRandom, I have the following sequence. Take that with a grain of salt, that is just my guess when reading the kernel driver. The question marks could be checking that the valid bit in the STS register is set (which is probably also checked whenever STS is read).
04 -> 81
04 <- 02
04 -> A1
18 -> 44
18 -> 44
18 -> 44D00700
24 <- 80010000000C0000017B00
18 -> 8C
24 <- 10
18 -> 84
18 <- 20
18 -> 94
18 -> 94
18 -> 941C0000
24 -> 80010000001C00000000
18 -> 94
18 -> 94120000
24 -> 0010755F8A5B158E44F5CD2EDF784156EED7
18 -> 84
18 -> 84
18 <- 40
04 <- 20
If you're interested, see roughly this part of the driver.