}
/* check the IMV state for the next PA-TNC attributes to send */
- if (!imv_attestation_build(out_msg, attestation_state,
- this->supported_algorithms,
- this->supported_dh_groups, this->pts_db))
+ if (!imv_attestation_build(out_msg, state, this->supported_algorithms,
+ this->supported_dh_groups, this->pts_db))
{
state->set_recommendation(state,
TNC_IMV_ACTION_RECOMMENDATION_NO_RECOMMENDATION,
#include <utils/debug.h>
bool imv_attestation_build(imv_msg_t *out_msg,
- imv_attestation_state_t *attestation_state,
+ imv_state_t *state,
pts_meas_algorithms_t supported_algorithms,
pts_dh_group_t supported_dh_groups,
pts_database_t *pts_db)
{
+ imv_attestation_state_t *attestation_state;
imv_attestation_handshake_state_t handshake_state;
pts_t *pts;
pa_tnc_attr_t *attr = NULL;
+ attestation_state = (imv_attestation_state_t*)state;
handshake_state = attestation_state->get_handshake_state(attestation_state);
pts = attestation_state->get_pts(attestation_state);
+ /**
+ * Received a response form the Attestation IMC so we can proceeed
+ */
+ if (handshake_state == IMV_ATTESTATION_STATE_DISCOVERY &&
+ (state->get_action_flags(state) & IMV_ATTESTATION_FLAG_ALGO))
+ {
+ handshake_state = IMV_ATTESTATION_STATE_NONCE_REQ;
+ }
+
/**
* Skip DH Nonce Parameters Request attribute when
* DH Nonce Exchange is not selected by PTS-IMC side
out_msg->add_attribute(out_msg, attr);
attestation_state->set_handshake_state(attestation_state,
- IMV_ATTESTATION_STATE_NONCE_REQ);
+ IMV_ATTESTATION_STATE_DISCOVERY);
break;
}
+ case IMV_ATTESTATION_STATE_DISCOVERY:
+ break;
case IMV_ATTESTATION_STATE_NONCE_REQ:
{
int min_nonce_len;
* Process a TCG PTS attribute
*
* @param out_msg outbound PA-TNC message to be built
- * @param attestation_state attestation state of a given connection
+ * @param _state state of a given connection
* @param supported_algorithms supported PTS measurement algorithms
* @param supported_dh_groups supported DH groups
* @param pts_db PTS configuration database
* @return TRUE if successful
*/
bool imv_attestation_build(imv_msg_t *out_msg,
- imv_attestation_state_t *attestation_state,
+ imv_state_t *state,
pts_meas_algorithms_t supported_algorithms,
pts_dh_group_t supported_dh_groups,
pts_database_t *pts_db);
*/
enum imv_attestation_handshake_state_t {
IMV_ATTESTATION_STATE_INIT,
+ IMV_ATTESTATION_STATE_DISCOVERY,
IMV_ATTESTATION_STATE_NONCE_REQ,
IMV_ATTESTATION_STATE_TPM_INIT,
IMV_ATTESTATION_STATE_COMP_EVID,