added the IMV_ATTESTATION_STATE_NONCE_REQ state

This commit is contained in:
Andreas Steffen
2011-11-28 14:39:50 +01:00
parent 325704e1b4
commit 03fe2ed684
2 changed files with 38 additions and 44 deletions
@@ -81,11 +81,6 @@ static pts_creds_t *pts_creds;
*/ */
static credential_manager_t *pts_credmgr; static credential_manager_t *pts_credmgr;
/**
* TRUE if DH Nonce Parameters Request attribute is sent
*/
static bool dh_nonce_req_sent = FALSE;
/** /**
* see section 3.7.1 of TCG TNC IF-IMV Specification 1.2 * see section 3.7.1 of TCG TNC IF-IMV Specification 1.2
*/ */
@@ -236,13 +231,12 @@ static TNC_Result send_message(TNC_ConnectionID connection_id)
msg = pa_tnc_msg_create(); msg = pa_tnc_msg_create();
/* Jump to Measurement state if IMC has no TPM */ if (handshake_state == IMV_ATTESTATION_STATE_NONCE_REQ &&
if (handshake_state == IMV_ATTESTATION_STATE_TPM_INIT &&
!(pts->get_proto_caps(pts) & PTS_PROTO_CAPS_T)) !(pts->get_proto_caps(pts) & PTS_PROTO_CAPS_T))
{ {
DBG1(DBG_IMV, "PTS-IMC has no TPM capability - "
"advancing to PTS measurement phase");
handshake_state = IMV_ATTESTATION_STATE_MEAS; handshake_state = IMV_ATTESTATION_STATE_MEAS;
DBG3(DBG_IMV, "TPM is not available on IMC side, ",
"jumping to measurement phase");
} }
/* Switch on the attribute type IMV has received */ /* Switch on the attribute type IMV has received */
@@ -264,12 +258,10 @@ static TNC_Result send_message(TNC_ConnectionID connection_id)
msg->add_attribute(msg, attr); msg->add_attribute(msg, attr);
attestation_state->set_handshake_state(attestation_state, attestation_state->set_handshake_state(attestation_state,
IMV_ATTESTATION_STATE_TPM_INIT); IMV_ATTESTATION_STATE_NONCE_REQ);
break; break;
} }
case IMV_ATTESTATION_STATE_TPM_INIT: case IMV_ATTESTATION_STATE_NONCE_REQ:
{
if (!dh_nonce_req_sent)
{ {
int min_nonce_len; int min_nonce_len;
@@ -280,9 +272,12 @@ static TNC_Result send_message(TNC_ConnectionID connection_id)
supported_dh_groups); supported_dh_groups);
attr->set_noskip_flag(attr, TRUE); attr->set_noskip_flag(attr, TRUE);
msg->add_attribute(msg, attr); msg->add_attribute(msg, attr);
dh_nonce_req_sent = TRUE;
attestation_state->set_handshake_state(attestation_state,
IMV_ATTESTATION_STATE_TPM_INIT);
break;
} }
else case IMV_ATTESTATION_STATE_TPM_INIT:
{ {
pts_meas_algorithms_t selected_algorithm; pts_meas_algorithms_t selected_algorithm;
chunk_t initiator_value, initiator_nonce; chunk_t initiator_value, initiator_nonce;
@@ -307,8 +302,6 @@ static TNC_Result send_message(TNC_ConnectionID connection_id)
attestation_state->set_handshake_state(attestation_state, attestation_state->set_handshake_state(attestation_state,
IMV_ATTESTATION_STATE_MEAS); IMV_ATTESTATION_STATE_MEAS);
}
break; break;
} }
case IMV_ATTESTATION_STATE_MEAS: case IMV_ATTESTATION_STATE_MEAS:
@@ -556,7 +549,7 @@ TNC_Result TNC_IMV_ReceiveMessage(TNC_IMVID imv_id,
} }
attr_list->destroy(attr_list); attr_list->destroy(attr_list);
if (attestation_state->get_handshake_state(attestation_state) & if (attestation_state->get_handshake_state(attestation_state) ==
IMV_ATTESTATION_STATE_END) IMV_ATTESTATION_STATE_END)
{ {
if (attestation_state->get_request_count(attestation_state)) if (attestation_state->get_request_count(attestation_state))
@@ -34,6 +34,7 @@ typedef enum imv_attestation_handshake_state_t imv_attestation_handshake_state_t
*/ */
enum imv_attestation_handshake_state_t { enum imv_attestation_handshake_state_t {
IMV_ATTESTATION_STATE_INIT, IMV_ATTESTATION_STATE_INIT,
IMV_ATTESTATION_STATE_NONCE_REQ,
IMV_ATTESTATION_STATE_TPM_INIT, IMV_ATTESTATION_STATE_TPM_INIT,
IMV_ATTESTATION_STATE_MEAS, IMV_ATTESTATION_STATE_MEAS,
IMV_ATTESTATION_STATE_COMP_EVID, IMV_ATTESTATION_STATE_COMP_EVID,