libimcv: migrate pts to tpm_tss

This commit is contained in:
Andreas Steffen
2016-06-22 15:33:44 +02:00
parent 8301dc859c
commit 30d4989aec
12 changed files with 576 additions and 500 deletions
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2011-2012 Sansar Choinyambuu, Andreas Steffen
* Copyright (C) 2011-2012 Sansar Choinyambuu
* Copyright (C) 2011-2016 Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
@@ -424,7 +425,7 @@ bool imc_attestation_process(pa_tnc_attr_t *attr, imc_msg_t *msg,
pts_meas_algorithms_t comp_hash_algorithm;
pts_comp_evidence_t *evid;
chunk_t pcr_composite, quote_sig;
bool use_quote2;
bool use_quote2, use_version_info;
/* Send cached Component Evidence entries */
while (attestation_state->next_evidence(attestation_state, &evid))
@@ -434,16 +435,22 @@ bool imc_attestation_process(pa_tnc_attr_t *attr, imc_msg_t *msg,
}
use_quote2 = lib->settings->get_bool(lib->settings,
"%s.plugins.imc-attestation.use_quote2", TRUE,
lib->ns);
if (!pts->quote_tpm(pts, use_quote2, &pcr_composite, &quote_sig))
"%s.plugins.imc-attestation.use_quote2",
TRUE, lib->ns);
use_version_info = lib->settings->get_bool(lib->settings,
"%s.plugins.imc-attestation.use_version_info",
FALSE, lib->ns);
if (!pts->quote_tpm(pts, use_quote2, use_version_info,
&pcr_composite, &quote_sig))
{
DBG1(DBG_IMC, "error occurred during TPM quote operation");
return FALSE;
}
/* Send Simple Evidence Final attribute */
flags = use_quote2 ? PTS_SIMPLE_EVID_FINAL_QUOTE_INFO2 :
flags = use_quote2 ? (use_version_info ?
PTS_SIMPLE_EVID_FINAL_QUOTE_INFO2_CAP_VER :
PTS_SIMPLE_EVID_FINAL_QUOTE_INFO2) :
PTS_SIMPLE_EVID_FINAL_QUOTE_INFO;
comp_hash_algorithm = PTS_MEAS_ALGO_SHA1;
@@ -217,7 +217,12 @@ static TNC_Result receive_msg(private_imv_attestation_agent_t *this,
DBG1(DBG_IMV, "received TCG-PTS error '%N'",
pts_error_code_names, error_code.type);
DBG1(DBG_IMV, "error information: %B", &msg_info);
fatal_error = TRUE;
/* TPM 2.0 doesn't return TPM Version Information */
if (error_code.type != TCG_PTS_TPM_VERS_NOT_SUPPORTED)
{
fatal_error = TRUE;
}
}
break;
}