Questo TPM emulatore seguire TPM spec per estendere registrare PCR?
Domanda
Il seguente codice è da TPM emulatore da Mario Strasser. La specifica dice:
PCR := SHA1(PCR || data)
legge "concatenare il vecchio valore della PCR con i dati, l'hash stringa concatenata e memorizzare l'hash in PCR". Non è né PCR := PCR BITWISE-OR SHA1(data)
PCR := SHA1(PCR BITWISE-OR data)
TPM_RESULT TPM_Extend(TPM_PCRINDEX pcrNum, TPM_DIGEST *inDigest,
TPM_PCRVALUE *outDigest)
{
tpm_sha1_ctx_t ctx;
info("TPM_Extend()");
if (pcrNum >= TPM_NUM_PCR) return TPM_BADINDEX;
if (!(PCR_ATTRIB[pcrNum].pcrExtendLocal & (1 << LOCALITY))) return TPM_BAD_LOCALITY;
/* compute new PCR value as SHA-1(old PCR value || inDigest) */
tpm_sha1_init(&ctx);
tpm_sha1_update(&ctx, PCR_VALUE[pcrNum].digest, sizeof(PCR_VALUE[pcrNum].digest));
tpm_sha1_update(&ctx, inDigest->digest, sizeof(inDigest->digest));
tpm_sha1_final(&ctx, PCR_VALUE[pcrNum].digest);
/* set output digest */
if (tpmData.permanent.flags.disable) {
memset(outDigest->digest, 0, sizeof(*outDigest->digest));
} else {
memcpy(outDigest, &PCR_VALUE[pcrNum], sizeof(TPM_PCRVALUE));
}
return TPM_SUCCESS;
}
Soluzione
Per quanto ne so, sì. Vedere il mio commento in compiere o su due uscite hash di sha1sum
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow