DBG2(DBG_PTS, "nonce length is %d", nonce_len);
nonce = this->is_imc ? &this->responder_nonce : &this->initiator_nonce;
chunk_free(nonce);
- rng->allocate_bytes(rng, nonce_len, nonce);
+ if (!rng->allocate_bytes(rng, nonce_len, nonce))
+ {
+ DBG1(DBG_PTS, "failed to allocate nonce");
+ rng->destroy(rng);
+ return FALSE;
+ }
rng->destroy(rng);
-
return TRUE;
}
DBG3(DBG_PTS, "PCR %d extended with: %B", pcr_num, &input);
DBG3(DBG_PTS, "PCR %d value after extend: %B", pcr_num, output);
-
+
chunk_clear(&pcr_value);
Tspi_Context_FreeMemory(hContext, NULL);
Tspi_Context_Close(hContext);
err:
DBG1(DBG_PTS, "TPM not available: tss error 0x%x", result);
-
+
chunk_clear(&pcr_value);
Tspi_Context_FreeMemory(hContext, NULL);
Tspi_Context_Close(hContext);
-
+
return FALSE;
}
{
i++;
f = 1;
- }
+ }
if (this->pcr_select[i] & f)
{
result = use_quote2 ?
"unable to construct TPM Quote Info2");
return FALSE;
}
-
+
/**
* A TPM v1.2 has 24 PCR Registers
* so the bitmask field length used by TrouSerS is at least 3 bytes
*/
size_of_select = max(PCR_MAX_NUM / 8, 1 + this->pcr_max / 8);
pcr_comp_len = 2 + size_of_select + 4 + this->pcr_count * this->pcr_len;
-
+
writer = bio_writer_create(pcr_comp_len);
writer->write_uint16(writer, size_of_select);
{
writer->write_uint8(writer, this->pcr_select[i]);
}
-
+
/* TPM Locality Selection */
writer->write_uint8(writer, TPM_LOC_ZERO);
{
strcpy(buf, str_debian);
pos += strlen(str_debian);
- len -= strlen(str_debian);
+ len -= strlen(str_debian);
}
fseek(file, 0, SEEK_END);