At the TPM layer, the value to be extended must be exactly 20 bytes.

I found this in the mailing list.  I wonder if the code was fixed but 
that the documentation is still wrong.  It looks like they removed the 
double hash, so you have to send 20 bytes.

~~

   Note that trousers-0.2.8's implementation of Tspi_TPM_PcrExtend is
wrong, it has been updated to be correct in CVS, which will become
0.2.9.

~~
   If no PCR event structure is passed to Tspi_TPM_PcrExtend, the data
passed to it will be sent directly to the TPM, without modification
(meaning that anything but 20 bytes will get you TSS_E_BAD_PARAMETER).
  If there is a PCR event structure passed to Tspi_TPM_PcrExtend, the
TSS will create a hash value using the data passed in and fields of
the PCR event structure, like this: SHA1(ulPcrIndex | pbPcrData |
pPcrEvent->eventType | pPcrEvent->rgbEvent).  That hash will then be
sent to the TPM and TCS_LogPcrEvent will be called to add the event to
the log.
~~

   True, the trousers 0.2.8 mistakenly re-hashes the input to
Tspi_TPM_PcrExtend. This is fixed in CVS though...

On 6/9/2015 11:21 PM, Massimo Gaggiano wrote:
> ..no error if pcrEvent != NULL and data size != 20.
>
> Is this regular?
>
> ------------------------------------------------------------------------
> Da: Massimo Gaggiano <mailto:[email protected]>
> Inviato: ‎08/‎06/‎2015 01:27
> A: [email protected]
> <mailto:[email protected]>
> Oggetto: [TrouSerS-users] PcrExtend() explanation
>
> Hi all,
> I use IBM Software TPM.
>
> If the param 'pPcrEvent' is NULL I get the error 3003 "Bad parameter"
> when extending with data size different than 20.
> (No error with "12345678901234567890")
>
> Is there something I'm ignoring?
>
> Thank you very much.
> Max
>
> Here is my code in summary:
>
> const char *data = "s";
> UINT32 dataLen = strlen(data);
> Tspi_TPM_PcrExtend(hTPM, pcrIndex, dataLen, (BYTE *)data, NULL, \
>                                            &pcrValueLen, &pcrValue);




------------------------------------------------------------------------------
_______________________________________________
TrouSerS-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/trousers-users

Reply via email to