utils: Use chunk_equals_const() for all cryptographic purposes
This commit is contained in:
@@ -307,7 +307,7 @@ static bool check_boot_aggregate(pts_pcr_t *pcrs, chunk_t measurement,
|
||||
}
|
||||
if (pcr_ok)
|
||||
{
|
||||
success = chunk_equals(boot_aggregate, measurement);
|
||||
success = chunk_equals_const(boot_aggregate, measurement);
|
||||
DBG1(DBG_PTS, "boot aggregate value is %scorrect",
|
||||
success ? "":"in");
|
||||
return success;
|
||||
@@ -693,7 +693,7 @@ METHOD(pts_component_t, verify, status_t,
|
||||
status = FAILED;
|
||||
break;
|
||||
}
|
||||
if (chunk_equals(measurement, hash))
|
||||
if (chunk_equals_const(measurement, hash))
|
||||
{
|
||||
status = SUCCESS;
|
||||
break;
|
||||
@@ -748,7 +748,7 @@ METHOD(pts_component_t, verify, status_t,
|
||||
has_pcr_info = evidence->get_pcr_info(evidence, &pcr_before, &pcr_after);
|
||||
if (has_pcr_info)
|
||||
{
|
||||
if (!chunk_equals(pcr_before, pcrs->get(pcrs, pcr)))
|
||||
if (!chunk_equals_const(pcr_before, pcrs->get(pcrs, pcr)))
|
||||
{
|
||||
DBG1(DBG_PTS, "PCR %2u: pcr_before is not equal to register value",
|
||||
pcr);
|
||||
@@ -876,7 +876,7 @@ METHOD(pts_component_t, destroy, void,
|
||||
DESTROY_IF(this->bios_list);
|
||||
DESTROY_IF(this->ima_list);
|
||||
this->name->destroy(this->name);
|
||||
|
||||
|
||||
free(this);
|
||||
}
|
||||
}
|
||||
@@ -911,4 +911,3 @@ pts_component_t *pts_ita_comp_ima_create(uint32_t depth,
|
||||
|
||||
return &this->public;
|
||||
}
|
||||
|
||||
|
||||
@@ -249,7 +249,7 @@ METHOD(pts_component_t, verify, status_t,
|
||||
has_pcr_info = evidence->get_pcr_info(evidence, &pcr_before, &pcr_after);
|
||||
if (has_pcr_info)
|
||||
{
|
||||
if (!chunk_equals(pcr_before, pcrs->get(pcrs, extended_pcr)))
|
||||
if (!chunk_equals_const(pcr_before, pcrs->get(pcrs, extended_pcr)))
|
||||
{
|
||||
DBG1(DBG_PTS, "PCR %2u: pcr_before is not equal to register value",
|
||||
extended_pcr);
|
||||
@@ -354,4 +354,3 @@ pts_component_t *pts_ita_comp_tboot_create(u_int32_t depth,
|
||||
|
||||
return &this->public;
|
||||
}
|
||||
|
||||
|
||||
@@ -141,7 +141,7 @@ METHOD(pts_component_t, verify, status_t,
|
||||
has_pcr_info = evidence->get_pcr_info(evidence, &pcr_before, &pcr_after);
|
||||
if (has_pcr_info)
|
||||
{
|
||||
if (!chunk_equals(pcr_before, pcrs->get(pcrs, extended_pcr)))
|
||||
if (!chunk_equals_const(pcr_before, pcrs->get(pcrs, extended_pcr)))
|
||||
{
|
||||
DBG1(DBG_PTS, "PCR %2u: pcr_before is not equal to pcr value");
|
||||
}
|
||||
|
||||
@@ -187,7 +187,7 @@ METHOD(pts_database_t, add_file_measurement, status_t,
|
||||
}
|
||||
if (e->enumerate(e, &hash_id, &hash_value))
|
||||
{
|
||||
if (!chunk_equals(measurement, hash_value))
|
||||
if (!chunk_equals_const(measurement, hash_value))
|
||||
{
|
||||
/* update hash measurement value */
|
||||
if (this->db->execute(this->db, &hash_id,
|
||||
@@ -289,7 +289,7 @@ METHOD(pts_database_t, check_comp_measurement, status_t,
|
||||
|
||||
while (e->enumerate(e, &hash))
|
||||
{
|
||||
if (chunk_equals(hash, measurement))
|
||||
if (chunk_equals_const(hash, measurement))
|
||||
{
|
||||
status = SUCCESS;
|
||||
break;
|
||||
|
||||
@@ -133,7 +133,7 @@ METHOD(pts_file_meas_t, check, bool,
|
||||
{
|
||||
while (e->enumerate(e, &hash))
|
||||
{
|
||||
if (chunk_equals(entry->measurement, hash))
|
||||
if (chunk_equals_const(entry->measurement, hash))
|
||||
{
|
||||
status = SUCCESS;
|
||||
break;
|
||||
@@ -223,7 +223,7 @@ METHOD(pts_file_meas_t, verify, bool,
|
||||
}
|
||||
}
|
||||
|
||||
/* no PTS measurement returned for this filename */
|
||||
/* no PTS measurement returned for this filename */
|
||||
if (!found)
|
||||
{
|
||||
success = FALSE;
|
||||
@@ -234,7 +234,7 @@ METHOD(pts_file_meas_t, verify, bool,
|
||||
|
||||
if (found && !match)
|
||||
{
|
||||
if (chunk_equals(measurement, entry->measurement))
|
||||
if (chunk_equals_const(measurement, entry->measurement))
|
||||
{
|
||||
match = TRUE;
|
||||
DBG2(DBG_PTS, " %#B for '%s' is ok",
|
||||
@@ -252,7 +252,7 @@ METHOD(pts_file_meas_t, verify, bool,
|
||||
&entry->measurement, entry->filename);
|
||||
enumerator->destroy(enumerator);
|
||||
}
|
||||
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user