implemented IMC/IMV ReceiveMessageLong functions

This commit is contained in:
Andreas Steffen
2011-12-09 23:32:30 +01:00
parent ac3331e1cd
commit 54f53f9081
11 changed files with 467 additions and 128 deletions
@@ -55,7 +55,7 @@ static pts_meas_algorithms_t supported_algorithms = PTS_MEAS_ALGO_NONE;
static pts_dh_group_t supported_dh_groups = PTS_DH_GROUP_NONE;
/**
* see section 3.7.1 of TCG TNC IF-IMC Specification 1.2
* see section 3.8.1 of TCG TNC IF-IMC Specification 1.3
*/
TNC_Result TNC_IMC_Initialize(TNC_IMCID imc_id,
TNC_Version min_version,
@@ -90,7 +90,7 @@ TNC_Result TNC_IMC_Initialize(TNC_IMCID imc_id,
}
/**
* see section 3.7.2 of TCG TNC IF-IMC Specification 1.2
* see section 3.8.2 of TCG TNC IF-IMC Specification 1.3
*/
TNC_Result TNC_IMC_NotifyConnectionChange(TNC_IMCID imc_id,
TNC_ConnectionID connection_id,
@@ -121,7 +121,7 @@ TNC_Result TNC_IMC_NotifyConnectionChange(TNC_IMCID imc_id,
/**
* see section 3.7.3 of TCG TNC IF-IMC Specification 1.2
* see section 3.8.3 of TCG TNC IF-IMC Specification 1.3
*/
TNC_Result TNC_IMC_BeginHandshake(TNC_IMCID imc_id,
TNC_ConnectionID connection_id)
@@ -165,14 +165,14 @@ TNC_Result TNC_IMC_BeginHandshake(TNC_IMCID imc_id,
return result;
}
/**
* see section 3.7.4 of TCG TNC IF-IMC Specification 1.2
*/
TNC_Result TNC_IMC_ReceiveMessage(TNC_IMCID imc_id,
static TNC_Result receive_message(TNC_IMCID imc_id,
TNC_ConnectionID connection_id,
TNC_BufferReference msg,
TNC_UInt32 msg_len,
TNC_MessageType msg_type)
TNC_UInt32 msg_flags,
chunk_t msg,
TNC_VendorID msg_vid,
TNC_MessageSubtype msg_subtype,
TNC_UInt32 src_imv_id,
TNC_UInt32 dst_imc_id)
{
pa_tnc_msg_t *pa_tnc_msg;
pa_tnc_attr_t *attr;
@@ -196,9 +196,8 @@ TNC_Result TNC_IMC_ReceiveMessage(TNC_IMCID imc_id,
attestation_state = (imc_attestation_state_t*)state;
/* parse received PA-TNC message and automatically handle any errors */
result = imc_attestation->receive_message(imc_attestation, connection_id,
chunk_create(msg, msg_len), msg_type,
&pa_tnc_msg);
result = imc_attestation->receive_message(imc_attestation, state, msg,
msg_vid, msg_subtype, src_imv_id, dst_imc_id, &pa_tnc_msg);
/* no parsed PA-TNC attributes available if an error occurred */
if (!pa_tnc_msg)
@@ -278,7 +277,44 @@ TNC_Result TNC_IMC_ReceiveMessage(TNC_IMCID imc_id,
}
/**
* see section 3.7.5 of TCG TNC IF-IMC Specification 1.2
* see section 3.8.4 of TCG TNC IF-IMC Specification 1.3
*/
TNC_Result TNC_IMC_ReceiveMessage(TNC_IMCID imc_id,
TNC_ConnectionID connection_id,
TNC_BufferReference msg,
TNC_UInt32 msg_len,
TNC_MessageType msg_type)
{
TNC_VendorID msg_vid;
TNC_MessageSubtype msg_subtype;
msg_vid = msg_type >> 8;
msg_subtype = msg_type & TNC_SUBTYPE_ANY;
return receive_message(imc_id, connection_id, 0, chunk_create(msg, msg_len),
msg_vid, msg_subtype, 0, TNC_IMCID_ANY);
}
/**
* see section 3.8.6 of TCG TNC IF-IMV Specification 1.3
*/
TNC_Result TNC_IMC_ReceiveMessageLong(TNC_IMCID imc_id,
TNC_ConnectionID connection_id,
TNC_UInt32 msg_flags,
TNC_BufferReference msg,
TNC_UInt32 msg_len,
TNC_VendorID msg_vid,
TNC_MessageSubtype msg_subtype,
TNC_UInt32 src_imv_id,
TNC_UInt32 dst_imc_id)
{
return receive_message(imc_id, connection_id, msg_flags,
chunk_create(msg, msg_len), msg_vid, msg_subtype,
src_imv_id, dst_imc_id);
}
/**
* see section 3.8.7 of TCG TNC IF-IMC Specification 1.3
*/
TNC_Result TNC_IMC_BatchEnding(TNC_IMCID imc_id,
TNC_ConnectionID connection_id)
@@ -292,7 +328,7 @@ TNC_Result TNC_IMC_BatchEnding(TNC_IMCID imc_id,
}
/**
* see section 3.7.6 of TCG TNC IF-IMC Specification 1.2
* see section 3.8.8 of TCG TNC IF-IMC Specification 1.3
*/
TNC_Result TNC_IMC_Terminate(TNC_IMCID imc_id)
{
@@ -311,7 +347,7 @@ TNC_Result TNC_IMC_Terminate(TNC_IMCID imc_id)
}
/**
* see section 4.2.8.1 of TCG TNC IF-IMC Specification 1.2
* see section 4.2.8.1 of TCG TNC IF-IMC Specification 1.3
*/
TNC_Result TNC_IMC_ProvideBindFunction(TNC_IMCID imc_id,
TNC_TNCC_BindFunctionPointer bind_function)
@@ -73,7 +73,7 @@ static pts_creds_t *pts_creds;
static credential_manager_t *pts_credmgr;
/**
* see section 3.7.1 of TCG TNC IF-IMV Specification 1.2
* see section 3.8.1 of TCG TNC IF-IMV Specification 1.3
*/
TNC_Result TNC_IMV_Initialize(TNC_IMVID imv_id,
TNC_Version min_version,
@@ -139,7 +139,7 @@ TNC_Result TNC_IMV_Initialize(TNC_IMVID imv_id,
}
/**
* see section 3.7.2 of TCG TNC IF-IMV Specification 1.2
* see section 3.8.2 of TCG TNC IF-IMV Specification 1.3
*/
TNC_Result TNC_IMV_NotifyConnectionChange(TNC_IMVID imv_id,
TNC_ConnectionID connection_id,
@@ -197,14 +197,14 @@ static TNC_Result send_message(TNC_ConnectionID connection_id)
return result;
}
/**
* see section 3.7.3 of TCG TNC IF-IMV Specification 1.2
*/
TNC_Result TNC_IMV_ReceiveMessage(TNC_IMVID imv_id,
static TNC_Result receive_message(TNC_IMVID imv_id,
TNC_ConnectionID connection_id,
TNC_BufferReference msg,
TNC_UInt32 msg_len,
TNC_MessageType msg_type)
TNC_UInt32 msg_flags,
chunk_t msg,
TNC_VendorID msg_vid,
TNC_MessageSubtype msg_subtype,
TNC_UInt32 src_imc_id,
TNC_UInt32 dst_imv_id)
{
pa_tnc_msg_t *pa_tnc_msg;
pa_tnc_attr_t *attr;
@@ -230,9 +230,8 @@ TNC_Result TNC_IMV_ReceiveMessage(TNC_IMVID imv_id,
pts = attestation_state->get_pts(attestation_state);
/* parse received PA-TNC message and automatically handle any errors */
result = imv_attestation->receive_message(imv_attestation, connection_id,
chunk_create(msg, msg_len), msg_type,
&pa_tnc_msg);
result = imv_attestation->receive_message(imv_attestation, state, msg,
msg_vid, msg_subtype, src_imc_id, dst_imv_id, &pa_tnc_msg);
/* no parsed PA-TNC attributes available if an error occurred */
if (!pa_tnc_msg)
@@ -383,7 +382,44 @@ TNC_Result TNC_IMV_ReceiveMessage(TNC_IMVID imv_id,
}
/**
* see section 3.7.4 of TCG TNC IF-IMV Specification 1.2
* see section 3.8.4 of TCG TNC IF-IMV Specification 1.3
*/
TNC_Result TNC_IMV_ReceiveMessage(TNC_IMVID imv_id,
TNC_ConnectionID connection_id,
TNC_BufferReference msg,
TNC_UInt32 msg_len,
TNC_MessageType msg_type)
{
TNC_VendorID msg_vid;
TNC_MessageSubtype msg_subtype;
msg_vid = msg_type >> 8;
msg_subtype = msg_type & TNC_SUBTYPE_ANY;
return receive_message(imv_id, connection_id, 0, chunk_create(msg, msg_len),
msg_vid, msg_subtype, 0, TNC_IMVID_ANY);
}
/**
* see section 3.8.6 of TCG TNC IF-IMV Specification 1.3
*/
TNC_Result TNC_IMV_ReceiveMessageLong(TNC_IMVID imv_id,
TNC_ConnectionID connection_id,
TNC_UInt32 msg_flags,
TNC_BufferReference msg,
TNC_UInt32 msg_len,
TNC_VendorID msg_vid,
TNC_MessageSubtype msg_subtype,
TNC_UInt32 src_imc_id,
TNC_UInt32 dst_imv_id)
{
return receive_message(imv_id, connection_id, msg_flags,
chunk_create(msg, msg_len), msg_vid, msg_subtype,
src_imc_id, dst_imv_id);
}
/**
* see section 3.8.7 of TCG TNC IF-IMV Specification 1.3
*/
TNC_Result TNC_IMV_SolicitRecommendation(TNC_IMVID imv_id,
TNC_ConnectionID connection_id)
@@ -398,7 +434,7 @@ TNC_Result TNC_IMV_SolicitRecommendation(TNC_IMVID imv_id,
}
/**
* see section 3.7.5 of TCG TNC IF-IMV Specification 1.2
* see section 3.8.8 of TCG TNC IF-IMV Specification 1.3
*/
TNC_Result TNC_IMV_BatchEnding(TNC_IMVID imv_id,
TNC_ConnectionID connection_id)
@@ -428,7 +464,7 @@ TNC_Result TNC_IMV_BatchEnding(TNC_IMVID imv_id,
}
/**
* see section 3.7.6 of TCG TNC IF-IMV Specification 1.2
* see section 3.8.9 of TCG TNC IF-IMV Specification 1.3
*/
TNC_Result TNC_IMV_Terminate(TNC_IMVID imv_id)
{
@@ -454,7 +490,7 @@ TNC_Result TNC_IMV_Terminate(TNC_IMVID imv_id)
}
/**
* see section 4.2.8.1 of TCG TNC IF-IMV Specification 1.2
* see section 4.2.8.1 of TCG TNC IF-IMV Specification 1.3
*/
TNC_Result TNC_IMV_ProvideBindFunction(TNC_IMVID imv_id,
TNC_TNCS_BindFunctionPointer bind_function)