Replaced Tag File Path by Instance ID field

This update reflects the latest changes in the TCG TNC
SWID Messages and Attributes for IF-M specification
This commit is contained in:
Andreas Steffen
2014-07-16 15:57:15 +02:00
parent b906d41214
commit 924ed795af
7 changed files with 49 additions and 49 deletions
+6 -6
View File
@@ -188,7 +188,7 @@ static bool add_swid_inventory(imc_state_t *state, imc_msg_t *msg,
{ {
tcg_swid_attr_tag_inv_t *swid_attr; tcg_swid_attr_tag_inv_t *swid_attr;
swid_tag_t *tag; swid_tag_t *tag;
chunk_t encoding, tag_file_path; chunk_t encoding, instance_id;
/* At least one TCG Tag Inventory attribute is sent */ /* At least one TCG Tag Inventory attribute is sent */
attr_size = PA_TNC_ATTR_HEADER_SIZE + TCG_SWID_TAG_INV_MIN_SIZE; attr_size = PA_TNC_ATTR_HEADER_SIZE + TCG_SWID_TAG_INV_MIN_SIZE;
@@ -197,9 +197,9 @@ static bool add_swid_inventory(imc_state_t *state, imc_msg_t *msg,
enumerator = swid_inventory->create_enumerator(swid_inventory); enumerator = swid_inventory->create_enumerator(swid_inventory);
while (enumerator->enumerate(enumerator, &tag)) while (enumerator->enumerate(enumerator, &tag))
{ {
tag_file_path = tag->get_tag_file_path(tag); instance_id = tag->get_instance_id(tag);
encoding = tag->get_encoding(tag); encoding = tag->get_encoding(tag);
entry_size = 2 + tag_file_path.len + 4 + encoding.len; entry_size = 2 + instance_id.len + 4 + encoding.len;
/* Check for oversize tags that cannot be transported */ /* Check for oversize tags that cannot be transported */
if (PA_TNC_ATTR_HEADER_SIZE + TCG_SWID_TAG_INV_MIN_SIZE + if (PA_TNC_ATTR_HEADER_SIZE + TCG_SWID_TAG_INV_MIN_SIZE +
@@ -241,7 +241,7 @@ static bool add_swid_inventory(imc_state_t *state, imc_msg_t *msg,
{ {
tcg_swid_attr_tag_id_inv_t *swid_id_attr; tcg_swid_attr_tag_id_inv_t *swid_id_attr;
swid_tag_id_t *tag_id; swid_tag_id_t *tag_id;
chunk_t tag_creator, unique_sw_id, tag_file_path; chunk_t tag_creator, unique_sw_id, instance_id;
/* At least one TCG Tag ID Inventory attribute is sent */ /* At least one TCG Tag ID Inventory attribute is sent */
attr_size = PA_TNC_ATTR_HEADER_SIZE + TCG_SWID_TAG_ID_INV_MIN_SIZE; attr_size = PA_TNC_ATTR_HEADER_SIZE + TCG_SWID_TAG_ID_INV_MIN_SIZE;
@@ -252,9 +252,9 @@ static bool add_swid_inventory(imc_state_t *state, imc_msg_t *msg,
while (enumerator->enumerate(enumerator, &tag_id)) while (enumerator->enumerate(enumerator, &tag_id))
{ {
tag_creator = tag_id->get_tag_creator(tag_id); tag_creator = tag_id->get_tag_creator(tag_id);
unique_sw_id = tag_id->get_unique_sw_id(tag_id, &tag_file_path); unique_sw_id = tag_id->get_unique_sw_id(tag_id, &instance_id);
entry_size = 2 + tag_creator.len + 2 + unique_sw_id.len + entry_size = 2 + tag_creator.len + 2 + unique_sw_id.len +
2 + tag_file_path.len; 2 + instance_id.len;
if (attr_size + entry_size > max_attr_size) if (attr_size + entry_size > max_attr_size)
{ {
+9 -9
View File
@@ -34,9 +34,9 @@ struct private_swid_tag_t {
chunk_t encoding; chunk_t encoding;
/** /**
* Optional Tag File Path * Optional Tag Identifier Instance ID
*/ */
chunk_t tag_file_path; chunk_t instance_id;
/** /**
* Reference count * Reference count
@@ -50,10 +50,10 @@ METHOD(swid_tag_t, get_encoding, chunk_t,
return this->encoding; return this->encoding;
} }
METHOD(swid_tag_t, get_tag_file_path, chunk_t, METHOD(swid_tag_t, get_instance_id, chunk_t,
private_swid_tag_t *this) private_swid_tag_t *this)
{ {
return this->tag_file_path; return this->instance_id;
} }
METHOD(swid_tag_t, get_ref, swid_tag_t*, METHOD(swid_tag_t, get_ref, swid_tag_t*,
@@ -69,7 +69,7 @@ METHOD(swid_tag_t, destroy, void,
if (ref_put(&this->ref)) if (ref_put(&this->ref))
{ {
free(this->encoding.ptr); free(this->encoding.ptr);
free(this->tag_file_path.ptr); free(this->instance_id.ptr);
free(this); free(this);
} }
} }
@@ -77,14 +77,14 @@ METHOD(swid_tag_t, destroy, void,
/** /**
* See header * See header
*/ */
swid_tag_t *swid_tag_create(chunk_t encoding, chunk_t tag_file_path) swid_tag_t *swid_tag_create(chunk_t encoding, chunk_t instance_id)
{ {
private_swid_tag_t *this; private_swid_tag_t *this;
INIT(this, INIT(this,
.public = { .public = {
.get_encoding = _get_encoding, .get_encoding = _get_encoding,
.get_tag_file_path = _get_tag_file_path, .get_instance_id = _get_instance_id,
.get_ref = _get_ref, .get_ref = _get_ref,
.destroy = _destroy, .destroy = _destroy,
}, },
@@ -92,9 +92,9 @@ swid_tag_t *swid_tag_create(chunk_t encoding, chunk_t tag_file_path)
.ref = 1, .ref = 1,
); );
if (tag_file_path.len > 0) if (instance_id.len > 0)
{ {
this->tag_file_path = chunk_clone(tag_file_path); this->instance_id = chunk_clone(instance_id);
} }
return &this->public; return &this->public;
+5 -5
View File
@@ -39,11 +39,11 @@ struct swid_tag_t {
chunk_t (*get_encoding)(swid_tag_t *this); chunk_t (*get_encoding)(swid_tag_t *this);
/** /**
* Get th Optional Tag File Path * Get the optional Tag Identifier Instance ID
* *
* @return Optional Tag File Path * @return Optional Tag Identifier Instance ID
*/ */
chunk_t (*get_tag_file_path)(swid_tag_t *this); chunk_t (*get_instance_id)(swid_tag_t *this);
/** /**
* Get a new reference to the swid_tag object * Get a new reference to the swid_tag object
@@ -63,8 +63,8 @@ struct swid_tag_t {
* Creates a swid_tag_t object * Creates a swid_tag_t object
* *
* @param encoding XML encoding of SWID tag * @param encoding XML encoding of SWID tag
* @param tag_file_path Tag File Path or empty chunk * @param instance_id Tag Identifier Instance ID or empty chunk
*/ */
swid_tag_t* swid_tag_create(chunk_t encoding, chunk_t tag_file_path); swid_tag_t* swid_tag_create(chunk_t encoding, chunk_t instance_id);
#endif /** SWID_TAG_H_ @}*/ #endif /** SWID_TAG_H_ @}*/
+9 -9
View File
@@ -39,9 +39,9 @@ struct private_swid_tag_id_t {
chunk_t unique_sw_id; chunk_t unique_sw_id;
/** /**
* Tag File Path * Optional Tag Identifier Instance ID
*/ */
chunk_t tag_file_path; chunk_t instance_id;
/** /**
* Reference count * Reference count
@@ -56,11 +56,11 @@ METHOD(swid_tag_id_t, get_tag_creator, chunk_t,
} }
METHOD(swid_tag_id_t, get_unique_sw_id, chunk_t, METHOD(swid_tag_id_t, get_unique_sw_id, chunk_t,
private_swid_tag_id_t *this, chunk_t *tag_file_path) private_swid_tag_id_t *this, chunk_t *instance_id)
{ {
if (tag_file_path) if (instance_id)
{ {
*tag_file_path = this->tag_file_path; *instance_id = this->instance_id;
} }
return this->unique_sw_id; return this->unique_sw_id;
} }
@@ -79,7 +79,7 @@ METHOD(swid_tag_id_t, destroy, void,
{ {
free(this->tag_creator.ptr); free(this->tag_creator.ptr);
free(this->unique_sw_id.ptr); free(this->unique_sw_id.ptr);
free(this->tag_file_path.ptr); free(this->instance_id.ptr);
free(this); free(this);
} }
} }
@@ -88,7 +88,7 @@ METHOD(swid_tag_id_t, destroy, void,
* See header * See header
*/ */
swid_tag_id_t *swid_tag_id_create(chunk_t tag_creator, chunk_t unique_sw_id, swid_tag_id_t *swid_tag_id_create(chunk_t tag_creator, chunk_t unique_sw_id,
chunk_t tag_file_path) chunk_t instance_id)
{ {
private_swid_tag_id_t *this; private_swid_tag_id_t *this;
@@ -104,9 +104,9 @@ swid_tag_id_t *swid_tag_id_create(chunk_t tag_creator, chunk_t unique_sw_id,
.ref = 1, .ref = 1,
); );
if (tag_file_path.len > 0) if (instance_id.len > 0)
{ {
this->tag_file_path = chunk_clone(tag_file_path); this->instance_id = chunk_clone(instance_id);
} }
return &this->public; return &this->public;
+4 -4
View File
@@ -41,10 +41,10 @@ struct swid_tag_id_t {
/** /**
* Get the Unique Software ID and optional Tag File Path * Get the Unique Software ID and optional Tag File Path
* *
* @param Optional Tag File Path * @param instance_id Optional Tag Identifier Instance ID
* @return Unique Software ID * @return Unique Software ID
*/ */
chunk_t (*get_unique_sw_id)(swid_tag_id_t *this, chunk_t *tag_file_path); chunk_t (*get_unique_sw_id)(swid_tag_id_t *this, chunk_t *instance_id);
/** /**
* Get a new reference to the swid_tag_id object * Get a new reference to the swid_tag_id object
@@ -65,9 +65,9 @@ struct swid_tag_id_t {
* *
* @param tag_creator Tag Creator * @param tag_creator Tag Creator
* @param unique_sw_id Unique Software ID * @param unique_sw_id Unique Software ID
* @param tag_file_path Tag File Path or empty chunk * @param instance_id Tag Identifier Instance ID or empty chunk
*/ */
swid_tag_id_t* swid_tag_id_create(chunk_t tag_creator, chunk_t unique_sw_id, swid_tag_id_t* swid_tag_id_create(chunk_t tag_creator, chunk_t unique_sw_id,
chunk_t tag_file_path); chunk_t instance_id);
#endif /** SWID_TAG_ID_H_ @}*/ #endif /** SWID_TAG_ID_H_ @}*/
@@ -42,7 +42,7 @@ typedef struct private_tcg_swid_attr_tag_id_inv_t private_tcg_swid_attr_tag_id_i
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | Unique Software ID Length |Unique Software ID (var length)| * | Unique Software ID Length |Unique Software ID (var length)|
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | Tag File Path Length | Tag File Path (var. length) | * | Instance ID Length | Instance ID (variable length) |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/ */
@@ -128,7 +128,7 @@ METHOD(pa_tnc_attr_t, build, void,
{ {
bio_writer_t *writer; bio_writer_t *writer;
swid_tag_id_t *tag_id; swid_tag_id_t *tag_id;
chunk_t tag_creator, unique_sw_id, tag_file_path; chunk_t tag_creator, unique_sw_id, instance_id;
enumerator_t *enumerator; enumerator_t *enumerator;
if (this->value.ptr) if (this->value.ptr)
@@ -147,10 +147,10 @@ METHOD(pa_tnc_attr_t, build, void,
while (enumerator->enumerate(enumerator, &tag_id)) while (enumerator->enumerate(enumerator, &tag_id))
{ {
tag_creator = tag_id->get_tag_creator(tag_id); tag_creator = tag_id->get_tag_creator(tag_id);
unique_sw_id = tag_id->get_unique_sw_id(tag_id, &tag_file_path); unique_sw_id = tag_id->get_unique_sw_id(tag_id, &instance_id);
writer->write_data16(writer, tag_creator); writer->write_data16(writer, tag_creator);
writer->write_data16(writer, unique_sw_id); writer->write_data16(writer, unique_sw_id);
writer->write_data16(writer, tag_file_path); writer->write_data16(writer, instance_id);
} }
enumerator->destroy(enumerator); enumerator->destroy(enumerator);
@@ -164,7 +164,7 @@ METHOD(pa_tnc_attr_t, process, status_t,
bio_reader_t *reader; bio_reader_t *reader;
uint32_t tag_id_count; uint32_t tag_id_count;
uint8_t reserved; uint8_t reserved;
chunk_t tag_creator, unique_sw_id, tag_file_path; chunk_t tag_creator, unique_sw_id, instance_id;
swid_tag_id_t *tag_id; swid_tag_id_t *tag_id;
if (this->value.len < TCG_SWID_TAG_ID_INV_MIN_SIZE) if (this->value.len < TCG_SWID_TAG_ID_INV_MIN_SIZE)
@@ -198,14 +198,14 @@ METHOD(pa_tnc_attr_t, process, status_t,
} }
*offset += 2 + unique_sw_id.len; *offset += 2 + unique_sw_id.len;
if (!reader->read_data16(reader, &tag_file_path)) if (!reader->read_data16(reader, &instance_id))
{ {
DBG1(DBG_TNC, "insufficient data for Tag File Path"); DBG1(DBG_TNC, "insufficient data for Instance ID");
return FAILED; return FAILED;
} }
*offset += 2 + tag_file_path.len; *offset += 2 + instance_id.len;
tag_id = swid_tag_id_create(tag_creator, unique_sw_id, tag_file_path); tag_id = swid_tag_id_create(tag_creator, unique_sw_id, instance_id);
this->inventory->add(this->inventory, tag_id); this->inventory->add(this->inventory, tag_id);
} }
reader->destroy(reader); reader->destroy(reader);
+7 -7
View File
@@ -38,7 +38,7 @@ typedef struct private_tcg_swid_attr_tag_inv_t private_tcg_swid_attr_tag_inv_t;
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | Last EID | * | Last EID |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | Tag File Path Length | Tag File Path (var length) | * | Instance ID Length | Instance ID (var. length) |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | Tag Length | * | Tag Length |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
@@ -145,7 +145,7 @@ METHOD(pa_tnc_attr_t, build, void,
enumerator = this->inventory->create_enumerator(this->inventory); enumerator = this->inventory->create_enumerator(this->inventory);
while (enumerator->enumerate(enumerator, &tag)) while (enumerator->enumerate(enumerator, &tag))
{ {
writer->write_data16(writer, tag->get_tag_file_path(tag)); writer->write_data16(writer, tag->get_instance_id(tag));
writer->write_data32(writer, tag->get_encoding(tag)); writer->write_data32(writer, tag->get_encoding(tag));
} }
enumerator->destroy(enumerator); enumerator->destroy(enumerator);
@@ -160,7 +160,7 @@ METHOD(pa_tnc_attr_t, process, status_t,
bio_reader_t *reader; bio_reader_t *reader;
uint32_t tag_count; uint32_t tag_count;
uint8_t reserved; uint8_t reserved;
chunk_t tag_encoding, tag_file_path; chunk_t tag_encoding, instance_id;
swid_tag_t *tag; swid_tag_t *tag;
if (this->value.len < TCG_SWID_TAG_INV_MIN_SIZE) if (this->value.len < TCG_SWID_TAG_INV_MIN_SIZE)
@@ -180,12 +180,12 @@ METHOD(pa_tnc_attr_t, process, status_t,
while (tag_count--) while (tag_count--)
{ {
if (!reader->read_data16(reader, &tag_file_path)) if (!reader->read_data16(reader, &instance_id))
{ {
DBG1(DBG_TNC, "insufficient data for Tag File Path"); DBG1(DBG_TNC, "insufficient data for Instance ID");
return FAILED; return FAILED;
} }
*offset += 2 + tag_file_path.len; *offset += 2 + instance_id.len;
if (!reader->read_data32(reader, &tag_encoding)) if (!reader->read_data32(reader, &tag_encoding))
{ {
@@ -194,7 +194,7 @@ METHOD(pa_tnc_attr_t, process, status_t,
} }
*offset += 4 + tag_encoding.len; *offset += 4 + tag_encoding.len;
tag = swid_tag_create(tag_encoding, tag_file_path); tag = swid_tag_create(tag_encoding, instance_id);
this->inventory->add(this->inventory, tag); this->inventory->add(this->inventory, tag);
} }
reader->destroy(reader); reader->destroy(reader);