improved log output of functional component names
This commit is contained in:
@@ -448,19 +448,15 @@ bool imc_attestation_process(pa_tnc_attr_t *attr, linked_list_t *attr_list,
|
|||||||
attr_info = attr->get_value(attr);
|
attr_info = attr->get_value(attr);
|
||||||
attr_cast = (tcg_pts_attr_req_func_comp_evid_t*)attr;
|
attr_cast = (tcg_pts_attr_req_func_comp_evid_t*)attr;
|
||||||
|
|
||||||
DBG1(DBG_IMC, "IMV requests evidence for %d functional components",
|
DBG1(DBG_IMC, "evidence requested for %d functional components",
|
||||||
attr_cast->get_count(attr_cast));
|
attr_cast->get_count(attr_cast));
|
||||||
|
|
||||||
e = attr_cast->create_enumerator(attr_cast);
|
e = attr_cast->create_enumerator(attr_cast);
|
||||||
while (e->enumerate(e, &flags, &depth, &name))
|
while (e->enumerate(e, &flags, &depth, &name))
|
||||||
{
|
{
|
||||||
|
name->log(name, " ");
|
||||||
negotiated_caps = pts->get_proto_caps(pts);
|
negotiated_caps = pts->get_proto_caps(pts);
|
||||||
|
|
||||||
DBG1(DBG_IMC, "Requested Evidence flags: %d, depth: %d,"
|
|
||||||
" vendor_id: %d, qualifier %d, name: %d",
|
|
||||||
flags, depth, name->get_vendor_id(name),
|
|
||||||
name->get_qualifier(name), name->get_name(name));
|
|
||||||
|
|
||||||
if (flags & PTS_REQ_FUNC_COMP_FLAG_TTC)
|
if (flags & PTS_REQ_FUNC_COMP_FLAG_TTC)
|
||||||
{
|
{
|
||||||
attr = ietf_attr_pa_tnc_error_create(PEN_TCG,
|
attr = ietf_attr_pa_tnc_error_create(PEN_TCG,
|
||||||
@@ -499,12 +495,6 @@ bool imc_attestation_process(pa_tnc_attr_t *attr, linked_list_t *attr_list,
|
|||||||
"zero. Measuring top level component only.");
|
"zero. Measuring top level component only.");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if (name->get_vendor_id(name) != PEN_ITA)
|
|
||||||
{
|
|
||||||
DBG1(DBG_IMC, "current version of Attestation IMC supports"
|
|
||||||
"only functional component namings by ITA");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Check if Unknown or Wildcard was set for qualifier */
|
/* Check if Unknown or Wildcard was set for qualifier */
|
||||||
if (name->get_qualifier(name) & PTS_QUALIFIER_WILDCARD)
|
if (name->get_qualifier(name) & PTS_QUALIFIER_WILDCARD)
|
||||||
|
|||||||
@@ -210,11 +210,11 @@ bool imv_attestation_build(pa_tnc_msg_t *msg,
|
|||||||
{
|
{
|
||||||
tcg_pts_attr_req_func_comp_evid_t *attr_cast;
|
tcg_pts_attr_req_func_comp_evid_t *attr_cast;
|
||||||
enumerator_t *enumerator;
|
enumerator_t *enumerator;
|
||||||
char flags[8], *platform_info;
|
char *platform_info;
|
||||||
pts_component_t *comp;
|
pts_component_t *comp;
|
||||||
pts_comp_func_name_t *comp_name;
|
pts_comp_func_name_t *comp_name;
|
||||||
int vid, name, qualifier, type;
|
int vid, name, qualifier;
|
||||||
enum_name_t *names, *types;
|
u_int8_t flags;
|
||||||
bool first = TRUE;
|
bool first = TRUE;
|
||||||
|
|
||||||
attestation_state->set_handshake_state(attestation_state,
|
attestation_state->set_handshake_state(attestation_state,
|
||||||
@@ -236,28 +236,16 @@ bool imv_attestation_build(pa_tnc_msg_t *msg,
|
|||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
DBG2(DBG_IMV, "evidence request by");
|
||||||
while (enumerator->enumerate(enumerator, &vid, &name, &qualifier))
|
while (enumerator->enumerate(enumerator, &vid, &name, &qualifier))
|
||||||
{
|
{
|
||||||
comp_name = pts_comp_func_name_create(vid, name, qualifier);
|
comp_name = pts_comp_func_name_create(vid, name, qualifier);
|
||||||
|
comp_name->log(comp_name, " ");
|
||||||
|
|
||||||
names = pts_components->get_comp_func_names(pts_components, vid);
|
|
||||||
types = pts_components->get_qualifier_type_names(pts_components, vid);
|
|
||||||
if (names && types)
|
|
||||||
{
|
|
||||||
type = pts_components->get_qualifier(pts_components,
|
|
||||||
comp_name, flags);
|
|
||||||
DBG2(DBG_TNC, "%N component evidence request '%N' [%s] '%N'",
|
|
||||||
pen_names, vid, names, name, flags, types, type);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
DBG2(DBG_TNC, "0x%06x component evidence request 0x%08x 0x%02x",
|
|
||||||
vid, name, qualifier);
|
|
||||||
}
|
|
||||||
comp = pts_components->create(pts_components, comp_name);
|
comp = pts_components->create(pts_components, comp_name);
|
||||||
if (!comp)
|
if (!comp)
|
||||||
{
|
{
|
||||||
DBG2(DBG_TNC, " functional component not registered");
|
DBG2(DBG_TNC, " not registered: removed from request");
|
||||||
comp_name->destroy(comp_name);
|
comp_name->destroy(comp_name);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -268,9 +256,10 @@ bool imv_attestation_build(pa_tnc_msg_t *msg,
|
|||||||
attr->set_noskip_flag(attr, TRUE);
|
attr->set_noskip_flag(attr, TRUE);
|
||||||
first = FALSE;
|
first = FALSE;
|
||||||
}
|
}
|
||||||
|
flags = comp->get_evidence_flags(comp);
|
||||||
|
/* TODO check flags against negotiated_caps */
|
||||||
attr_cast = (tcg_pts_attr_req_func_comp_evid_t *)attr;
|
attr_cast = (tcg_pts_attr_req_func_comp_evid_t *)attr;
|
||||||
attr_cast->add_component(attr, comp->get_evidence_flags(comp),
|
attr_cast->add_component(attr_cast, flags, 0, comp_name);
|
||||||
0, comp_name);
|
|
||||||
}
|
}
|
||||||
enumerator->destroy(enumerator);
|
enumerator->destroy(enumerator);
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
* for more details.
|
* for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "libpts.h"
|
||||||
#include "pts/components/pts_comp_func_name.h"
|
#include "pts/components/pts_comp_func_name.h"
|
||||||
|
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
@@ -34,7 +35,7 @@ struct private_pts_comp_func_name_t {
|
|||||||
/**
|
/**
|
||||||
* PTS Component Functional Name Vendor ID
|
* PTS Component Functional Name Vendor ID
|
||||||
*/
|
*/
|
||||||
u_int32_t vendor_id;
|
u_int32_t vid;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PTS Component Functional Name
|
* PTS Component Functional Name
|
||||||
@@ -51,7 +52,7 @@ struct private_pts_comp_func_name_t {
|
|||||||
METHOD(pts_comp_func_name_t, get_vendor_id, u_int32_t,
|
METHOD(pts_comp_func_name_t, get_vendor_id, u_int32_t,
|
||||||
private_pts_comp_func_name_t *this)
|
private_pts_comp_func_name_t *this)
|
||||||
{
|
{
|
||||||
return this->vendor_id;
|
return this->vid;
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(pts_comp_func_name_t, get_name, u_int32_t,
|
METHOD(pts_comp_func_name_t, get_name, u_int32_t,
|
||||||
@@ -69,8 +70,7 @@ METHOD(pts_comp_func_name_t, get_qualifier, u_int8_t,
|
|||||||
static bool equals(private_pts_comp_func_name_t *this,
|
static bool equals(private_pts_comp_func_name_t *this,
|
||||||
private_pts_comp_func_name_t *other)
|
private_pts_comp_func_name_t *other)
|
||||||
{
|
{
|
||||||
if (this->vendor_id != other->vendor_id ||
|
if (this->vid != other->vid || this->name != other->name)
|
||||||
this->name != other->name)
|
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@@ -95,6 +95,29 @@ METHOD(pts_comp_func_name_t, clone_, pts_comp_func_name_t*,
|
|||||||
return &clone->public;
|
return &clone->public;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
METHOD(pts_comp_func_name_t, log_, void,
|
||||||
|
private_pts_comp_func_name_t *this, char *label)
|
||||||
|
{
|
||||||
|
enum_name_t *names, *types;
|
||||||
|
char flags[8];
|
||||||
|
int type;
|
||||||
|
|
||||||
|
names = pts_components->get_comp_func_names(pts_components, this->vid);
|
||||||
|
types = pts_components->get_qualifier_type_names(pts_components, this->vid);
|
||||||
|
type = pts_components->get_qualifier(pts_components, &this->public, flags);
|
||||||
|
|
||||||
|
if (names && types)
|
||||||
|
{
|
||||||
|
DBG2(DBG_TNC, "%s%N functional component '%N' [%s] '%N'",
|
||||||
|
label, pen_names, this->vid, names, this->name, flags, types, type);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DBG2(DBG_TNC, "%s0x%06x functional component 0x%08x 0x%02x",
|
||||||
|
label, this->vid, this->name, this->qualifier);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
METHOD(pts_comp_func_name_t, destroy, void,
|
METHOD(pts_comp_func_name_t, destroy, void,
|
||||||
private_pts_comp_func_name_t *this)
|
private_pts_comp_func_name_t *this)
|
||||||
{
|
{
|
||||||
@@ -104,8 +127,7 @@ METHOD(pts_comp_func_name_t, destroy, void,
|
|||||||
/**
|
/**
|
||||||
* See header
|
* See header
|
||||||
*/
|
*/
|
||||||
pts_comp_func_name_t* pts_comp_func_name_create(u_int32_t vendor_id,
|
pts_comp_func_name_t* pts_comp_func_name_create(u_int32_t vid, u_int32_t name,
|
||||||
u_int32_t name,
|
|
||||||
u_int8_t qualifier)
|
u_int8_t qualifier)
|
||||||
{
|
{
|
||||||
private_pts_comp_func_name_t *this;
|
private_pts_comp_func_name_t *this;
|
||||||
@@ -117,9 +139,10 @@ pts_comp_func_name_t* pts_comp_func_name_create(u_int32_t vendor_id,
|
|||||||
.get_qualifier = _get_qualifier,
|
.get_qualifier = _get_qualifier,
|
||||||
.equals = (bool(*)(pts_comp_func_name_t*,pts_comp_func_name_t*))equals,
|
.equals = (bool(*)(pts_comp_func_name_t*,pts_comp_func_name_t*))equals,
|
||||||
.clone = _clone_,
|
.clone = _clone_,
|
||||||
|
.log = _log_,
|
||||||
.destroy = _destroy,
|
.destroy = _destroy,
|
||||||
},
|
},
|
||||||
.vendor_id = vendor_id,
|
.vid = vid,
|
||||||
.name = name,
|
.name = name,
|
||||||
.qualifier = qualifier,
|
.qualifier = qualifier,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -69,6 +69,13 @@ struct pts_comp_func_name_t {
|
|||||||
*/
|
*/
|
||||||
pts_comp_func_name_t* (*clone)(pts_comp_func_name_t *this);
|
pts_comp_func_name_t* (*clone)(pts_comp_func_name_t *this);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Write PTS Component Functional Name information to the standard logfile
|
||||||
|
*
|
||||||
|
* @param label Label added to log output
|
||||||
|
*/
|
||||||
|
void (*log)(pts_comp_func_name_t *this, char *label);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destroys a pts_component_t object.
|
* Destroys a pts_component_t object.
|
||||||
*/
|
*/
|
||||||
@@ -79,12 +86,11 @@ struct pts_comp_func_name_t {
|
|||||||
/**
|
/**
|
||||||
* Create a PTS Component Functional Name object
|
* Create a PTS Component Functional Name object
|
||||||
*
|
*
|
||||||
* @param vendor_id PTS Component Functional Name Vendor ID
|
* @param vid PTS Component Functional Name Vendor ID
|
||||||
* @param name PTS Component Functional Name
|
* @param name PTS Component Functional Name
|
||||||
* @param PTS Component Functional Name Qualifier
|
* @param PTS Component Functional Name Qualifier
|
||||||
*/
|
*/
|
||||||
pts_comp_func_name_t* pts_comp_func_name_create(u_int32_t vendor_id,
|
pts_comp_func_name_t* pts_comp_func_name_create(u_int32_t vid, u_int32_t name,
|
||||||
u_int32_t name,
|
|
||||||
u_int8_t qualifier);
|
u_int8_t qualifier);
|
||||||
|
|
||||||
#endif /** PTS_FUNC_COMP_NAME_H_ @}*/
|
#endif /** PTS_FUNC_COMP_NAME_H_ @}*/
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ METHOD(pts_component_manager_t, add_vendor, void,
|
|||||||
entry->components = linked_list_create();
|
entry->components = linked_list_create();
|
||||||
|
|
||||||
this->list->insert_last(this->list, entry);
|
this->list->insert_last(this->list, entry);
|
||||||
DBG2(DBG_TNC, "added %N functional component namespace",
|
DBG2(DBG_PTS, "added %N functional component namespace",
|
||||||
pen_names, vendor_id);
|
pen_names, vendor_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -183,7 +183,7 @@ METHOD(pts_component_manager_t, add_component, void,
|
|||||||
component->create = create;
|
component->create = create;
|
||||||
|
|
||||||
entry->components->insert_last(entry->components, component);
|
entry->components->insert_last(entry->components, component);
|
||||||
DBG2(DBG_TNC, "added %N functional component \"%N\"",
|
DBG2(DBG_PTS, "added %N functional component '%N'",
|
||||||
pen_names, vendor_id,
|
pen_names, vendor_id,
|
||||||
get_comp_func_names(this, vendor_id), name);
|
get_comp_func_names(this, vendor_id), name);
|
||||||
}
|
}
|
||||||
@@ -204,7 +204,7 @@ METHOD(pts_component_manager_t, remove_vendor, void,
|
|||||||
{
|
{
|
||||||
this->list->remove_at(this->list, enumerator);
|
this->list->remove_at(this->list, enumerator);
|
||||||
vendor_entry_destroy(entry);
|
vendor_entry_destroy(entry);
|
||||||
DBG2(DBG_TNC, "removed %N functional component namespace",
|
DBG2(DBG_PTS, "removed %N functional component namespace",
|
||||||
pen_names, vendor_id);
|
pen_names, vendor_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -232,10 +232,11 @@ METHOD(pts_component_manager_t, get_qualifier, u_int8_t,
|
|||||||
type = qualifier & ((1 << size) - 1);
|
type = qualifier & ((1 << size) - 1);
|
||||||
|
|
||||||
/* determine flags */
|
/* determine flags */
|
||||||
|
size = PTS_QUALIFIER_SIZE - size;
|
||||||
flag = (1 << (PTS_QUALIFIER_SIZE - 1));
|
flag = (1 << (PTS_QUALIFIER_SIZE - 1));
|
||||||
if (flags)
|
if (flags)
|
||||||
{
|
{
|
||||||
for (i = 0 ; i < PTS_QUALIFIER_SIZE - size; i++)
|
for (i = 0 ; i < size; i++)
|
||||||
{
|
{
|
||||||
flags[i] = (qualifier & flag) ?
|
flags[i] = (qualifier & flag) ?
|
||||||
entry->qualifier_flag_names[i] : '.';
|
entry->qualifier_flag_names[i] : '.';
|
||||||
|
|||||||
Reference in New Issue
Block a user