On 11/9/23 11:39, Hamit Can Karaca wrote: > Hello, > I am a young UEFI developer and I am trying to use the functions in > Tpm2CommandLib to write data to TPM2. I have defined the index that, I > am going to write data to, using the DefineSpace function. But whenever > I am trying to use the Tpm2NvWrite function, I keep getting > EFI_DEVICE_ERROR with a response code 0x1D5. Is there anything to do > before Tpm2NvWrite that I don't know or do I use the wrong parameters? > If anyone has used these functions please let me know, thanks!
I think this should be possible to explain from the TPM2 spec, part 2, "structures". Response code 0x1D5 is binary 111010101. Bit 7 is set, therefore we have to look at the format-1 RC structure: 0001 1 1 010101 ---- - - ------ N F P E N=1 (1-based parameter that the error refers to) F=1 (format-1 response) P=1 (error is associated with a parameter) E=0x15 (error number) In Table 16, RC_FMT1 (value 0x80 -- F bit, or bit 7) says "This bit is SET in all format 1 response codes. The codes in this group may have a value added to them to indicate the handle, session, or parameter to which they apply". Indeed, we have P=1 (error is associated with parameter) and N=1 (1-based parameter number related to the error is 1). Thus, we have TPM_RC_SIZE (= RC_FMT1 + 0x015, 0x95, to which we add P=1 (0x40) and N=1 (0x100) for getting 0x1D5): TPM_RC_SIZE: structure is the wrong size In other words, whatever command you are sending, the TPM seems to reply with "parameter 1 of your command is incorrectly sized". Laszlo -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#111151): https://edk2.groups.io/g/devel/message/111151 Mute This Topic: https://groups.io/mt/102510897/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/leave/9847357/21656/1706620634/xyzzy [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-