define pen_type_t as a vendor-specific type

This commit is contained in:
Andreas Steffen
2012-08-20 22:37:08 +02:00
parent 88a5abf5e2
commit dbb7859f9f
35 changed files with 301 additions and 624 deletions
+5 -20
View File
@@ -55,14 +55,9 @@ struct private_ietf_attr_attr_request_t {
ietf_attr_attr_request_t public; ietf_attr_attr_request_t public;
/** /**
* Attribute vendor ID * Vendor-specific attribute type
*/ */
pen_t vendor_id; pen_type_t type;
/**
* Attribute type
*/
u_int32_t type;
/** /**
* Attribute value * Attribute value
@@ -93,13 +88,7 @@ struct entry_t {
u_int32_t type; u_int32_t type;
}; };
METHOD(pa_tnc_attr_t, get_vendor_id, pen_t, METHOD(pa_tnc_attr_t, get_type, pen_type_t,
private_ietf_attr_attr_request_t *this)
{
return this->vendor_id;
}
METHOD(pa_tnc_attr_t, get_type, u_int32_t,
private_ietf_attr_attr_request_t *this) private_ietf_attr_attr_request_t *this)
{ {
return this->type; return this->type;
@@ -250,7 +239,6 @@ pa_tnc_attr_t *ietf_attr_attr_request_create(pen_t vendor_id, u_int32_t type)
INIT(this, INIT(this,
.public = { .public = {
.pa_tnc_attribute = { .pa_tnc_attribute = {
.get_vendor_id = _get_vendor_id,
.get_type = _get_type, .get_type = _get_type,
.get_value = _get_value, .get_value = _get_value,
.get_noskip_flag = _get_noskip_flag, .get_noskip_flag = _get_noskip_flag,
@@ -263,8 +251,7 @@ pa_tnc_attr_t *ietf_attr_attr_request_create(pen_t vendor_id, u_int32_t type)
.add = _add, .add = _add,
.create_enumerator = _create_enumerator, .create_enumerator = _create_enumerator,
}, },
.vendor_id = PEN_IETF, .type = { PEN_IETF, IETF_ATTR_ATTRIBUTE_REQUEST },
.type = IETF_ATTR_ATTRIBUTE_REQUEST,
.list = linked_list_create(), .list = linked_list_create(),
.ref = 1, .ref = 1,
); );
@@ -283,7 +270,6 @@ pa_tnc_attr_t *ietf_attr_attr_request_create_from_data(chunk_t data)
INIT(this, INIT(this,
.public = { .public = {
.pa_tnc_attribute = { .pa_tnc_attribute = {
.get_vendor_id = _get_vendor_id,
.get_type = _get_type, .get_type = _get_type,
.get_value = _get_value, .get_value = _get_value,
.build = _build, .build = _build,
@@ -294,8 +280,7 @@ pa_tnc_attr_t *ietf_attr_attr_request_create_from_data(chunk_t data)
.add = _add, .add = _add,
.create_enumerator = _create_enumerator, .create_enumerator = _create_enumerator,
}, },
.vendor_id = PEN_IETF, .type = { PEN_IETF,IETF_ATTR_ATTRIBUTE_REQUEST },
.type = IETF_ATTR_ATTRIBUTE_REQUEST,
.value = chunk_clone(data), .value = chunk_clone(data),
.list = linked_list_create(), .list = linked_list_create(),
.ref = 1, .ref = 1,
+22 -56
View File
@@ -1,5 +1,6 @@
/* /*
* Copyright (C) 2011 Andreas Steffen, HSR Hochschule fuer Technik Rapperswil * Copyright (C) 2011-2012 Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the * under the terms of the GNU General Public License as published by the
@@ -107,14 +108,9 @@ struct private_ietf_attr_pa_tnc_error_t {
ietf_attr_pa_tnc_error_t public; ietf_attr_pa_tnc_error_t public;
/** /**
* Attribute vendor ID * Vendor-specific attribute type
*/ */
pen_t vendor_id; pen_type_t type;
/**
* Attribute type
*/
u_int32_t type;
/** /**
* Attribute value * Attribute value
@@ -127,14 +123,9 @@ struct private_ietf_attr_pa_tnc_error_t {
bool noskip_flag; bool noskip_flag;
/** /**
* Error code vendor ID * Vendor-specific error code
*/ */
pen_t error_vendor_id; pen_type_t error_code;
/**
* Error code
*/
u_int32_t error_code;
/** /**
* First 8 bytes of erroneous PA-TNC message * First 8 bytes of erroneous PA-TNC message
@@ -157,13 +148,7 @@ struct private_ietf_attr_pa_tnc_error_t {
refcount_t ref; refcount_t ref;
}; };
METHOD(pa_tnc_attr_t, get_vendor_id, pen_t, METHOD(pa_tnc_attr_t, get_type, pen_type_t,
private_ietf_attr_pa_tnc_error_t *this)
{
return this->vendor_id;
}
METHOD(pa_tnc_attr_t, get_type, u_int32_t,
private_ietf_attr_pa_tnc_error_t *this) private_ietf_attr_pa_tnc_error_t *this)
{ {
return this->type; return this->type;
@@ -198,13 +183,13 @@ METHOD(pa_tnc_attr_t, build, void,
} }
writer = bio_writer_create(PA_ERROR_HEADER_SIZE + PA_ERROR_MSG_INFO_SIZE); writer = bio_writer_create(PA_ERROR_HEADER_SIZE + PA_ERROR_MSG_INFO_SIZE);
writer->write_uint8 (writer, PA_ERROR_RESERVED); writer->write_uint8 (writer, PA_ERROR_RESERVED);
writer->write_uint24(writer, this->error_vendor_id); writer->write_uint24(writer, this->error_code.vendor_id);
writer->write_uint32(writer, this->error_code); writer->write_uint32(writer, this->error_code.type);
writer->write_data (writer, this->msg_info); writer->write_data (writer, this->msg_info);
if (this->error_vendor_id == PEN_IETF) if (this->error_code.vendor_id == PEN_IETF)
{ {
switch (this->error_code) switch (this->error_code.type)
{ {
case PA_ERROR_INVALID_PARAMETER: case PA_ERROR_INVALID_PARAMETER:
writer->write_uint32(writer, this->error_offset); writer->write_uint32(writer, this->error_offset);
@@ -239,10 +224,10 @@ METHOD(pa_tnc_attr_t, process, status_t,
} }
reader = bio_reader_create(this->value); reader = bio_reader_create(this->value);
reader->read_uint8 (reader, &reserved); reader->read_uint8 (reader, &reserved);
reader->read_uint24(reader, &this->error_vendor_id); reader->read_uint24(reader, &this->error_code.vendor_id);
reader->read_uint32(reader, &this->error_code); reader->read_uint32(reader, &this->error_code.type);
if (this->error_vendor_id == PEN_IETF) if (this->error_code.vendor_id == PEN_IETF)
{ {
if (!reader->read_data(reader, PA_ERROR_MSG_INFO_SIZE, &this->msg_info)) if (!reader->read_data(reader, PA_ERROR_MSG_INFO_SIZE, &this->msg_info))
{ {
@@ -253,7 +238,7 @@ METHOD(pa_tnc_attr_t, process, status_t,
} }
this->msg_info = chunk_clone(this->msg_info); this->msg_info = chunk_clone(this->msg_info);
switch (this->error_code) switch (this->error_code.type)
{ {
case PA_ERROR_INVALID_PARAMETER: case PA_ERROR_INVALID_PARAMETER:
if (!reader->read_uint32(reader, &this->error_offset)) if (!reader->read_uint32(reader, &this->error_offset))
@@ -309,13 +294,7 @@ METHOD(pa_tnc_attr_t, destroy, void,
} }
} }
METHOD(ietf_attr_pa_tnc_error_t, get_error_vendor_id, pen_t, METHOD(ietf_attr_pa_tnc_error_t, get_error_code, pen_type_t,
private_ietf_attr_pa_tnc_error_t *this)
{
return this->error_vendor_id;
}
METHOD(ietf_attr_pa_tnc_error_t, get_error_code, u_int32_t,
private_ietf_attr_pa_tnc_error_t *this) private_ietf_attr_pa_tnc_error_t *this)
{ {
return this->error_code; return this->error_code;
@@ -348,13 +327,12 @@ METHOD(ietf_attr_pa_tnc_error_t, get_offset, u_int32_t,
/** /**
* Described in header. * Described in header.
*/ */
pa_tnc_attr_t *ietf_attr_pa_tnc_error_create(pen_t vendor_id, pa_tnc_attr_t *ietf_attr_pa_tnc_error_create(pen_type_t error_code,
u_int32_t error_code,
chunk_t msg_info) chunk_t msg_info)
{ {
private_ietf_attr_pa_tnc_error_t *this; private_ietf_attr_pa_tnc_error_t *this;
if (vendor_id == PEN_IETF) if (error_code.vendor_id == PEN_IETF)
{ {
msg_info.len = PA_ERROR_MSG_INFO_SIZE; msg_info.len = PA_ERROR_MSG_INFO_SIZE;
} }
@@ -366,7 +344,6 @@ pa_tnc_attr_t *ietf_attr_pa_tnc_error_create(pen_t vendor_id,
INIT(this, INIT(this,
.public = { .public = {
.pa_tnc_attribute = { .pa_tnc_attribute = {
.get_vendor_id = _get_vendor_id,
.get_type = _get_type, .get_type = _get_type,
.get_value = _get_value, .get_value = _get_value,
.get_noskip_flag = _get_noskip_flag, .get_noskip_flag = _get_noskip_flag,
@@ -376,16 +353,13 @@ pa_tnc_attr_t *ietf_attr_pa_tnc_error_create(pen_t vendor_id,
.get_ref = _get_ref, .get_ref = _get_ref,
.destroy = _destroy, .destroy = _destroy,
}, },
.get_vendor_id = _get_error_vendor_id,
.get_error_code = _get_error_code, .get_error_code = _get_error_code,
.get_msg_info = _get_msg_info, .get_msg_info = _get_msg_info,
.get_attr_info = _get_attr_info, .get_attr_info = _get_attr_info,
.set_attr_info = _set_attr_info, .set_attr_info = _set_attr_info,
.get_offset = _get_offset, .get_offset = _get_offset,
}, },
.vendor_id = PEN_IETF, .type = { PEN_IETF, IETF_ATTR_PA_TNC_ERROR },
.type = IETF_ATTR_PA_TNC_ERROR,
.error_vendor_id = vendor_id,
.error_code = error_code, .error_code = error_code,
.msg_info = chunk_clone(msg_info), .msg_info = chunk_clone(msg_info),
.ref = 1, .ref = 1,
@@ -397,8 +371,7 @@ pa_tnc_attr_t *ietf_attr_pa_tnc_error_create(pen_t vendor_id,
/** /**
* Described in header. * Described in header.
*/ */
pa_tnc_attr_t *ietf_attr_pa_tnc_error_create_with_offset(pen_t vendor_id, pa_tnc_attr_t *ietf_attr_pa_tnc_error_create_with_offset(pen_type_t error_code,
u_int32_t error_code,
chunk_t msg_info, chunk_t msg_info,
u_int32_t error_offset) u_int32_t error_offset)
{ {
@@ -410,7 +383,6 @@ pa_tnc_attr_t *ietf_attr_pa_tnc_error_create_with_offset(pen_t vendor_id,
INIT(this, INIT(this,
.public = { .public = {
.pa_tnc_attribute = { .pa_tnc_attribute = {
.get_vendor_id = _get_vendor_id,
.get_type = _get_type, .get_type = _get_type,
.get_value = _get_value, .get_value = _get_value,
.get_noskip_flag = _get_noskip_flag, .get_noskip_flag = _get_noskip_flag,
@@ -420,16 +392,13 @@ pa_tnc_attr_t *ietf_attr_pa_tnc_error_create_with_offset(pen_t vendor_id,
.get_ref = _get_ref, .get_ref = _get_ref,
.destroy = _destroy, .destroy = _destroy,
}, },
.get_vendor_id = _get_error_vendor_id,
.get_error_code = _get_error_code, .get_error_code = _get_error_code,
.get_msg_info = _get_msg_info, .get_msg_info = _get_msg_info,
.get_attr_info = _get_attr_info, .get_attr_info = _get_attr_info,
.set_attr_info = _set_attr_info, .set_attr_info = _set_attr_info,
.get_offset = _get_offset, .get_offset = _get_offset,
}, },
.vendor_id = PEN_IETF, .type = { PEN_IETF, IETF_ATTR_PA_TNC_ERROR },
.type = IETF_ATTR_PA_TNC_ERROR,
.error_vendor_id = vendor_id,
.error_code = error_code, .error_code = error_code,
.msg_info = chunk_clone(msg_info), .msg_info = chunk_clone(msg_info),
.error_offset = error_offset, .error_offset = error_offset,
@@ -449,7 +418,6 @@ pa_tnc_attr_t *ietf_attr_pa_tnc_error_create_from_data(chunk_t data)
INIT(this, INIT(this,
.public = { .public = {
.pa_tnc_attribute = { .pa_tnc_attribute = {
.get_vendor_id = _get_vendor_id,
.get_type = _get_type, .get_type = _get_type,
.get_value = _get_value, .get_value = _get_value,
.build = _build, .build = _build,
@@ -457,15 +425,13 @@ pa_tnc_attr_t *ietf_attr_pa_tnc_error_create_from_data(chunk_t data)
.get_ref = _get_ref, .get_ref = _get_ref,
.destroy = _destroy, .destroy = _destroy,
}, },
.get_vendor_id = _get_error_vendor_id,
.get_error_code = _get_error_code, .get_error_code = _get_error_code,
.get_msg_info = _get_msg_info, .get_msg_info = _get_msg_info,
.get_attr_info = _get_attr_info, .get_attr_info = _get_attr_info,
.set_attr_info = _set_attr_info, .set_attr_info = _set_attr_info,
.get_offset = _get_offset, .get_offset = _get_offset,
}, },
.vendor_id = PEN_IETF, .type = { PEN_IETF, IETF_ATTR_PA_TNC_ERROR },
.type = IETF_ATTR_PA_TNC_ERROR,
.value = chunk_clone(data), .value = chunk_clone(data),
.ref = 1, .ref = 1,
); );
+7 -11
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2011 Andreas Steffen * Copyright (C) 2011-2012 Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil * HSR Hochschule fuer Technik Rapperswil
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
@@ -62,11 +62,11 @@ struct ietf_attr_pa_tnc_error_t {
pen_t (*get_vendor_id)(ietf_attr_pa_tnc_error_t *this); pen_t (*get_vendor_id)(ietf_attr_pa_tnc_error_t *this);
/** /**
* Get PA-TNC error code * Get Vendor-specific PA-TNC error code
* *
* @return error code * @return error code
*/ */
pa_tnc_error_code_t (*get_error_code)(ietf_attr_pa_tnc_error_t *this); pen_type_t (*get_error_code)(ietf_attr_pa_tnc_error_t *this);
/** /**
* Get first 8 bytes of erroneous PA-TNC message * Get first 8 bytes of erroneous PA-TNC message
@@ -101,26 +101,22 @@ struct ietf_attr_pa_tnc_error_t {
/** /**
* Creates an ietf_attr_pa_tnc_error_t object from an error code * Creates an ietf_attr_pa_tnc_error_t object from an error code
* *
* @param vendor_id PA-TNC error code vendor ID * @param error_code Vendor-specific PA-TNC error code
* @param error_code PA-TNC error code
* @param header PA-TNC message header (first 8 bytes) * @param header PA-TNC message header (first 8 bytes)
* *
*/ */
pa_tnc_attr_t* ietf_attr_pa_tnc_error_create(pen_t vendor_id, pa_tnc_attr_t* ietf_attr_pa_tnc_error_create(pen_type_t error_code,
u_int32_t error_code,
chunk_t header); chunk_t header);
/** /**
* Creates an ietf_attr_pa_tnc_error_t object from an error code with offset * Creates an ietf_attr_pa_tnc_error_t object from an error code with offset
* *
* @param vendor_id PA-TNC error code vendor ID * @param error_code Vendor-specifica PA-TNC error code
* @param error_code PA-TNC error code
* @param header PA-TNC message header (first 8 bytes) * @param header PA-TNC message header (first 8 bytes)
* @param error_offset PA-TNC error offset in bytes * @param error_offset PA-TNC error offset in bytes
* *
*/ */
pa_tnc_attr_t* ietf_attr_pa_tnc_error_create_with_offset(pen_t vendor_id, pa_tnc_attr_t* ietf_attr_pa_tnc_error_create_with_offset(pen_type_t error_code,
u_int32_t error_code,
chunk_t header, chunk_t header,
u_int32_t error_offset); u_int32_t error_offset);
+5 -20
View File
@@ -58,14 +58,9 @@ struct private_ietf_attr_port_filter_t {
ietf_attr_port_filter_t public; ietf_attr_port_filter_t public;
/** /**
* Attribute vendor ID * Vendor-specific attribute type
*/ */
pen_t vendor_id; pen_type_t type;
/**
* Attribute type
*/
u_int32_t type;
/** /**
* Attribute value * Attribute value
@@ -88,13 +83,7 @@ struct private_ietf_attr_port_filter_t {
refcount_t ref; refcount_t ref;
}; };
METHOD(pa_tnc_attr_t, get_vendor_id, pen_t, METHOD(pa_tnc_attr_t, get_type, pen_type_t,
private_ietf_attr_port_filter_t *this)
{
return this->vendor_id;
}
METHOD(pa_tnc_attr_t, get_type, u_int32_t,
private_ietf_attr_port_filter_t *this) private_ietf_attr_port_filter_t *this)
{ {
return this->type; return this->type;
@@ -236,7 +225,6 @@ pa_tnc_attr_t *ietf_attr_port_filter_create(void)
INIT(this, INIT(this,
.public = { .public = {
.pa_tnc_attribute = { .pa_tnc_attribute = {
.get_vendor_id = _get_vendor_id,
.get_type = _get_type, .get_type = _get_type,
.get_value = _get_value, .get_value = _get_value,
.get_noskip_flag = _get_noskip_flag, .get_noskip_flag = _get_noskip_flag,
@@ -249,8 +237,7 @@ pa_tnc_attr_t *ietf_attr_port_filter_create(void)
.add_port = _add_port, .add_port = _add_port,
.create_port_enumerator = _create_port_enumerator, .create_port_enumerator = _create_port_enumerator,
}, },
.vendor_id = PEN_IETF, .type = { PEN_IETF, IETF_ATTR_PORT_FILTER },
.type = IETF_ATTR_PORT_FILTER,
.ports = linked_list_create(), .ports = linked_list_create(),
.ref = 1, .ref = 1,
); );
@@ -268,7 +255,6 @@ pa_tnc_attr_t *ietf_attr_port_filter_create_from_data(chunk_t data)
INIT(this, INIT(this,
.public = { .public = {
.pa_tnc_attribute = { .pa_tnc_attribute = {
.get_vendor_id = _get_vendor_id,
.get_type = _get_type, .get_type = _get_type,
.get_value = _get_value, .get_value = _get_value,
.build = _build, .build = _build,
@@ -279,8 +265,7 @@ pa_tnc_attr_t *ietf_attr_port_filter_create_from_data(chunk_t data)
.add_port = _add_port, .add_port = _add_port,
.create_port_enumerator = _create_port_enumerator, .create_port_enumerator = _create_port_enumerator,
}, },
.vendor_id = PEN_IETF, .type = {PEN_IETF, IETF_ATTR_PORT_FILTER },
.type = IETF_ATTR_PORT_FILTER,
.value = chunk_clone(data), .value = chunk_clone(data),
.ports = linked_list_create(), .ports = linked_list_create(),
.ref = 1, .ref = 1,
+5 -20
View File
@@ -46,14 +46,9 @@ struct private_ietf_attr_product_info_t {
ietf_attr_product_info_t public; ietf_attr_product_info_t public;
/** /**
* Attribute vendor ID * Vendor-specific attribute type
*/ */
pen_t vendor_id; pen_type_t type;
/**
* Attribute type
*/
u_int32_t type;
/** /**
* Attribute value * Attribute value
@@ -86,13 +81,7 @@ struct private_ietf_attr_product_info_t {
refcount_t ref; refcount_t ref;
}; };
METHOD(pa_tnc_attr_t, get_vendor_id, pen_t, METHOD(pa_tnc_attr_t, get_type, pen_type_t,
private_ietf_attr_product_info_t *this)
{
return this->vendor_id;
}
METHOD(pa_tnc_attr_t, get_type, u_int32_t,
private_ietf_attr_product_info_t *this) private_ietf_attr_product_info_t *this)
{ {
return this->type; return this->type;
@@ -205,7 +194,6 @@ pa_tnc_attr_t *ietf_attr_product_info_create(pen_t vendor_id, u_int16_t id,
INIT(this, INIT(this,
.public = { .public = {
.pa_tnc_attribute = { .pa_tnc_attribute = {
.get_vendor_id = _get_vendor_id,
.get_type = _get_type, .get_type = _get_type,
.get_value = _get_value, .get_value = _get_value,
.get_noskip_flag = _get_noskip_flag, .get_noskip_flag = _get_noskip_flag,
@@ -217,8 +205,7 @@ pa_tnc_attr_t *ietf_attr_product_info_create(pen_t vendor_id, u_int16_t id,
}, },
.get_info = _get_info, .get_info = _get_info,
}, },
.vendor_id = PEN_IETF, .type = { PEN_IETF, IETF_ATTR_PRODUCT_INFORMATION },
.type = IETF_ATTR_PRODUCT_INFORMATION,
.product_vendor_id = vendor_id, .product_vendor_id = vendor_id,
.product_id = id, .product_id = id,
.product_name = strdup(name), .product_name = strdup(name),
@@ -238,7 +225,6 @@ pa_tnc_attr_t *ietf_attr_product_info_create_from_data(chunk_t data)
INIT(this, INIT(this,
.public = { .public = {
.pa_tnc_attribute = { .pa_tnc_attribute = {
.get_vendor_id = _get_vendor_id,
.get_type = _get_type, .get_type = _get_type,
.get_value = _get_value, .get_value = _get_value,
.build = _build, .build = _build,
@@ -248,8 +234,7 @@ pa_tnc_attr_t *ietf_attr_product_info_create_from_data(chunk_t data)
}, },
.get_info = _get_info, .get_info = _get_info,
}, },
.vendor_id = PEN_IETF, .type = { PEN_IETF, IETF_ATTR_PRODUCT_INFORMATION },
.type = IETF_ATTR_PRODUCT_INFORMATION,
.value = chunk_clone(data), .value = chunk_clone(data),
.ref = 1, .ref = 1,
); );
+5 -20
View File
@@ -33,14 +33,9 @@ struct private_ita_attr_command_t {
ita_attr_command_t public; ita_attr_command_t public;
/** /**
* Attribute vendor ID * Vendor-specific attribute type
*/ */
pen_t vendor_id; pen_type_t type;
/**
* Attribute type
*/
u_int32_t type;
/** /**
* Attribute value * Attribute value
@@ -63,13 +58,7 @@ struct private_ita_attr_command_t {
refcount_t ref; refcount_t ref;
}; };
METHOD(pa_tnc_attr_t, get_vendor_id, pen_t, METHOD(pa_tnc_attr_t, get_type, pen_type_t,
private_ita_attr_command_t *this)
{
return this->vendor_id;
}
METHOD(pa_tnc_attr_t, get_type, u_int32_t,
private_ita_attr_command_t *this) private_ita_attr_command_t *this)
{ {
return this->type; return this->type;
@@ -148,7 +137,6 @@ pa_tnc_attr_t *ita_attr_command_create(char *command)
INIT(this, INIT(this,
.public = { .public = {
.pa_tnc_attribute = { .pa_tnc_attribute = {
.get_vendor_id = _get_vendor_id,
.get_type = _get_type, .get_type = _get_type,
.get_value = _get_value, .get_value = _get_value,
.get_noskip_flag = _get_noskip_flag, .get_noskip_flag = _get_noskip_flag,
@@ -160,8 +148,7 @@ pa_tnc_attr_t *ita_attr_command_create(char *command)
}, },
.get_command = _get_command, .get_command = _get_command,
}, },
.vendor_id = PEN_ITA, .type = { PEN_ITA, ITA_ATTR_COMMAND },
.type = ITA_ATTR_COMMAND,
.command = strdup(command), .command = strdup(command),
.ref = 1, .ref = 1,
); );
@@ -179,7 +166,6 @@ pa_tnc_attr_t *ita_attr_command_create_from_data(chunk_t data)
INIT(this, INIT(this,
.public = { .public = {
.pa_tnc_attribute = { .pa_tnc_attribute = {
.get_vendor_id = _get_vendor_id,
.get_type = _get_type, .get_type = _get_type,
.get_value = _get_value, .get_value = _get_value,
.build = _build, .build = _build,
@@ -189,8 +175,7 @@ pa_tnc_attr_t *ita_attr_command_create_from_data(chunk_t data)
}, },
.get_command = _get_command, .get_command = _get_command,
}, },
.vendor_id = PEN_ITA, .type = {PEN_ITA, ITA_ATTR_COMMAND },
.type = ITA_ATTR_COMMAND,
.value = chunk_clone(data), .value = chunk_clone(data),
.ref = 1, .ref = 1,
); );
+5 -20
View File
@@ -33,14 +33,9 @@ struct private_ita_attr_dummy_t {
ita_attr_dummy_t public; ita_attr_dummy_t public;
/** /**
* Attribute vendor ID * Vendor-specific attribute type
*/ */
pen_t vendor_id; pen_type_t type;
/**
* Attribute type
*/
u_int32_t type;
/** /**
* Attribute value * Attribute value
@@ -63,13 +58,7 @@ struct private_ita_attr_dummy_t {
refcount_t ref; refcount_t ref;
}; };
METHOD(pa_tnc_attr_t, get_vendor_id, pen_t, METHOD(pa_tnc_attr_t, get_type, pen_type_t,
private_ita_attr_dummy_t *this)
{
return this->vendor_id;
}
METHOD(pa_tnc_attr_t, get_type, u_int32_t,
private_ita_attr_dummy_t *this) private_ita_attr_dummy_t *this)
{ {
return this->type; return this->type;
@@ -145,7 +134,6 @@ pa_tnc_attr_t *ita_attr_dummy_create(int size)
INIT(this, INIT(this,
.public = { .public = {
.pa_tnc_attribute = { .pa_tnc_attribute = {
.get_vendor_id = _get_vendor_id,
.get_type = _get_type, .get_type = _get_type,
.get_value = _get_value, .get_value = _get_value,
.get_noskip_flag = _get_noskip_flag, .get_noskip_flag = _get_noskip_flag,
@@ -157,8 +145,7 @@ pa_tnc_attr_t *ita_attr_dummy_create(int size)
}, },
.get_size = _get_size, .get_size = _get_size,
}, },
.vendor_id = PEN_ITA, .type = { PEN_ITA, ITA_ATTR_DUMMY },
.type = ITA_ATTR_DUMMY,
.size = size, .size = size,
.ref = 1, .ref = 1,
); );
@@ -176,7 +163,6 @@ pa_tnc_attr_t *ita_attr_dummy_create_from_data(chunk_t data)
INIT(this, INIT(this,
.public = { .public = {
.pa_tnc_attribute = { .pa_tnc_attribute = {
.get_vendor_id = _get_vendor_id,
.get_type = _get_type, .get_type = _get_type,
.get_value = _get_value, .get_value = _get_value,
.build = _build, .build = _build,
@@ -186,8 +172,7 @@ pa_tnc_attr_t *ita_attr_dummy_create_from_data(chunk_t data)
}, },
.get_size = _get_size, .get_size = _get_size,
}, },
.vendor_id = PEN_ITA, .type = { PEN_ITA, ITA_ATTR_DUMMY },
.type = ITA_ATTR_DUMMY,
.value = chunk_clone(data), .value = chunk_clone(data),
.ref = 1, .ref = 1,
); );
+4 -11
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2011 Andreas Steffen * Copyright (C) 2011-2012 Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil * HSR Hochschule fuer Technik Rapperswil
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
@@ -33,18 +33,11 @@ typedef struct pa_tnc_attr_t pa_tnc_attr_t;
struct pa_tnc_attr_t { struct pa_tnc_attr_t {
/** /**
* Get the vendor ID of an PA-TNC attribute * Get the vendor ID/type of an PA-TNC attribute
* *
* @return attribute vendor ID * @return vendor-specific attribute type
*/ */
u_int32_t (*get_vendor_id)(pa_tnc_attr_t *this); pen_type_t (*get_type)(pa_tnc_attr_t *this);
/**
* Get the type of an PA-TNC attribute
*
* @return attribute type
*/
u_int32_t (*get_type)(pa_tnc_attr_t *this);
/** /**
* Get the value of an PA-TNC attribute * Get the value of an PA-TNC attribute
+41 -34
View File
@@ -138,8 +138,7 @@ METHOD(pa_tnc_msg_t, build, bool,
enumerator_t *enumerator; enumerator_t *enumerator;
pa_tnc_attr_t *attr; pa_tnc_attr_t *attr;
enum_name_t *pa_attr_names; enum_name_t *pa_attr_names;
pen_t vendor_id; pen_type_t type;
u_int32_t type;
u_int8_t flags; u_int8_t flags;
chunk_t value; chunk_t value;
nonce_gen_t *ng; nonce_gen_t *ng;
@@ -165,31 +164,30 @@ METHOD(pa_tnc_msg_t, build, bool,
enumerator = this->attributes->create_enumerator(this->attributes); enumerator = this->attributes->create_enumerator(this->attributes);
while (enumerator->enumerate(enumerator, &attr)) while (enumerator->enumerate(enumerator, &attr))
{ {
vendor_id = attr->get_vendor_id(attr); type = attr->get_type(attr);
type = attr->get_type(attr);
value = attr->get_value(attr); value = attr->get_value(attr);
flags = attr->get_noskip_flag(attr) ? PA_TNC_ATTR_FLAG_NOSKIP : flags = attr->get_noskip_flag(attr) ? PA_TNC_ATTR_FLAG_NOSKIP :
PA_TNC_ATTR_FLAG_NONE; PA_TNC_ATTR_FLAG_NONE;
pa_attr_names = imcv_pa_tnc_attributes->get_names(imcv_pa_tnc_attributes, pa_attr_names = imcv_pa_tnc_attributes->get_names(imcv_pa_tnc_attributes,
vendor_id); type.vendor_id);
if (pa_attr_names) if (pa_attr_names)
{ {
DBG2(DBG_TNC, "creating PA-TNC attribute type '%N/%N' " DBG2(DBG_TNC, "creating PA-TNC attribute type '%N/%N' "
"0x%06x/0x%08x", pen_names, vendor_id, "0x%06x/0x%08x", pen_names, type.vendor_id,
pa_attr_names, type, vendor_id, type); pa_attr_names, type.type, type.vendor_id, type.type);
} }
else else
{ {
DBG2(DBG_TNC, "creating PA-TNC attribute type '%N' " DBG2(DBG_TNC, "creating PA-TNC attribute type '%N' "
"0x%06x/0x%08x", pen_names, vendor_id, "0x%06x/0x%08x", pen_names, type.vendor_id,
vendor_id, type); type.vendor_id, type.type);
} }
DBG3(DBG_TNC, "%B", &value); DBG3(DBG_TNC, "%B", &value);
writer->write_uint8 (writer, flags); writer->write_uint8 (writer, flags);
writer->write_uint24(writer, vendor_id); writer->write_uint24(writer, type.vendor_id);
writer->write_uint32(writer, type); writer->write_uint32(writer, type.type);
writer->write_uint32(writer, PA_TNC_ATTR_HEADER_SIZE + value.len); writer->write_uint32(writer, PA_TNC_ATTR_HEADER_SIZE + value.len);
writer->write_data (writer, value); writer->write_data (writer, value);
} }
@@ -209,6 +207,7 @@ METHOD(pa_tnc_msg_t, process, status_t,
pa_tnc_attr_t *error; pa_tnc_attr_t *error;
u_int8_t version; u_int8_t version;
u_int32_t reserved, offset, attr_offset; u_int32_t reserved, offset, attr_offset;
pen_type_t error_code;
/* process message header */ /* process message header */
if (this->encoding.len < PA_TNC_HEADER_SIZE) if (this->encoding.len < PA_TNC_HEADER_SIZE)
@@ -225,9 +224,10 @@ METHOD(pa_tnc_msg_t, process, status_t,
if (version != PA_TNC_VERSION) if (version != PA_TNC_VERSION)
{ {
pen_type_t error_code = { PEN_IETF, PA_ERROR_VERSION_NOT_SUPPORTED };
DBG1(DBG_TNC, "PA-TNC version %u not supported", version); DBG1(DBG_TNC, "PA-TNC version %u not supported", version);
error = ietf_attr_pa_tnc_error_create(PEN_IETF, error = ietf_attr_pa_tnc_error_create(error_code, this->encoding);
PA_ERROR_VERSION_NOT_SUPPORTED, this->encoding);
goto err; goto err;
} }
@@ -244,6 +244,7 @@ METHOD(pa_tnc_msg_t, process, status_t,
pa_tnc_attr_t *attr; pa_tnc_attr_t *attr;
enum_name_t *pa_attr_names; enum_name_t *pa_attr_names;
ietf_attr_pa_tnc_error_t *error_attr; ietf_attr_pa_tnc_error_t *error_attr;
pen_type_t error_code;
attr_info = reader->peek(reader); attr_info = reader->peek(reader);
attr_info.len = PA_TNC_ATTR_INFO_SIZE; attr_info.len = PA_TNC_ATTR_INFO_SIZE;
@@ -271,18 +272,18 @@ METHOD(pa_tnc_msg_t, process, status_t,
{ {
DBG1(DBG_TNC, "%u bytes too small for PA-TNC attribute length", DBG1(DBG_TNC, "%u bytes too small for PA-TNC attribute length",
length); length);
error = ietf_attr_pa_tnc_error_create_with_offset(PEN_IETF, error_code = pen_type_create(PEN_IETF, PA_ERROR_INVALID_PARAMETER);
PA_ERROR_INVALID_PARAMETER, this->encoding, error = ietf_attr_pa_tnc_error_create_with_offset(error_code,
offset + PA_TNC_ATTR_INFO_SIZE); this->encoding, offset + PA_TNC_ATTR_INFO_SIZE);
goto err; goto err;
} }
if (!reader->read_data(reader, length - PA_TNC_ATTR_HEADER_SIZE, &value)) if (!reader->read_data(reader, length - PA_TNC_ATTR_HEADER_SIZE, &value))
{ {
DBG1(DBG_TNC, "insufficient bytes for PA-TNC attribute value"); DBG1(DBG_TNC, "insufficient bytes for PA-TNC attribute value");
error = ietf_attr_pa_tnc_error_create_with_offset(PEN_IETF, error_code = pen_type_create(PEN_IETF, PA_ERROR_INVALID_PARAMETER);
PA_ERROR_INVALID_PARAMETER, this->encoding, error = ietf_attr_pa_tnc_error_create_with_offset(error_code,
offset + PA_TNC_ATTR_INFO_SIZE); this->encoding, offset + PA_TNC_ATTR_INFO_SIZE);
goto err; goto err;
} }
DBG3(DBG_TNC, "%B", &value); DBG3(DBG_TNC, "%B", &value);
@@ -294,8 +295,10 @@ METHOD(pa_tnc_msg_t, process, status_t,
if (flags & PA_TNC_ATTR_FLAG_NOSKIP) if (flags & PA_TNC_ATTR_FLAG_NOSKIP)
{ {
DBG1(DBG_TNC, "unsupported PA-TNC attribute with NOSKIP flag"); DBG1(DBG_TNC, "unsupported PA-TNC attribute with NOSKIP flag");
error = ietf_attr_pa_tnc_error_create(PEN_IETF, error_code = pen_type_create(PEN_IETF,
PA_ERROR_ATTR_TYPE_NOT_SUPPORTED, this->encoding); PA_ERROR_ATTR_TYPE_NOT_SUPPORTED);
error = ietf_attr_pa_tnc_error_create(error_code,
this->encoding);
error_attr = (ietf_attr_pa_tnc_error_t*)error; error_attr = (ietf_attr_pa_tnc_error_t*)error;
error_attr->set_attr_info(error_attr, attr_info); error_attr->set_attr_info(error_attr, attr_info);
goto err; goto err;
@@ -311,14 +314,17 @@ METHOD(pa_tnc_msg_t, process, status_t,
if (attr->process(attr, &attr_offset) != SUCCESS) if (attr->process(attr, &attr_offset) != SUCCESS)
{ {
attr->destroy(attr); attr->destroy(attr);
if (vendor_id == PEN_IETF && type == IETF_ATTR_PA_TNC_ERROR) if (error_code.vendor_id == PEN_IETF &&
error_code.type == IETF_ATTR_PA_TNC_ERROR)
{ {
/* error while processing a PA-TNC error attribute - abort */ /* error while processing a PA-TNC error attribute - abort */
reader->destroy(reader); reader->destroy(reader);
return FAILED; return FAILED;
} }
error = ietf_attr_pa_tnc_error_create_with_offset(PEN_IETF, error_code = pen_type_create(PEN_IETF,
PA_ERROR_INVALID_PARAMETER, this->encoding, PA_ERROR_ATTR_TYPE_NOT_SUPPORTED);
error = ietf_attr_pa_tnc_error_create_with_offset(error_code,
this->encoding,
offset + PA_TNC_ATTR_HEADER_SIZE + attr_offset); offset + PA_TNC_ATTR_HEADER_SIZE + attr_offset);
goto err; goto err;
} }
@@ -332,8 +338,9 @@ METHOD(pa_tnc_msg_t, process, status_t,
return SUCCESS; return SUCCESS;
} }
DBG1(DBG_TNC, "insufficient bytes for PA-TNC attribute header"); DBG1(DBG_TNC, "insufficient bytes for PA-TNC attribute header");
error = ietf_attr_pa_tnc_error_create_with_offset(PEN_IETF, error_code = pen_type_create(PEN_IETF, PA_ERROR_INVALID_PARAMETER);
PA_ERROR_INVALID_PARAMETER, this->encoding, offset); error = ietf_attr_pa_tnc_error_create_with_offset(error_code,
this->encoding, offset);
err: err:
reader->destroy(reader); reader->destroy(reader);
@@ -346,35 +353,35 @@ METHOD(pa_tnc_msg_t, process_ietf_std_errors, bool,
{ {
enumerator_t *enumerator; enumerator_t *enumerator;
pa_tnc_attr_t *attr; pa_tnc_attr_t *attr;
pen_type_t type;
bool fatal_error = FALSE; bool fatal_error = FALSE;
enumerator = this->attributes->create_enumerator(this->attributes); enumerator = this->attributes->create_enumerator(this->attributes);
while (enumerator->enumerate(enumerator, &attr)) while (enumerator->enumerate(enumerator, &attr))
{ {
if (attr->get_vendor_id(attr) == PEN_IETF && type = attr->get_type(attr);
attr->get_type(attr) == IETF_ATTR_PA_TNC_ERROR)
if (type.vendor_id == PEN_IETF && type.type == IETF_ATTR_PA_TNC_ERROR)
{ {
ietf_attr_pa_tnc_error_t *error_attr; ietf_attr_pa_tnc_error_t *error_attr;
pen_t error_vendor_id; pen_type_t error_code;
pa_tnc_error_code_t error_code;
chunk_t msg_info, attr_info; chunk_t msg_info, attr_info;
u_int32_t offset; u_int32_t offset;
error_attr = (ietf_attr_pa_tnc_error_t*)attr; error_attr = (ietf_attr_pa_tnc_error_t*)attr;
error_vendor_id = error_attr->get_vendor_id(error_attr);
error_code = error_attr->get_error_code(error_attr); error_code = error_attr->get_error_code(error_attr);
msg_info = error_attr->get_msg_info(error_attr); msg_info = error_attr->get_msg_info(error_attr);
/* skip errors from non-IETF namespaces */ /* skip errors from non-IETF namespaces */
if (error_vendor_id != PEN_IETF) if (error_code.vendor_id != PEN_IETF)
{ {
continue; continue;
} }
DBG1(DBG_IMC, "received PA-TNC error '%N' concerning message " DBG1(DBG_IMC, "received PA-TNC error '%N' concerning message "
"0x%08x/0x%08x", pa_tnc_error_code_names, error_code, "0x%08x/0x%08x", pa_tnc_error_code_names, error_code.type,
untoh32(msg_info.ptr), untoh32(msg_info.ptr + 4)); untoh32(msg_info.ptr), untoh32(msg_info.ptr + 4));
switch (error_code) switch (error_code.type)
{ {
case PA_ERROR_INVALID_PARAMETER: case PA_ERROR_INVALID_PARAMETER:
offset = error_attr->get_offset(error_attr); offset = error_attr->get_offset(error_attr);
+6 -3
View File
@@ -257,6 +257,7 @@ static TNC_Result receive_message(TNC_IMCID imc_id,
{ {
pa_tnc_msg_t *pa_tnc_msg; pa_tnc_msg_t *pa_tnc_msg;
pa_tnc_attr_t *attr; pa_tnc_attr_t *attr;
pen_type_t attr_type;
imc_state_t *state; imc_state_t *state;
enumerator_t *enumerator; enumerator_t *enumerator;
TNC_Result result; TNC_Result result;
@@ -291,11 +292,13 @@ static TNC_Result receive_message(TNC_IMCID imc_id,
enumerator = pa_tnc_msg->create_attribute_enumerator(pa_tnc_msg); enumerator = pa_tnc_msg->create_attribute_enumerator(pa_tnc_msg);
while (enumerator->enumerate(enumerator, &attr)) while (enumerator->enumerate(enumerator, &attr))
{ {
if (attr->get_vendor_id(attr) != PEN_ITA) attr_type = attr->get_type(attr);
if (attr_type.vendor_id != PEN_ITA)
{ {
continue; continue;
} }
if (attr->get_type(attr) == ITA_ATTR_COMMAND) if (attr_type.type == ITA_ATTR_COMMAND)
{ {
ita_attr_command_t *ita_attr; ita_attr_command_t *ita_attr;
@@ -303,7 +306,7 @@ static TNC_Result receive_message(TNC_IMCID imc_id,
DBG1(DBG_IMC, "received command '%s'", DBG1(DBG_IMC, "received command '%s'",
ita_attr->get_command(ita_attr)); ita_attr->get_command(ita_attr));
} }
else if (attr->get_type(attr) == ITA_ATTR_DUMMY) else if (attr_type.type == ITA_ATTR_DUMMY)
{ {
ita_attr_dummy_t *ita_attr; ita_attr_dummy_t *ita_attr;
@@ -187,6 +187,7 @@ static TNC_Result receive_message(TNC_IMVID imv_id,
{ {
pa_tnc_msg_t *pa_tnc_msg; pa_tnc_msg_t *pa_tnc_msg;
pa_tnc_attr_t *attr; pa_tnc_attr_t *attr;
pen_type_t type;
imv_state_t *state; imv_state_t *state;
enumerator_t *enumerator; enumerator_t *enumerator;
TNC_Result result; TNC_Result result;
@@ -221,8 +222,9 @@ static TNC_Result receive_message(TNC_IMVID imv_id,
enumerator = pa_tnc_msg->create_attribute_enumerator(pa_tnc_msg); enumerator = pa_tnc_msg->create_attribute_enumerator(pa_tnc_msg);
while (enumerator->enumerate(enumerator, &attr)) while (enumerator->enumerate(enumerator, &attr))
{ {
if (attr->get_vendor_id(attr) == PEN_IETF && type = attr->get_type(attr);
attr->get_type(attr) == IETF_ATTR_PORT_FILTER)
if (type.vendor_id == PEN_IETF && type.type == IETF_ATTR_PORT_FILTER)
{ {
ietf_attr_port_filter_t *attr_port_filter; ietf_attr_port_filter_t *attr_port_filter;
enumerator_t *enumerator; enumerator_t *enumerator;
+6 -3
View File
@@ -103,6 +103,7 @@ static TNC_Result receive_message(TNC_IMVID imv_id,
{ {
pa_tnc_msg_t *pa_tnc_msg; pa_tnc_msg_t *pa_tnc_msg;
pa_tnc_attr_t *attr; pa_tnc_attr_t *attr;
pen_type_t attr_type;
linked_list_t *attr_list; linked_list_t *attr_list;
imv_state_t *state; imv_state_t *state;
imv_test_state_t *test_state; imv_test_state_t *test_state;
@@ -146,11 +147,13 @@ static TNC_Result receive_message(TNC_IMVID imv_id,
enumerator = pa_tnc_msg->create_attribute_enumerator(pa_tnc_msg); enumerator = pa_tnc_msg->create_attribute_enumerator(pa_tnc_msg);
while (enumerator->enumerate(enumerator, &attr)) while (enumerator->enumerate(enumerator, &attr))
{ {
if (attr->get_vendor_id(attr) != PEN_ITA) attr_type = attr->get_type(attr);
if (attr_type.vendor_id != PEN_ITA)
{ {
continue; continue;
} }
if (attr->get_type(attr) == ITA_ATTR_COMMAND) if (attr_type.type == ITA_ATTR_COMMAND)
{ {
ita_attr_command_t *ita_attr; ita_attr_command_t *ita_attr;
char *command; char *command;
@@ -189,7 +192,7 @@ static TNC_Result receive_message(TNC_IMVID imv_id,
TNC_IMV_EVALUATION_RESULT_ERROR); TNC_IMV_EVALUATION_RESULT_ERROR);
} }
} }
else if (attr->get_type(attr) == ITA_ATTR_DUMMY) else if (attr_type.type == ITA_ATTR_DUMMY)
{ {
ita_attr_dummy_t *ita_attr; ita_attr_dummy_t *ita_attr;
@@ -174,6 +174,7 @@ static TNC_Result receive_message(TNC_IMCID imc_id,
{ {
pa_tnc_msg_t *pa_tnc_msg; pa_tnc_msg_t *pa_tnc_msg;
pa_tnc_attr_t *attr; pa_tnc_attr_t *attr;
pen_type_t type;
linked_list_t *attr_list; linked_list_t *attr_list;
imc_state_t *state; imc_state_t *state;
imc_attestation_state_t *attestation_state; imc_attestation_state_t *attestation_state;
@@ -213,30 +214,29 @@ static TNC_Result receive_message(TNC_IMCID imc_id,
enumerator = pa_tnc_msg->create_attribute_enumerator(pa_tnc_msg); enumerator = pa_tnc_msg->create_attribute_enumerator(pa_tnc_msg);
while (enumerator->enumerate(enumerator, &attr)) while (enumerator->enumerate(enumerator, &attr))
{ {
if (attr->get_vendor_id(attr) == PEN_IETF && type = attr->get_type(attr);
attr->get_type(attr) == IETF_ATTR_PA_TNC_ERROR)
if (type.vendor_id == PEN_IETF && type.type == IETF_ATTR_PA_TNC_ERROR)
{ {
ietf_attr_pa_tnc_error_t *error_attr; ietf_attr_pa_tnc_error_t *error_attr;
pen_t error_vendor_id; pen_type_t error_code;
pa_tnc_error_code_t error_code;
chunk_t msg_info; chunk_t msg_info;
error_attr = (ietf_attr_pa_tnc_error_t*)attr; error_attr = (ietf_attr_pa_tnc_error_t*)attr;
error_vendor_id = error_attr->get_vendor_id(error_attr); error_code = error_attr->get_error_code(error_attr);
if (error_vendor_id == PEN_TCG) if (error_code.vendor_id == PEN_TCG)
{ {
error_code = error_attr->get_error_code(error_attr);
msg_info = error_attr->get_msg_info(error_attr); msg_info = error_attr->get_msg_info(error_attr);
DBG1(DBG_IMC, "received TCG-PTS error '%N'", DBG1(DBG_IMC, "received TCG-PTS error '%N'",
pts_error_code_names, error_code); pts_error_code_names, error_code.type);
DBG1(DBG_IMC, "error information: %B", &msg_info); DBG1(DBG_IMC, "error information: %B", &msg_info);
result = TNC_RESULT_FATAL; result = TNC_RESULT_FATAL;
} }
} }
else if (attr->get_vendor_id(attr) == PEN_TCG) else if (type.vendor_id == PEN_TCG)
{ {
if (!imc_attestation_process(attr, attr_list, attestation_state, if (!imc_attestation_process(attr, attr_list, attestation_state,
supported_algorithms, supported_dh_groups)) supported_algorithms, supported_dh_groups))
@@ -56,10 +56,13 @@ bool imc_attestation_process(pa_tnc_attr_t *attr, linked_list_t *attr_list,
chunk_t attr_info; chunk_t attr_info;
pts_t *pts; pts_t *pts;
pts_error_code_t pts_error; pts_error_code_t pts_error;
pen_type_t attr_type;
bool valid_path; bool valid_path;
pts = attestation_state->get_pts(attestation_state); pts = attestation_state->get_pts(attestation_state);
switch (attr->get_type(attr)) attr_type = attr->get_type(attr);
switch (attr_type.type)
{ {
case TCG_PTS_REQ_PROTO_CAPS: case TCG_PTS_REQ_PROTO_CAPS:
{ {
@@ -181,12 +184,12 @@ bool imc_attestation_process(pa_tnc_attr_t *attr, linked_list_t *attr_list,
case TCG_PTS_GET_TPM_VERSION_INFO: case TCG_PTS_GET_TPM_VERSION_INFO:
{ {
chunk_t tpm_version_info, attr_info; chunk_t tpm_version_info, attr_info;
pen_type_t error_code = { PEN_TCG, TCG_PTS_TPM_VERS_NOT_SUPPORTED };
if (!pts->get_tpm_version_info(pts, &tpm_version_info)) if (!pts->get_tpm_version_info(pts, &tpm_version_info))
{ {
attr_info = attr->get_value(attr); attr_info = attr->get_value(attr);
attr = ietf_attr_pa_tnc_error_create(PEN_TCG, attr = ietf_attr_pa_tnc_error_create(error_code, attr_info);
TCG_PTS_TPM_VERS_NOT_SUPPORTED, attr_info);
attr_list->insert_last(attr_list, attr); attr_list->insert_last(attr_list, attr);
break; break;
} }
@@ -220,6 +223,7 @@ bool imc_attestation_process(pa_tnc_attr_t *attr, linked_list_t *attr_list,
bool is_directory; bool is_directory;
u_int32_t delimiter; u_int32_t delimiter;
pts_file_meas_t *measurements; pts_file_meas_t *measurements;
pen_type_t error_code;
attr_info = attr->get_value(attr); attr_info = attr->get_value(attr);
attr_cast = (tcg_pts_attr_req_file_meas_t*)attr; attr_cast = (tcg_pts_attr_req_file_meas_t*)attr;
@@ -231,8 +235,8 @@ bool imc_attestation_process(pa_tnc_attr_t *attr, linked_list_t *attr_list,
if (valid_path && pts_error) if (valid_path && pts_error)
{ {
attr = ietf_attr_pa_tnc_error_create(PEN_TCG, error_code = pen_type_create(PEN_TCG, pts_error);
pts_error, attr_info); attr = ietf_attr_pa_tnc_error_create(error_code, attr_info);
attr_list->insert_last(attr_list, attr); attr_list->insert_last(attr_list, attr);
break; break;
} }
@@ -243,8 +247,9 @@ bool imc_attestation_process(pa_tnc_attr_t *attr, linked_list_t *attr_list,
if (delimiter != SOLIDUS_UTF && delimiter != REVERSE_SOLIDUS_UTF) if (delimiter != SOLIDUS_UTF && delimiter != REVERSE_SOLIDUS_UTF)
{ {
attr = ietf_attr_pa_tnc_error_create(PEN_TCG, error_code = pen_type_create(PEN_TCG,
TCG_PTS_INVALID_DELIMITER, attr_info); TCG_PTS_INVALID_DELIMITER);
attr = ietf_attr_pa_tnc_error_create(error_code, attr_info);
attr_list->insert_last(attr_list, attr); attr_list->insert_last(attr_list, attr);
break; break;
} }
@@ -273,6 +278,7 @@ bool imc_attestation_process(pa_tnc_attr_t *attr, linked_list_t *attr_list,
bool is_directory; bool is_directory;
u_int8_t delimiter; u_int8_t delimiter;
pts_file_meta_t *metadata; pts_file_meta_t *metadata;
pen_type_t error_code;
attr_info = attr->get_value(attr); attr_info = attr->get_value(attr);
attr_cast = (tcg_pts_attr_req_file_meta_t*)attr; attr_cast = (tcg_pts_attr_req_file_meta_t*)attr;
@@ -283,8 +289,8 @@ bool imc_attestation_process(pa_tnc_attr_t *attr, linked_list_t *attr_list,
valid_path = pts->is_path_valid(pts, pathname, &pts_error); valid_path = pts->is_path_valid(pts, pathname, &pts_error);
if (valid_path && pts_error) if (valid_path && pts_error)
{ {
attr = ietf_attr_pa_tnc_error_create(PEN_TCG, error_code = pen_type_create(PEN_TCG, pts_error);
pts_error, attr_info); attr = ietf_attr_pa_tnc_error_create(error_code, attr_info);
attr_list->insert_last(attr_list, attr); attr_list->insert_last(attr_list, attr);
break; break;
} }
@@ -294,8 +300,9 @@ bool imc_attestation_process(pa_tnc_attr_t *attr, linked_list_t *attr_list,
} }
if (delimiter != SOLIDUS_UTF && delimiter != REVERSE_SOLIDUS_UTF) if (delimiter != SOLIDUS_UTF && delimiter != REVERSE_SOLIDUS_UTF)
{ {
attr = ietf_attr_pa_tnc_error_create(PEN_TCG, error_code = pen_type_create(PEN_TCG,
TCG_PTS_INVALID_DELIMITER, attr_info); TCG_PTS_INVALID_DELIMITER);
attr = ietf_attr_pa_tnc_error_create(error_code, attr_info);
attr_list->insert_last(attr_list, attr); attr_list->insert_last(attr_list, attr);
break; break;
} }
@@ -323,6 +330,7 @@ bool imc_attestation_process(pa_tnc_attr_t *attr, linked_list_t *attr_list,
pts_comp_func_name_t *name; pts_comp_func_name_t *name;
pts_comp_evidence_t *evid; pts_comp_evidence_t *evid;
pts_component_t *comp; pts_component_t *comp;
pen_type_t error_code;
u_int32_t depth; u_int32_t depth;
u_int8_t flags; u_int8_t flags;
status_t status; status_t status;
@@ -342,32 +350,36 @@ bool imc_attestation_process(pa_tnc_attr_t *attr, linked_list_t *attr_list,
if (flags & PTS_REQ_FUNC_COMP_EVID_TTC) if (flags & PTS_REQ_FUNC_COMP_EVID_TTC)
{ {
attr = ietf_attr_pa_tnc_error_create(PEN_TCG, error_code = pen_type_create(PEN_TCG,
TCG_PTS_UNABLE_DET_TTC, attr_info); TCG_PTS_UNABLE_DET_TTC);
attr = ietf_attr_pa_tnc_error_create(error_code, attr_info);
attr_list->insert_last(attr_list, attr); attr_list->insert_last(attr_list, attr);
break; break;
} }
if (flags & PTS_REQ_FUNC_COMP_EVID_VER && if (flags & PTS_REQ_FUNC_COMP_EVID_VER &&
!(negotiated_caps & PTS_PROTO_CAPS_V)) !(negotiated_caps & PTS_PROTO_CAPS_V))
{ {
attr = ietf_attr_pa_tnc_error_create(PEN_TCG, error_code = pen_type_create(PEN_TCG,
TCG_PTS_UNABLE_LOCAL_VAL, attr_info); TCG_PTS_UNABLE_LOCAL_VAL);
attr = ietf_attr_pa_tnc_error_create(error_code, attr_info);
attr_list->insert_last(attr_list, attr); attr_list->insert_last(attr_list, attr);
break; break;
} }
if (flags & PTS_REQ_FUNC_COMP_EVID_CURR && if (flags & PTS_REQ_FUNC_COMP_EVID_CURR &&
!(negotiated_caps & PTS_PROTO_CAPS_C)) !(negotiated_caps & PTS_PROTO_CAPS_C))
{ {
attr = ietf_attr_pa_tnc_error_create(PEN_TCG, error_code = pen_type_create(PEN_TCG,
TCG_PTS_UNABLE_CUR_EVID, attr_info); TCG_PTS_UNABLE_CUR_EVID);
attr = ietf_attr_pa_tnc_error_create(error_code, attr_info);
attr_list->insert_last(attr_list, attr); attr_list->insert_last(attr_list, attr);
break; break;
} }
if (flags & PTS_REQ_FUNC_COMP_EVID_PCR && if (flags & PTS_REQ_FUNC_COMP_EVID_PCR &&
!(negotiated_caps & PTS_PROTO_CAPS_T)) !(negotiated_caps & PTS_PROTO_CAPS_T))
{ {
attr = ietf_attr_pa_tnc_error_create(PEN_TCG, error_code = pen_type_create(PEN_TCG,
TCG_PTS_UNABLE_DET_PCR, attr_info); TCG_PTS_UNABLE_DET_PCR);
attr = ietf_attr_pa_tnc_error_create(error_code, attr_info);
attr_list->insert_last(attr_list, attr); attr_list->insert_last(attr_list, attr);
break; break;
} }
@@ -214,6 +214,7 @@ static TNC_Result receive_message(TNC_IMVID imv_id,
{ {
pa_tnc_msg_t *pa_tnc_msg; pa_tnc_msg_t *pa_tnc_msg;
pa_tnc_attr_t *attr; pa_tnc_attr_t *attr;
pen_type_t type;
linked_list_t *attr_list; linked_list_t *attr_list;
imv_state_t *state; imv_state_t *state;
imv_attestation_state_t *attestation_state; imv_attestation_state_t *attestation_state;
@@ -255,31 +256,31 @@ static TNC_Result receive_message(TNC_IMVID imv_id,
enumerator = pa_tnc_msg->create_attribute_enumerator(pa_tnc_msg); enumerator = pa_tnc_msg->create_attribute_enumerator(pa_tnc_msg);
while (enumerator->enumerate(enumerator, &attr)) while (enumerator->enumerate(enumerator, &attr))
{ {
if (attr->get_vendor_id(attr) == PEN_IETF) type = attr->get_type(attr);
if (type.vendor_id == PEN_IETF)
{ {
if (attr->get_type(attr) == IETF_ATTR_PA_TNC_ERROR) if (type.type == IETF_ATTR_PA_TNC_ERROR)
{ {
ietf_attr_pa_tnc_error_t *error_attr; ietf_attr_pa_tnc_error_t *error_attr;
pen_t error_vendor_id; pen_type_t error_code;
pa_tnc_error_code_t error_code;
chunk_t msg_info; chunk_t msg_info;
error_attr = (ietf_attr_pa_tnc_error_t*)attr; error_attr = (ietf_attr_pa_tnc_error_t*)attr;
error_vendor_id = error_attr->get_vendor_id(error_attr); error_code = error_attr->get_error_code(error_attr);
if (error_vendor_id == PEN_TCG) if (error_code.vendor_id == PEN_TCG)
{ {
error_code = error_attr->get_error_code(error_attr);
msg_info = error_attr->get_msg_info(error_attr); msg_info = error_attr->get_msg_info(error_attr);
DBG1(DBG_IMV, "received TCG-PTS error '%N'", DBG1(DBG_IMV, "received TCG-PTS error '%N'",
pts_error_code_names, error_code); pts_error_code_names, error_code.type);
DBG1(DBG_IMV, "error information: %B", &msg_info); DBG1(DBG_IMV, "error information: %B", &msg_info);
result = TNC_RESULT_FATAL; result = TNC_RESULT_FATAL;
} }
} }
else if (attr->get_type(attr) == IETF_ATTR_PRODUCT_INFORMATION) else if (type.type == IETF_ATTR_PRODUCT_INFORMATION)
{ {
ietf_attr_product_info_t *attr_cast; ietf_attr_product_info_t *attr_cast;
char *platform_info; char *platform_info;
@@ -289,7 +290,7 @@ static TNC_Result receive_message(TNC_IMVID imv_id,
pts->set_platform_info(pts, platform_info); pts->set_platform_info(pts, platform_info);
} }
} }
else if (attr->get_vendor_id(attr) == PEN_TCG) else if (type.vendor_id == PEN_TCG)
{ {
if (!imv_attestation_process(attr, attr_list, attestation_state, if (!imv_attestation_process(attr, attr_list, attestation_state,
supported_algorithms,supported_dh_groups, pts_db, pts_credmgr)) supported_algorithms,supported_dh_groups, pts_db, pts_credmgr))
@@ -41,11 +41,13 @@ bool imv_attestation_process(pa_tnc_attr_t *attr, linked_list_t *attr_list,
pts_database_t *pts_db, pts_database_t *pts_db,
credential_manager_t *pts_credmgr) credential_manager_t *pts_credmgr)
{ {
pen_type_t attr_type;
pts_t *pts; pts_t *pts;
pts = attestation_state->get_pts(attestation_state); pts = attestation_state->get_pts(attestation_state);
attr_type = attr->get_type(attr);
switch (attr->get_type(attr)) switch (attr_type.type)
{ {
case TCG_PTS_PROTO_CAPS: case TCG_PTS_PROTO_CAPS:
{ {
+6 -6
View File
@@ -46,13 +46,13 @@ pa_tnc_attr_t* pts_hash_alg_error_create(pts_meas_algorithms_t algorithms)
bio_writer_t *writer; bio_writer_t *writer;
chunk_t msg_info; chunk_t msg_info;
pa_tnc_attr_t *attr; pa_tnc_attr_t *attr;
pen_type_t error_code = { PEN_TCG, TCG_PTS_HASH_ALG_NOT_SUPPORTED };
writer = bio_writer_create(4); writer = bio_writer_create(4);
writer->write_uint16(writer, 0x0000); writer->write_uint16(writer, 0x0000);
writer->write_uint16(writer, algorithms); writer->write_uint16(writer, algorithms);
msg_info = writer->get_buf(writer); msg_info = writer->get_buf(writer);
attr = ietf_attr_pa_tnc_error_create(PEN_TCG, TCG_PTS_HASH_ALG_NOT_SUPPORTED, attr = ietf_attr_pa_tnc_error_create(error_code, msg_info);
msg_info);
writer->destroy(writer); writer->destroy(writer);
return attr; return attr;
@@ -66,13 +66,13 @@ pa_tnc_attr_t* pts_dh_group_error_create(pts_dh_group_t dh_groups)
bio_writer_t *writer; bio_writer_t *writer;
chunk_t msg_info; chunk_t msg_info;
pa_tnc_attr_t *attr; pa_tnc_attr_t *attr;
pen_type_t error_code = { PEN_TCG, TCG_PTS_DH_GRPS_NOT_SUPPORTED };
writer = bio_writer_create(4); writer = bio_writer_create(4);
writer->write_uint16(writer, 0x0000); writer->write_uint16(writer, 0x0000);
writer->write_uint16(writer, dh_groups); writer->write_uint16(writer, dh_groups);
msg_info = writer->get_buf(writer); msg_info = writer->get_buf(writer);
attr = ietf_attr_pa_tnc_error_create(PEN_TCG, TCG_PTS_DH_GRPS_NOT_SUPPORTED, attr = ietf_attr_pa_tnc_error_create(error_code, msg_info);
msg_info);
writer->destroy(writer); writer->destroy(writer);
return attr; return attr;
@@ -86,13 +86,13 @@ pa_tnc_attr_t* pts_dh_nonce_error_create(int min_nonce_len, int max_nonce_len)
bio_writer_t *writer; bio_writer_t *writer;
chunk_t msg_info; chunk_t msg_info;
pa_tnc_attr_t *attr; pa_tnc_attr_t *attr;
pen_type_t error_code = { PEN_TCG, TCG_PTS_BAD_NONCE_LENGTH };
writer = bio_writer_create(4); writer = bio_writer_create(4);
writer->write_uint16(writer, min_nonce_len); writer->write_uint16(writer, min_nonce_len);
writer->write_uint16(writer, max_nonce_len); writer->write_uint16(writer, max_nonce_len);
msg_info = writer->get_buf(writer); msg_info = writer->get_buf(writer);
attr = ietf_attr_pa_tnc_error_create(PEN_TCG, TCG_PTS_BAD_NONCE_LENGTH, attr = ietf_attr_pa_tnc_error_create(error_code, msg_info);
msg_info);
writer->destroy(writer); writer->destroy(writer);
return attr; return attr;
+6 -21
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2011 Sansar Choinyambuu * Copyright (C) 2011-2012 Sansar Choinyambuu, Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil * HSR Hochschule fuer Technik Rapperswil
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
@@ -49,14 +49,9 @@ struct private_tcg_pts_attr_aik_t {
tcg_pts_attr_aik_t public; tcg_pts_attr_aik_t public;
/** /**
* Attribute vendor ID * Vendor-specific attribute type
*/ */
pen_t vendor_id; pen_type_t type;
/**
* Attribute type
*/
u_int32_t type;
/** /**
* Attribute value * Attribute value
@@ -79,13 +74,7 @@ struct private_tcg_pts_attr_aik_t {
refcount_t ref; refcount_t ref;
}; };
METHOD(pa_tnc_attr_t, get_vendor_id, pen_t, METHOD(pa_tnc_attr_t, get_type, pen_type_t,
private_tcg_pts_attr_aik_t *this)
{
return this->vendor_id;
}
METHOD(pa_tnc_attr_t, get_type, u_int32_t,
private_tcg_pts_attr_aik_t *this) private_tcg_pts_attr_aik_t *this)
{ {
return this->type; return this->type;
@@ -206,7 +195,6 @@ pa_tnc_attr_t *tcg_pts_attr_aik_create(certificate_t *aik)
INIT(this, INIT(this,
.public = { .public = {
.pa_tnc_attribute = { .pa_tnc_attribute = {
.get_vendor_id = _get_vendor_id,
.get_type = _get_type, .get_type = _get_type,
.get_value = _get_value, .get_value = _get_value,
.get_noskip_flag = _get_noskip_flag, .get_noskip_flag = _get_noskip_flag,
@@ -218,8 +206,7 @@ pa_tnc_attr_t *tcg_pts_attr_aik_create(certificate_t *aik)
}, },
.get_aik = _get_aik, .get_aik = _get_aik,
}, },
.vendor_id = PEN_TCG, .type = { PEN_TCG, TCG_PTS_AIK },
.type = TCG_PTS_AIK,
.aik = aik->get_ref(aik), .aik = aik->get_ref(aik),
.ref = 1, .ref = 1,
); );
@@ -238,7 +225,6 @@ pa_tnc_attr_t *tcg_pts_attr_aik_create_from_data(chunk_t data)
INIT(this, INIT(this,
.public = { .public = {
.pa_tnc_attribute = { .pa_tnc_attribute = {
.get_vendor_id = _get_vendor_id,
.get_type = _get_type, .get_type = _get_type,
.get_value = _get_value, .get_value = _get_value,
.get_noskip_flag = _get_noskip_flag, .get_noskip_flag = _get_noskip_flag,
@@ -250,8 +236,7 @@ pa_tnc_attr_t *tcg_pts_attr_aik_create_from_data(chunk_t data)
}, },
.get_aik = _get_aik, .get_aik = _get_aik,
}, },
.vendor_id = PEN_TCG, .type = { PEN_TCG, TCG_PTS_AIK },
.type = TCG_PTS_AIK,
.value = chunk_clone(data), .value = chunk_clone(data),
.ref = 1, .ref = 1,
); );
+6 -21
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2011 Sansar Choinyambuu * Copyright (C) 2011-2012 Sansar Choinyambuu, Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil * HSR Hochschule fuer Technik Rapperswil
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
@@ -53,14 +53,9 @@ struct private_tcg_pts_attr_dh_nonce_finish_t {
tcg_pts_attr_dh_nonce_finish_t public; tcg_pts_attr_dh_nonce_finish_t public;
/** /**
* Attribute vendor ID * Vendor-specific attribute type
*/ */
pen_t vendor_id; pen_type_t type;
/**
* Attribute type
*/
u_int32_t type;
/** /**
* Attribute value * Attribute value
@@ -93,13 +88,7 @@ struct private_tcg_pts_attr_dh_nonce_finish_t {
refcount_t ref; refcount_t ref;
}; };
METHOD(pa_tnc_attr_t, get_vendor_id, pen_t, METHOD(pa_tnc_attr_t, get_type, pen_type_t,
private_tcg_pts_attr_dh_nonce_finish_t *this)
{
return this->vendor_id;
}
METHOD(pa_tnc_attr_t, get_type, u_int32_t,
private_tcg_pts_attr_dh_nonce_finish_t *this) private_tcg_pts_attr_dh_nonce_finish_t *this)
{ {
return this->type; return this->type;
@@ -221,7 +210,6 @@ pa_tnc_attr_t *tcg_pts_attr_dh_nonce_finish_create(
INIT(this, INIT(this,
.public = { .public = {
.pa_tnc_attribute = { .pa_tnc_attribute = {
.get_vendor_id = _get_vendor_id,
.get_type = _get_type, .get_type = _get_type,
.get_value = _get_value, .get_value = _get_value,
.get_noskip_flag = _get_noskip_flag, .get_noskip_flag = _get_noskip_flag,
@@ -235,8 +223,7 @@ pa_tnc_attr_t *tcg_pts_attr_dh_nonce_finish_create(
.get_initiator_nonce = _get_initiator_nonce, .get_initiator_nonce = _get_initiator_nonce,
.get_initiator_value = _get_initiator_value, .get_initiator_value = _get_initiator_value,
}, },
.vendor_id = PEN_TCG, .type = { PEN_TCG, TCG_PTS_DH_NONCE_FINISH },
.type = TCG_PTS_DH_NONCE_FINISH,
.hash_algo = hash_algo, .hash_algo = hash_algo,
.initiator_value = initiator_value, .initiator_value = initiator_value,
.initiator_nonce = chunk_clone(initiator_nonce), .initiator_nonce = chunk_clone(initiator_nonce),
@@ -256,7 +243,6 @@ pa_tnc_attr_t *tcg_pts_attr_dh_nonce_finish_create_from_data(chunk_t value)
INIT(this, INIT(this,
.public = { .public = {
.pa_tnc_attribute = { .pa_tnc_attribute = {
.get_vendor_id = _get_vendor_id,
.get_type = _get_type, .get_type = _get_type,
.get_value = _get_value, .get_value = _get_value,
.get_noskip_flag = _get_noskip_flag, .get_noskip_flag = _get_noskip_flag,
@@ -270,8 +256,7 @@ pa_tnc_attr_t *tcg_pts_attr_dh_nonce_finish_create_from_data(chunk_t value)
.get_initiator_nonce = _get_initiator_nonce, .get_initiator_nonce = _get_initiator_nonce,
.get_initiator_value = _get_initiator_value, .get_initiator_value = _get_initiator_value,
}, },
.vendor_id = PEN_TCG, .type = { PEN_TCG, TCG_PTS_DH_NONCE_FINISH },
.type = TCG_PTS_DH_NONCE_FINISH,
.value = chunk_clone(value), .value = chunk_clone(value),
.ref = 1, .ref = 1,
); );
@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2011 Sansar Choinyambuu * Copyright (C) 2011-2012 Sansar Choinyambuu, Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil * HSR Hochschule fuer Technik Rapperswil
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
@@ -49,14 +49,9 @@ struct private_tcg_pts_attr_dh_nonce_params_req_t {
tcg_pts_attr_dh_nonce_params_req_t public; tcg_pts_attr_dh_nonce_params_req_t public;
/** /**
* Attribute vendor ID * Vendor-specific attribute type
*/ */
pen_t vendor_id; pen_type_t type;
/**
* Attribute type
*/
u_int32_t type;
/** /**
* Attribute value * Attribute value
@@ -84,13 +79,7 @@ struct private_tcg_pts_attr_dh_nonce_params_req_t {
refcount_t ref; refcount_t ref;
}; };
METHOD(pa_tnc_attr_t, get_vendor_id, pen_t, METHOD(pa_tnc_attr_t, get_type, pen_type_t,
private_tcg_pts_attr_dh_nonce_params_req_t *this)
{
return this->vendor_id;
}
METHOD(pa_tnc_attr_t, get_type, u_int32_t,
private_tcg_pts_attr_dh_nonce_params_req_t *this) private_tcg_pts_attr_dh_nonce_params_req_t *this)
{ {
return this->type; return this->type;
@@ -195,7 +184,6 @@ pa_tnc_attr_t *tcg_pts_attr_dh_nonce_params_req_create(u_int8_t min_nonce_len,
INIT(this, INIT(this,
.public = { .public = {
.pa_tnc_attribute = { .pa_tnc_attribute = {
.get_vendor_id = _get_vendor_id,
.get_type = _get_type, .get_type = _get_type,
.get_value = _get_value, .get_value = _get_value,
.get_noskip_flag = _get_noskip_flag, .get_noskip_flag = _get_noskip_flag,
@@ -208,8 +196,7 @@ pa_tnc_attr_t *tcg_pts_attr_dh_nonce_params_req_create(u_int8_t min_nonce_len,
.get_min_nonce_len = _get_min_nonce_len, .get_min_nonce_len = _get_min_nonce_len,
.get_dh_groups = _get_dh_groups, .get_dh_groups = _get_dh_groups,
}, },
.vendor_id = PEN_TCG, .type = { PEN_TCG, TCG_PTS_DH_NONCE_PARAMS_REQ },
.type = TCG_PTS_DH_NONCE_PARAMS_REQ,
.min_nonce_len = min_nonce_len, .min_nonce_len = min_nonce_len,
.dh_groups = dh_groups, .dh_groups = dh_groups,
.ref = 1, .ref = 1,
@@ -228,7 +215,6 @@ pa_tnc_attr_t *tcg_pts_attr_dh_nonce_params_req_create_from_data(chunk_t value)
INIT(this, INIT(this,
.public = { .public = {
.pa_tnc_attribute = { .pa_tnc_attribute = {
.get_vendor_id = _get_vendor_id,
.get_type = _get_type, .get_type = _get_type,
.get_value = _get_value, .get_value = _get_value,
.get_noskip_flag = _get_noskip_flag, .get_noskip_flag = _get_noskip_flag,
@@ -241,8 +227,7 @@ pa_tnc_attr_t *tcg_pts_attr_dh_nonce_params_req_create_from_data(chunk_t value)
.get_min_nonce_len = _get_min_nonce_len, .get_min_nonce_len = _get_min_nonce_len,
.get_dh_groups = _get_dh_groups, .get_dh_groups = _get_dh_groups,
}, },
.vendor_id = PEN_TCG, .type = { PEN_TCG, TCG_PTS_DH_NONCE_PARAMS_REQ },
.type = TCG_PTS_DH_NONCE_PARAMS_REQ,
.value = chunk_clone(value), .value = chunk_clone(value),
.ref = 1, .ref = 1,
); );
@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2011 Sansar Choinyambuu * Copyright (C) 2011-2012 Sansar Choinyambuu, Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil * HSR Hochschule fuer Technik Rapperswil
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
@@ -55,14 +55,9 @@ struct private_tcg_pts_attr_dh_nonce_params_resp_t {
tcg_pts_attr_dh_nonce_params_resp_t public; tcg_pts_attr_dh_nonce_params_resp_t public;
/** /**
* Attribute vendor ID * Vendor-specific attribute type
*/ */
pen_t vendor_id; pen_type_t type;
/**
* Attribute type
*/
u_int32_t type;
/** /**
* Attribute value * Attribute value
@@ -100,13 +95,7 @@ struct private_tcg_pts_attr_dh_nonce_params_resp_t {
refcount_t ref; refcount_t ref;
}; };
METHOD(pa_tnc_attr_t, get_vendor_id, pen_t, METHOD(pa_tnc_attr_t, get_type, pen_type_t,
private_tcg_pts_attr_dh_nonce_params_resp_t *this)
{
return this->vendor_id;
}
METHOD(pa_tnc_attr_t, get_type, u_int32_t,
private_tcg_pts_attr_dh_nonce_params_resp_t *this) private_tcg_pts_attr_dh_nonce_params_resp_t *this)
{ {
return this->type; return this->type;
@@ -237,7 +226,6 @@ pa_tnc_attr_t *tcg_pts_attr_dh_nonce_params_resp_create(pts_dh_group_t dh_group,
INIT(this, INIT(this,
.public = { .public = {
.pa_tnc_attribute = { .pa_tnc_attribute = {
.get_vendor_id = _get_vendor_id,
.get_type = _get_type, .get_type = _get_type,
.get_value = _get_value, .get_value = _get_value,
.get_noskip_flag = _get_noskip_flag, .get_noskip_flag = _get_noskip_flag,
@@ -252,8 +240,7 @@ pa_tnc_attr_t *tcg_pts_attr_dh_nonce_params_resp_create(pts_dh_group_t dh_group,
.get_responder_nonce = _get_responder_nonce, .get_responder_nonce = _get_responder_nonce,
.get_responder_value = _get_responder_value, .get_responder_value = _get_responder_value,
}, },
.vendor_id = PEN_TCG, .type = { PEN_TCG, TCG_PTS_DH_NONCE_PARAMS_RESP },
.type = TCG_PTS_DH_NONCE_PARAMS_RESP,
.dh_group = dh_group, .dh_group = dh_group,
.hash_algo_set = hash_algo_set, .hash_algo_set = hash_algo_set,
.responder_nonce = chunk_clone(responder_nonce), .responder_nonce = chunk_clone(responder_nonce),
@@ -274,7 +261,6 @@ pa_tnc_attr_t *tcg_pts_attr_dh_nonce_params_resp_create_from_data(chunk_t value)
INIT(this, INIT(this,
.public = { .public = {
.pa_tnc_attribute = { .pa_tnc_attribute = {
.get_vendor_id = _get_vendor_id,
.get_type = _get_type, .get_type = _get_type,
.get_value = _get_value, .get_value = _get_value,
.get_noskip_flag = _get_noskip_flag, .get_noskip_flag = _get_noskip_flag,
@@ -289,8 +275,7 @@ pa_tnc_attr_t *tcg_pts_attr_dh_nonce_params_resp_create_from_data(chunk_t value)
.get_responder_nonce = _get_responder_nonce, .get_responder_nonce = _get_responder_nonce,
.get_responder_value = _get_responder_value, .get_responder_value = _get_responder_value,
}, },
.vendor_id = PEN_TCG, .type = { PEN_TCG, TCG_PTS_DH_NONCE_PARAMS_RESP },
.type = TCG_PTS_DH_NONCE_PARAMS_RESP,
.value = chunk_clone(value), .value = chunk_clone(value),
.ref = 1, .ref = 1,
); );
+6 -21
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2011 Sansar Choinyambuu * Copyright (C) 2011-2012 Sansar Choinyambuu, Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil * HSR Hochschule fuer Technik Rapperswil
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
@@ -64,14 +64,9 @@ struct private_tcg_pts_attr_file_meas_t {
tcg_pts_attr_file_meas_t public; tcg_pts_attr_file_meas_t public;
/** /**
* Attribute vendor ID * Vendor-specific attribute type
*/ */
pen_t vendor_id; pen_type_t type;
/**
* Attribute type
*/
u_int32_t type;
/** /**
* Attribute value * Attribute value
@@ -94,13 +89,7 @@ struct private_tcg_pts_attr_file_meas_t {
refcount_t ref; refcount_t ref;
}; };
METHOD(pa_tnc_attr_t, get_vendor_id, pen_t, METHOD(pa_tnc_attr_t, get_type, pen_type_t,
private_tcg_pts_attr_file_meas_t *this)
{
return this->vendor_id;
}
METHOD(pa_tnc_attr_t, get_type, u_int32_t,
private_tcg_pts_attr_file_meas_t *this) private_tcg_pts_attr_file_meas_t *this)
{ {
return this->type; return this->type;
@@ -258,7 +247,6 @@ pa_tnc_attr_t *tcg_pts_attr_file_meas_create(pts_file_meas_t *measurements)
INIT(this, INIT(this,
.public = { .public = {
.pa_tnc_attribute = { .pa_tnc_attribute = {
.get_vendor_id = _get_vendor_id,
.get_type = _get_type, .get_type = _get_type,
.get_value = _get_value, .get_value = _get_value,
.get_noskip_flag = _get_noskip_flag, .get_noskip_flag = _get_noskip_flag,
@@ -270,8 +258,7 @@ pa_tnc_attr_t *tcg_pts_attr_file_meas_create(pts_file_meas_t *measurements)
}, },
.get_measurements = _get_measurements, .get_measurements = _get_measurements,
}, },
.vendor_id = PEN_TCG, .type = { PEN_TCG, TCG_PTS_FILE_MEAS },
.type = TCG_PTS_FILE_MEAS,
.measurements = measurements, .measurements = measurements,
.ref = 1, .ref = 1,
); );
@@ -290,7 +277,6 @@ pa_tnc_attr_t *tcg_pts_attr_file_meas_create_from_data(chunk_t data)
INIT(this, INIT(this,
.public = { .public = {
.pa_tnc_attribute = { .pa_tnc_attribute = {
.get_vendor_id = _get_vendor_id,
.get_type = _get_type, .get_type = _get_type,
.get_value = _get_value, .get_value = _get_value,
.get_noskip_flag = _get_noskip_flag, .get_noskip_flag = _get_noskip_flag,
@@ -302,8 +288,7 @@ pa_tnc_attr_t *tcg_pts_attr_file_meas_create_from_data(chunk_t data)
}, },
.get_measurements = _get_measurements, .get_measurements = _get_measurements,
}, },
.vendor_id = PEN_TCG, .type = { PEN_TCG, TCG_PTS_FILE_MEAS },
.type = TCG_PTS_FILE_MEAS,
.value = chunk_clone(data), .value = chunk_clone(data),
.ref = 1, .ref = 1,
); );
+6 -21
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2011 Sansar Choinyambuu * Copyright (C) 2011-2012 Sansar Choinyambuu, Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil * HSR Hochschule fuer Technik Rapperswil
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
@@ -50,14 +50,9 @@ struct private_tcg_pts_attr_gen_attest_evid_t {
tcg_pts_attr_gen_attest_evid_t public; tcg_pts_attr_gen_attest_evid_t public;
/** /**
* Attribute vendor ID * Vendor-specific attribute type
*/ */
pen_t vendor_id; pen_type_t type;
/**
* Attribute type
*/
u_int32_t type;
/** /**
* Attribute value * Attribute value
@@ -75,13 +70,7 @@ struct private_tcg_pts_attr_gen_attest_evid_t {
refcount_t ref; refcount_t ref;
}; };
METHOD(pa_tnc_attr_t, get_vendor_id, pen_t, METHOD(pa_tnc_attr_t, get_type, pen_type_t,
private_tcg_pts_attr_gen_attest_evid_t *this)
{
return this->vendor_id;
}
METHOD(pa_tnc_attr_t, get_type, u_int32_t,
private_tcg_pts_attr_gen_attest_evid_t *this) private_tcg_pts_attr_gen_attest_evid_t *this)
{ {
return this->type; return this->type;
@@ -167,7 +156,6 @@ pa_tnc_attr_t *tcg_pts_attr_gen_attest_evid_create()
INIT(this, INIT(this,
.public = { .public = {
.pa_tnc_attribute = { .pa_tnc_attribute = {
.get_vendor_id = _get_vendor_id,
.get_type = _get_type, .get_type = _get_type,
.get_value = _get_value, .get_value = _get_value,
.get_noskip_flag = _get_noskip_flag, .get_noskip_flag = _get_noskip_flag,
@@ -178,8 +166,7 @@ pa_tnc_attr_t *tcg_pts_attr_gen_attest_evid_create()
.destroy = _destroy, .destroy = _destroy,
}, },
}, },
.vendor_id = PEN_TCG, .type = { PEN_TCG, TCG_PTS_GEN_ATTEST_EVID },
.type = TCG_PTS_GEN_ATTEST_EVID,
.ref = 1, .ref = 1,
); );
@@ -197,7 +184,6 @@ pa_tnc_attr_t *tcg_pts_attr_gen_attest_evid_create_from_data(chunk_t data)
INIT(this, INIT(this,
.public = { .public = {
.pa_tnc_attribute = { .pa_tnc_attribute = {
.get_vendor_id = _get_vendor_id,
.get_type = _get_type, .get_type = _get_type,
.get_value = _get_value, .get_value = _get_value,
.get_noskip_flag = _get_noskip_flag, .get_noskip_flag = _get_noskip_flag,
@@ -208,8 +194,7 @@ pa_tnc_attr_t *tcg_pts_attr_gen_attest_evid_create_from_data(chunk_t data)
.destroy = _destroy, .destroy = _destroy,
}, },
}, },
.vendor_id = PEN_TCG, .type = { PEN_TCG, TCG_PTS_GEN_ATTEST_EVID },
.type = TCG_PTS_GEN_ATTEST_EVID,
.value = chunk_clone(data), .value = chunk_clone(data),
.ref = 1, .ref = 1,
); );
+6 -21
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2011 Sansar Choinyambuu * Copyright (C) 2011-2012 Sansar Choinyambuu, Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil * HSR Hochschule fuer Technik Rapperswil
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
@@ -47,14 +47,9 @@ struct private_tcg_pts_attr_get_aik_t {
tcg_pts_attr_get_aik_t public; tcg_pts_attr_get_aik_t public;
/** /**
* Attribute vendor ID * Vendor-specific attribute type
*/ */
pen_t vendor_id; pen_type_t type;
/**
* Attribute type
*/
u_int32_t type;
/** /**
* Attribute value * Attribute value
@@ -72,13 +67,7 @@ struct private_tcg_pts_attr_get_aik_t {
refcount_t ref; refcount_t ref;
}; };
METHOD(pa_tnc_attr_t, get_vendor_id, pen_t, METHOD(pa_tnc_attr_t, get_type, pen_type_t,
private_tcg_pts_attr_get_aik_t *this)
{
return this->vendor_id;
}
METHOD(pa_tnc_attr_t, get_type, u_int32_t,
private_tcg_pts_attr_get_aik_t *this) private_tcg_pts_attr_get_aik_t *this)
{ {
return this->type; return this->type;
@@ -164,7 +153,6 @@ pa_tnc_attr_t *tcg_pts_attr_get_aik_create()
INIT(this, INIT(this,
.public = { .public = {
.pa_tnc_attribute = { .pa_tnc_attribute = {
.get_vendor_id = _get_vendor_id,
.get_type = _get_type, .get_type = _get_type,
.get_value = _get_value, .get_value = _get_value,
.get_noskip_flag = _get_noskip_flag, .get_noskip_flag = _get_noskip_flag,
@@ -175,8 +163,7 @@ pa_tnc_attr_t *tcg_pts_attr_get_aik_create()
.destroy = _destroy, .destroy = _destroy,
}, },
}, },
.vendor_id = PEN_TCG, .type = { PEN_TCG, TCG_PTS_GET_AIK },
.type = TCG_PTS_GET_AIK,
.ref = 1, .ref = 1,
); );
@@ -194,7 +181,6 @@ pa_tnc_attr_t *tcg_pts_attr_get_aik_create_from_data(chunk_t data)
INIT(this, INIT(this,
.public = { .public = {
.pa_tnc_attribute = { .pa_tnc_attribute = {
.get_vendor_id = _get_vendor_id,
.get_type = _get_type, .get_type = _get_type,
.get_value = _get_value, .get_value = _get_value,
.get_noskip_flag = _get_noskip_flag, .get_noskip_flag = _get_noskip_flag,
@@ -205,8 +191,7 @@ pa_tnc_attr_t *tcg_pts_attr_get_aik_create_from_data(chunk_t data)
.destroy = _destroy, .destroy = _destroy,
}, },
}, },
.vendor_id = PEN_TCG, .type = { PEN_TCG, TCG_PTS_GET_AIK },
.type = TCG_PTS_GET_AIK,
.value = chunk_clone(data), .value = chunk_clone(data),
.ref = 1, .ref = 1,
); );
@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2011 Sansar Choinyambuu * Copyright (C) 2011-2012 Sansar Choinyambuu, Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil * HSR Hochschule fuer Technik Rapperswil
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
@@ -50,14 +50,9 @@ struct private_tcg_pts_attr_get_tpm_version_info_t {
tcg_pts_attr_get_tpm_version_info_t public; tcg_pts_attr_get_tpm_version_info_t public;
/** /**
* Attribute vendor ID * Vendor-specific attribute type
*/ */
pen_t vendor_id; pen_type_t type;
/**
* Attribute type
*/
u_int32_t type;
/** /**
* Attribute value * Attribute value
@@ -75,13 +70,7 @@ struct private_tcg_pts_attr_get_tpm_version_info_t {
refcount_t ref; refcount_t ref;
}; };
METHOD(pa_tnc_attr_t, get_vendor_id, pen_t, METHOD(pa_tnc_attr_t, get_type, pen_type_t,
private_tcg_pts_attr_get_tpm_version_info_t *this)
{
return this->vendor_id;
}
METHOD(pa_tnc_attr_t, get_type, u_int32_t,
private_tcg_pts_attr_get_tpm_version_info_t *this) private_tcg_pts_attr_get_tpm_version_info_t *this)
{ {
return this->type; return this->type;
@@ -167,7 +156,6 @@ pa_tnc_attr_t *tcg_pts_attr_get_tpm_version_info_create()
INIT(this, INIT(this,
.public = { .public = {
.pa_tnc_attribute = { .pa_tnc_attribute = {
.get_vendor_id = _get_vendor_id,
.get_type = _get_type, .get_type = _get_type,
.get_value = _get_value, .get_value = _get_value,
.get_noskip_flag = _get_noskip_flag, .get_noskip_flag = _get_noskip_flag,
@@ -178,8 +166,7 @@ pa_tnc_attr_t *tcg_pts_attr_get_tpm_version_info_create()
.destroy = _destroy, .destroy = _destroy,
}, },
}, },
.vendor_id = PEN_TCG, .type = { PEN_TCG, TCG_PTS_GET_TPM_VERSION_INFO },
.type = TCG_PTS_GET_TPM_VERSION_INFO,
.ref = 1, .ref = 1,
); );
@@ -197,7 +184,6 @@ pa_tnc_attr_t *tcg_pts_attr_get_tpm_version_info_create_from_data(chunk_t data)
INIT(this, INIT(this,
.public = { .public = {
.pa_tnc_attribute = { .pa_tnc_attribute = {
.get_vendor_id = _get_vendor_id,
.get_type = _get_type, .get_type = _get_type,
.get_value = _get_value, .get_value = _get_value,
.get_noskip_flag = _get_noskip_flag, .get_noskip_flag = _get_noskip_flag,
@@ -208,8 +194,7 @@ pa_tnc_attr_t *tcg_pts_attr_get_tpm_version_info_create_from_data(chunk_t data)
.destroy = _destroy, .destroy = _destroy,
}, },
}, },
.vendor_id = PEN_TCG, .type = { PEN_TCG, TCG_PTS_GET_TPM_VERSION_INFO },
.type = TCG_PTS_GET_TPM_VERSION_INFO,
.value = chunk_clone(data), .value = chunk_clone(data),
.ref = 1, .ref = 1,
); );
+8 -21
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2011 Sansar Choinyambuu * Copyright (C) 2011-2012 Sansar Choinyambuu, Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil * HSR Hochschule fuer Technik Rapperswil
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
@@ -48,14 +48,9 @@ struct private_tcg_pts_attr_meas_algo_t {
tcg_pts_attr_meas_algo_t public; tcg_pts_attr_meas_algo_t public;
/** /**
* Attribute vendor ID * Vendor-specific attribute type
*/ */
pen_t vendor_id; pen_type_t type;
/**
* Attribute type
*/
u_int32_t type;
/** /**
* Attribute value * Attribute value
@@ -78,13 +73,7 @@ struct private_tcg_pts_attr_meas_algo_t {
refcount_t ref; refcount_t ref;
}; };
METHOD(pa_tnc_attr_t, get_vendor_id, pen_t, METHOD(pa_tnc_attr_t, get_type, pen_type_t,
private_tcg_pts_attr_meas_algo_t *this)
{
return this->vendor_id;
}
METHOD(pa_tnc_attr_t, get_type, u_int32_t,
private_tcg_pts_attr_meas_algo_t *this) private_tcg_pts_attr_meas_algo_t *this)
{ {
return this->type; return this->type;
@@ -179,7 +168,6 @@ pa_tnc_attr_t *tcg_pts_attr_meas_algo_create(pts_meas_algorithms_t algorithms,
INIT(this, INIT(this,
.public = { .public = {
.pa_tnc_attribute = { .pa_tnc_attribute = {
.get_vendor_id = _get_vendor_id,
.get_type = _get_type, .get_type = _get_type,
.get_value = _get_value, .get_value = _get_value,
.get_noskip_flag = _get_noskip_flag, .get_noskip_flag = _get_noskip_flag,
@@ -191,8 +179,8 @@ pa_tnc_attr_t *tcg_pts_attr_meas_algo_create(pts_meas_algorithms_t algorithms,
}, },
.get_algorithms = _get_algorithms, .get_algorithms = _get_algorithms,
}, },
.vendor_id = PEN_TCG, .type = { PEN_TCG,
.type = selection ? TCG_PTS_MEAS_ALGO_SELECTION : TCG_PTS_MEAS_ALGO, selection ? TCG_PTS_MEAS_ALGO_SELECTION : TCG_PTS_MEAS_ALGO },
.algorithms = algorithms, .algorithms = algorithms,
.ref = 1, .ref = 1,
); );
@@ -212,7 +200,6 @@ pa_tnc_attr_t *tcg_pts_attr_meas_algo_create_from_data(chunk_t data,
INIT(this, INIT(this,
.public = { .public = {
.pa_tnc_attribute = { .pa_tnc_attribute = {
.get_vendor_id = _get_vendor_id,
.get_type = _get_type, .get_type = _get_type,
.get_value = _get_value, .get_value = _get_value,
.get_noskip_flag = _get_noskip_flag, .get_noskip_flag = _get_noskip_flag,
@@ -224,8 +211,8 @@ pa_tnc_attr_t *tcg_pts_attr_meas_algo_create_from_data(chunk_t data,
}, },
.get_algorithms = _get_algorithms, .get_algorithms = _get_algorithms,
}, },
.vendor_id = PEN_TCG, .type = { PEN_TCG,
.type = selection ? TCG_PTS_MEAS_ALGO_SELECTION : TCG_PTS_MEAS_ALGO, selection ? TCG_PTS_MEAS_ALGO_SELECTION : TCG_PTS_MEAS_ALGO },
.value = chunk_clone(data), .value = chunk_clone(data),
.ref = 1, .ref = 1,
); );
+8 -21
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2011 Sansar Choinyambuu * Copyright (C) 2011-2012 Sansar Choinyambuu, Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil * HSR Hochschule fuer Technik Rapperswil
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
@@ -48,14 +48,9 @@ struct private_tcg_pts_attr_proto_caps_t {
tcg_pts_attr_proto_caps_t public; tcg_pts_attr_proto_caps_t public;
/** /**
* Attribute vendor ID * Vendor-specific attribute type
*/ */
pen_t vendor_id; pen_type_t type;
/**
* Attribute type
*/
u_int32_t type;
/** /**
* Attribute value * Attribute value
@@ -78,13 +73,7 @@ struct private_tcg_pts_attr_proto_caps_t {
refcount_t ref; refcount_t ref;
}; };
METHOD(pa_tnc_attr_t, get_vendor_id, pen_t, METHOD(pa_tnc_attr_t, get_type, pen_type_t,
private_tcg_pts_attr_proto_caps_t *this)
{
return this->vendor_id;
}
METHOD(pa_tnc_attr_t, get_type, u_int32_t,
private_tcg_pts_attr_proto_caps_t *this) private_tcg_pts_attr_proto_caps_t *this)
{ {
return this->type; return this->type;
@@ -180,7 +169,6 @@ pa_tnc_attr_t *tcg_pts_attr_proto_caps_create(pts_proto_caps_flag_t flags,
INIT(this, INIT(this,
.public = { .public = {
.pa_tnc_attribute = { .pa_tnc_attribute = {
.get_vendor_id = _get_vendor_id,
.get_type = _get_type, .get_type = _get_type,
.get_value = _get_value, .get_value = _get_value,
.get_noskip_flag = _get_noskip_flag, .get_noskip_flag = _get_noskip_flag,
@@ -192,8 +180,8 @@ pa_tnc_attr_t *tcg_pts_attr_proto_caps_create(pts_proto_caps_flag_t flags,
}, },
.get_flags = _get_flags, .get_flags = _get_flags,
}, },
.vendor_id = PEN_TCG, .type = { PEN_TCG,
.type = request ? TCG_PTS_REQ_PROTO_CAPS : TCG_PTS_PROTO_CAPS, request ? TCG_PTS_REQ_PROTO_CAPS : TCG_PTS_PROTO_CAPS },
.flags = flags, .flags = flags,
.ref = 1, .ref = 1,
); );
@@ -212,7 +200,6 @@ pa_tnc_attr_t *tcg_pts_attr_proto_caps_create_from_data(chunk_t data,
INIT(this, INIT(this,
.public = { .public = {
.pa_tnc_attribute = { .pa_tnc_attribute = {
.get_vendor_id = _get_vendor_id,
.get_type = _get_type, .get_type = _get_type,
.get_value = _get_value, .get_value = _get_value,
.get_noskip_flag = _get_noskip_flag, .get_noskip_flag = _get_noskip_flag,
@@ -224,8 +211,8 @@ pa_tnc_attr_t *tcg_pts_attr_proto_caps_create_from_data(chunk_t data,
}, },
.get_flags = _get_flags, .get_flags = _get_flags,
}, },
.vendor_id = PEN_TCG, .type = { PEN_TCG,
.type = request ? TCG_PTS_REQ_PROTO_CAPS : TCG_PTS_PROTO_CAPS, request ? TCG_PTS_REQ_PROTO_CAPS : TCG_PTS_PROTO_CAPS },
.value = chunk_clone(data), .value = chunk_clone(data),
.ref = 1, .ref = 1,
); );
+6 -21
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2011 Sansar Choinyambuu * Copyright (C) 2011-2012 Sansar Choinyambuu, Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil * HSR Hochschule fuer Technik Rapperswil
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
@@ -54,14 +54,9 @@ struct private_tcg_pts_attr_req_file_meas_t {
tcg_pts_attr_req_file_meas_t public; tcg_pts_attr_req_file_meas_t public;
/** /**
* Attribute vendor ID * Vendor-specific attribute type
*/ */
pen_t vendor_id; pen_type_t type;
/**
* Attribute type
*/
u_int32_t type;
/** /**
* Attribute value * Attribute value
@@ -99,13 +94,7 @@ struct private_tcg_pts_attr_req_file_meas_t {
refcount_t ref; refcount_t ref;
}; };
METHOD(pa_tnc_attr_t, get_vendor_id, pen_t, METHOD(pa_tnc_attr_t, get_type, pen_type_t,
private_tcg_pts_attr_req_file_meas_t *this)
{
return this->vendor_id;
}
METHOD(pa_tnc_attr_t, get_type, u_int32_t,
private_tcg_pts_attr_req_file_meas_t *this) private_tcg_pts_attr_req_file_meas_t *this)
{ {
return this->type; return this->type;
@@ -244,7 +233,6 @@ pa_tnc_attr_t *tcg_pts_attr_req_file_meas_create(bool directory_flag,
INIT(this, INIT(this,
.public = { .public = {
.pa_tnc_attribute = { .pa_tnc_attribute = {
.get_vendor_id = _get_vendor_id,
.get_type = _get_type, .get_type = _get_type,
.get_value = _get_value, .get_value = _get_value,
.get_noskip_flag = _get_noskip_flag, .get_noskip_flag = _get_noskip_flag,
@@ -259,8 +247,7 @@ pa_tnc_attr_t *tcg_pts_attr_req_file_meas_create(bool directory_flag,
.get_delimiter = _get_delimiter, .get_delimiter = _get_delimiter,
.get_pathname = _get_pathname, .get_pathname = _get_pathname,
}, },
.vendor_id = PEN_TCG, .type = { PEN_TCG, TCG_PTS_REQ_FILE_MEAS },
.type = TCG_PTS_REQ_FILE_MEAS,
.directory_flag = directory_flag, .directory_flag = directory_flag,
.request_id = request_id, .request_id = request_id,
.delimiter = delimiter, .delimiter = delimiter,
@@ -282,7 +269,6 @@ pa_tnc_attr_t *tcg_pts_attr_req_file_meas_create_from_data(chunk_t data)
INIT(this, INIT(this,
.public = { .public = {
.pa_tnc_attribute = { .pa_tnc_attribute = {
.get_vendor_id = _get_vendor_id,
.get_type = _get_type, .get_type = _get_type,
.get_value = _get_value, .get_value = _get_value,
.get_noskip_flag = _get_noskip_flag, .get_noskip_flag = _get_noskip_flag,
@@ -297,8 +283,7 @@ pa_tnc_attr_t *tcg_pts_attr_req_file_meas_create_from_data(chunk_t data)
.get_delimiter = _get_delimiter, .get_delimiter = _get_delimiter,
.get_pathname = _get_pathname, .get_pathname = _get_pathname,
}, },
.vendor_id = PEN_TCG, .type = { PEN_TCG, TCG_PTS_REQ_FILE_MEAS },
.type = TCG_PTS_REQ_FILE_MEAS,
.value = chunk_clone(data), .value = chunk_clone(data),
.ref = 1, .ref = 1,
); );
+6 -21
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2011 Sansar Choinyambuu * Copyright (C) 2011-2012 Sansar Choinyambuu, Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil * HSR Hochschule fuer Technik Rapperswil
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
@@ -52,14 +52,9 @@ struct private_tcg_pts_attr_req_file_meta_t {
tcg_pts_attr_req_file_meta_t public; tcg_pts_attr_req_file_meta_t public;
/** /**
* Attribute vendor ID * Vendor-specific attribute type
*/ */
pen_t vendor_id; pen_type_t type;
/**
* Attribute type
*/
u_int32_t type;
/** /**
* Attribute value * Attribute value
@@ -92,13 +87,7 @@ struct private_tcg_pts_attr_req_file_meta_t {
refcount_t ref; refcount_t ref;
}; };
METHOD(pa_tnc_attr_t, get_vendor_id, pen_t, METHOD(pa_tnc_attr_t, get_type, pen_type_t,
private_tcg_pts_attr_req_file_meta_t *this)
{
return this->vendor_id;
}
METHOD(pa_tnc_attr_t, get_type, u_int32_t,
private_tcg_pts_attr_req_file_meta_t *this) private_tcg_pts_attr_req_file_meta_t *this)
{ {
return this->type; return this->type;
@@ -230,7 +219,6 @@ pa_tnc_attr_t *tcg_pts_attr_req_file_meta_create(bool directory_flag,
INIT(this, INIT(this,
.public = { .public = {
.pa_tnc_attribute = { .pa_tnc_attribute = {
.get_vendor_id = _get_vendor_id,
.get_type = _get_type, .get_type = _get_type,
.get_value = _get_value, .get_value = _get_value,
.get_noskip_flag = _get_noskip_flag, .get_noskip_flag = _get_noskip_flag,
@@ -244,8 +232,7 @@ pa_tnc_attr_t *tcg_pts_attr_req_file_meta_create(bool directory_flag,
.get_delimiter = _get_delimiter, .get_delimiter = _get_delimiter,
.get_pathname = _get_pathname, .get_pathname = _get_pathname,
}, },
.vendor_id = PEN_TCG, .type = { PEN_TCG, TCG_PTS_REQ_FILE_META },
.type = TCG_PTS_REQ_FILE_META,
.directory_flag = directory_flag, .directory_flag = directory_flag,
.delimiter = delimiter, .delimiter = delimiter,
.pathname = strdup(pathname), .pathname = strdup(pathname),
@@ -266,7 +253,6 @@ pa_tnc_attr_t *tcg_pts_attr_req_file_meta_create_from_data(chunk_t data)
INIT(this, INIT(this,
.public = { .public = {
.pa_tnc_attribute = { .pa_tnc_attribute = {
.get_vendor_id = _get_vendor_id,
.get_type = _get_type, .get_type = _get_type,
.get_value = _get_value, .get_value = _get_value,
.get_noskip_flag = _get_noskip_flag, .get_noskip_flag = _get_noskip_flag,
@@ -280,8 +266,7 @@ pa_tnc_attr_t *tcg_pts_attr_req_file_meta_create_from_data(chunk_t data)
.get_delimiter = _get_delimiter, .get_delimiter = _get_delimiter,
.get_pathname = _get_pathname, .get_pathname = _get_pathname,
}, },
.vendor_id = PEN_TCG, .type = { PEN_TCG, TCG_PTS_REQ_FILE_META },
.type = TCG_PTS_REQ_FILE_META,
.value = chunk_clone(data), .value = chunk_clone(data),
.ref = 1, .ref = 1,
); );
@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2011 Sansar Choinyambuu * Copyright (C) 2011-2012 Sansar Choinyambuu, Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil * HSR Hochschule fuer Technik Rapperswil
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
@@ -73,14 +73,9 @@ struct private_tcg_pts_attr_req_func_comp_evid_t {
tcg_pts_attr_req_func_comp_evid_t public; tcg_pts_attr_req_func_comp_evid_t public;
/** /**
* Attribute vendor ID * Vendor-specific attribute type
*/ */
pen_t vendor_id; pen_type_t type;
/**
* Attribute type
*/
u_int32_t type;
/** /**
* Attribute value * Attribute value
@@ -140,13 +135,7 @@ static void free_entry(entry_t *this)
} }
} }
METHOD(pa_tnc_attr_t, get_vendor_id, pen_t, METHOD(pa_tnc_attr_t, get_type, pen_type_t,
private_tcg_pts_attr_req_func_comp_evid_t *this)
{
return this->vendor_id;
}
METHOD(pa_tnc_attr_t, get_type, u_int32_t,
private_tcg_pts_attr_req_func_comp_evid_t *this) private_tcg_pts_attr_req_func_comp_evid_t *this)
{ {
return this->type; return this->type;
@@ -324,7 +313,6 @@ pa_tnc_attr_t *tcg_pts_attr_req_func_comp_evid_create(void)
INIT(this, INIT(this,
.public = { .public = {
.pa_tnc_attribute = { .pa_tnc_attribute = {
.get_vendor_id = _get_vendor_id,
.get_type = _get_type, .get_type = _get_type,
.get_value = _get_value, .get_value = _get_value,
.get_noskip_flag = _get_noskip_flag, .get_noskip_flag = _get_noskip_flag,
@@ -338,8 +326,7 @@ pa_tnc_attr_t *tcg_pts_attr_req_func_comp_evid_create(void)
.get_count = _get_count, .get_count = _get_count,
.create_enumerator = _create_enumerator, .create_enumerator = _create_enumerator,
}, },
.vendor_id = PEN_TCG, .type = { PEN_TCG, TCG_PTS_REQ_FUNC_COMP_EVID },
.type = TCG_PTS_REQ_FUNC_COMP_EVID,
.list = linked_list_create(), .list = linked_list_create(),
.ref = 1, .ref = 1,
); );
@@ -357,7 +344,6 @@ pa_tnc_attr_t *tcg_pts_attr_req_func_comp_evid_create_from_data(chunk_t data)
INIT(this, INIT(this,
.public = { .public = {
.pa_tnc_attribute = { .pa_tnc_attribute = {
.get_vendor_id = _get_vendor_id,
.get_type = _get_type, .get_type = _get_type,
.get_value = _get_value, .get_value = _get_value,
.get_noskip_flag = _get_noskip_flag, .get_noskip_flag = _get_noskip_flag,
@@ -371,8 +357,7 @@ pa_tnc_attr_t *tcg_pts_attr_req_func_comp_evid_create_from_data(chunk_t data)
.get_count = _get_count, .get_count = _get_count,
.create_enumerator = _create_enumerator, .create_enumerator = _create_enumerator,
}, },
.vendor_id = PEN_TCG, .type = { PEN_TCG, TCG_PTS_REQ_FUNC_COMP_EVID },
.type = TCG_PTS_REQ_FUNC_COMP_EVID,
.list = linked_list_create(), .list = linked_list_create(),
.value = chunk_clone(data), .value = chunk_clone(data),
.ref = 1, .ref = 1,
+6 -21
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2011 Sansar Choinyambuu * Copyright (C) 2011-2012 Sansar Choinyambuu, Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil * HSR Hochschule fuer Technik Rapperswil
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
@@ -100,14 +100,9 @@ struct private_tcg_pts_attr_simple_comp_evid_t {
tcg_pts_attr_simple_comp_evid_t public; tcg_pts_attr_simple_comp_evid_t public;
/** /**
* Attribute vendor ID * Vendor-specific attribute type
*/ */
pen_t vendor_id; pen_type_t type;
/**
* Attribute type
*/
u_int32_t type;
/** /**
* Attribute value * Attribute value
@@ -130,13 +125,7 @@ struct private_tcg_pts_attr_simple_comp_evid_t {
refcount_t ref; refcount_t ref;
}; };
METHOD(pa_tnc_attr_t, get_vendor_id, pen_t, METHOD(pa_tnc_attr_t, get_type, pen_type_t,
private_tcg_pts_attr_simple_comp_evid_t *this)
{
return this->vendor_id;
}
METHOD(pa_tnc_attr_t, get_type, u_int32_t,
private_tcg_pts_attr_simple_comp_evid_t *this) private_tcg_pts_attr_simple_comp_evid_t *this)
{ {
return this->type; return this->type;
@@ -472,7 +461,6 @@ pa_tnc_attr_t *tcg_pts_attr_simple_comp_evid_create(pts_comp_evidence_t *evid)
INIT(this, INIT(this,
.public = { .public = {
.pa_tnc_attribute = { .pa_tnc_attribute = {
.get_vendor_id = _get_vendor_id,
.get_type = _get_type, .get_type = _get_type,
.get_value = _get_value, .get_value = _get_value,
.get_noskip_flag = _get_noskip_flag, .get_noskip_flag = _get_noskip_flag,
@@ -484,8 +472,7 @@ pa_tnc_attr_t *tcg_pts_attr_simple_comp_evid_create(pts_comp_evidence_t *evid)
}, },
.get_comp_evidence = _get_comp_evidence, .get_comp_evidence = _get_comp_evidence,
}, },
.vendor_id = PEN_TCG, .type = { PEN_TCG, TCG_PTS_SIMPLE_COMP_EVID },
.type = TCG_PTS_SIMPLE_COMP_EVID,
.evidence = evid, .evidence = evid,
.ref = 1, .ref = 1,
); );
@@ -504,7 +491,6 @@ pa_tnc_attr_t *tcg_pts_attr_simple_comp_evid_create_from_data(chunk_t data)
INIT(this, INIT(this,
.public = { .public = {
.pa_tnc_attribute = { .pa_tnc_attribute = {
.get_vendor_id = _get_vendor_id,
.get_type = _get_type, .get_type = _get_type,
.get_value = _get_value, .get_value = _get_value,
.get_noskip_flag = _get_noskip_flag, .get_noskip_flag = _get_noskip_flag,
@@ -516,8 +502,7 @@ pa_tnc_attr_t *tcg_pts_attr_simple_comp_evid_create_from_data(chunk_t data)
}, },
.get_comp_evidence = _get_comp_evidence, .get_comp_evidence = _get_comp_evidence,
}, },
.vendor_id = PEN_TCG, .type = { PEN_TCG, TCG_PTS_SIMPLE_COMP_EVID },
.type = TCG_PTS_SIMPLE_COMP_EVID,
.value = chunk_clone(data), .value = chunk_clone(data),
.ref = 1, .ref = 1,
); );
@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2011 Sansar Choinyambuu * Copyright (C) 2011-2012 Sansar Choinyambuu, Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil * HSR Hochschule fuer Technik Rapperswil
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
@@ -58,14 +58,9 @@ struct private_tcg_pts_attr_simple_evid_final_t {
tcg_pts_attr_simple_evid_final_t public; tcg_pts_attr_simple_evid_final_t public;
/** /**
* Attribute vendor ID * Vendor-specific attribute type
*/ */
pen_t vendor_id; pen_type_t type;
/**
* Attribute type
*/
u_int32_t type;
/** /**
* Attribute value * Attribute value
@@ -113,13 +108,7 @@ struct private_tcg_pts_attr_simple_evid_final_t {
refcount_t ref; refcount_t ref;
}; };
METHOD(pa_tnc_attr_t, get_vendor_id, pen_t, METHOD(pa_tnc_attr_t, get_type, pen_type_t,
private_tcg_pts_attr_simple_evid_final_t *this)
{
return this->vendor_id;
}
METHOD(pa_tnc_attr_t, get_type, u_int32_t,
private_tcg_pts_attr_simple_evid_final_t *this) private_tcg_pts_attr_simple_evid_final_t *this)
{ {
return this->type; return this->type;
@@ -337,7 +326,6 @@ pa_tnc_attr_t *tcg_pts_attr_simple_evid_final_create(u_int8_t flags,
INIT(this, INIT(this,
.public = { .public = {
.pa_tnc_attribute = { .pa_tnc_attribute = {
.get_vendor_id = _get_vendor_id,
.get_type = _get_type, .get_type = _get_type,
.get_value = _get_value, .get_value = _get_value,
.get_noskip_flag = _get_noskip_flag, .get_noskip_flag = _get_noskip_flag,
@@ -351,8 +339,7 @@ pa_tnc_attr_t *tcg_pts_attr_simple_evid_final_create(u_int8_t flags,
.get_evid_sig = _get_evid_sig, .get_evid_sig = _get_evid_sig,
.set_evid_sig = _set_evid_sig, .set_evid_sig = _set_evid_sig,
}, },
.vendor_id = PEN_TCG, .type = { PEN_TCG, TCG_PTS_SIMPLE_EVID_FINAL },
.type = TCG_PTS_SIMPLE_EVID_FINAL,
.flags = flags, .flags = flags,
.comp_hash_algorithm = comp_hash_algorithm, .comp_hash_algorithm = comp_hash_algorithm,
.pcr_comp = pcr_comp, .pcr_comp = pcr_comp,
@@ -374,7 +361,6 @@ pa_tnc_attr_t *tcg_pts_attr_simple_evid_final_create_from_data(chunk_t data)
INIT(this, INIT(this,
.public = { .public = {
.pa_tnc_attribute = { .pa_tnc_attribute = {
.get_vendor_id = _get_vendor_id,
.get_type = _get_type, .get_type = _get_type,
.get_value = _get_value, .get_value = _get_value,
.get_noskip_flag = _get_noskip_flag, .get_noskip_flag = _get_noskip_flag,
@@ -388,8 +374,7 @@ pa_tnc_attr_t *tcg_pts_attr_simple_evid_final_create_from_data(chunk_t data)
.get_evid_sig = _get_evid_sig, .get_evid_sig = _get_evid_sig,
.set_evid_sig = _set_evid_sig, .set_evid_sig = _set_evid_sig,
}, },
.vendor_id = PEN_TCG, .type = { PEN_TCG, TCG_PTS_SIMPLE_EVID_FINAL },
.type = TCG_PTS_SIMPLE_EVID_FINAL,
.value = chunk_clone(data), .value = chunk_clone(data),
.ref = 1, .ref = 1,
); );
+6 -21
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2011 Sansar Choinyambuu * Copyright (C) 2011-2012 Sansar Choinyambuu, Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil * HSR Hochschule fuer Technik Rapperswil
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
@@ -49,14 +49,9 @@ struct private_tcg_pts_attr_tpm_version_info_t {
tcg_pts_attr_tpm_version_info_t public; tcg_pts_attr_tpm_version_info_t public;
/** /**
* Attribute vendor ID * Vendor-specific attribute type
*/ */
pen_t vendor_id; pen_type_t type;
/**
* Attribute type
*/
u_int32_t type;
/** /**
* Attribute value * Attribute value
@@ -79,13 +74,7 @@ struct private_tcg_pts_attr_tpm_version_info_t {
refcount_t ref; refcount_t ref;
}; };
METHOD(pa_tnc_attr_t, get_vendor_id, pen_t, METHOD(pa_tnc_attr_t, get_type, pen_type_t,
private_tcg_pts_attr_tpm_version_info_t *this)
{
return this->vendor_id;
}
METHOD(pa_tnc_attr_t, get_type, u_int32_t,
private_tcg_pts_attr_tpm_version_info_t *this) private_tcg_pts_attr_tpm_version_info_t *this)
{ {
return this->type; return this->type;
@@ -185,7 +174,6 @@ pa_tnc_attr_t *tcg_pts_attr_tpm_version_info_create(chunk_t tpm_version_info)
INIT(this, INIT(this,
.public = { .public = {
.pa_tnc_attribute = { .pa_tnc_attribute = {
.get_vendor_id = _get_vendor_id,
.get_type = _get_type, .get_type = _get_type,
.get_value = _get_value, .get_value = _get_value,
.get_noskip_flag = _get_noskip_flag, .get_noskip_flag = _get_noskip_flag,
@@ -198,8 +186,7 @@ pa_tnc_attr_t *tcg_pts_attr_tpm_version_info_create(chunk_t tpm_version_info)
.get_tpm_version_info = _get_tpm_version_info, .get_tpm_version_info = _get_tpm_version_info,
.set_tpm_version_info = _set_tpm_version_info, .set_tpm_version_info = _set_tpm_version_info,
}, },
.vendor_id = PEN_TCG, .type = { PEN_TCG, TCG_PTS_TPM_VERSION_INFO },
.type = TCG_PTS_TPM_VERSION_INFO,
.tpm_version_info = chunk_clone(tpm_version_info), .tpm_version_info = chunk_clone(tpm_version_info),
.ref = 1, .ref = 1,
); );
@@ -218,7 +205,6 @@ pa_tnc_attr_t *tcg_pts_attr_tpm_version_info_create_from_data(chunk_t data)
INIT(this, INIT(this,
.public = { .public = {
.pa_tnc_attribute = { .pa_tnc_attribute = {
.get_vendor_id = _get_vendor_id,
.get_type = _get_type, .get_type = _get_type,
.get_value = _get_value, .get_value = _get_value,
.get_noskip_flag = _get_noskip_flag, .get_noskip_flag = _get_noskip_flag,
@@ -231,8 +217,7 @@ pa_tnc_attr_t *tcg_pts_attr_tpm_version_info_create_from_data(chunk_t data)
.get_tpm_version_info = _get_tpm_version_info, .get_tpm_version_info = _get_tpm_version_info,
.set_tpm_version_info = _set_tpm_version_info, .set_tpm_version_info = _set_tpm_version_info,
}, },
.vendor_id = PEN_TCG, .type = { PEN_TCG, TCG_PTS_TPM_VERSION_INFO },
.type = TCG_PTS_TPM_VERSION_INFO,
.value = chunk_clone(data), .value = chunk_clone(data),
.ref = 1, .ref = 1,
); );
+6 -21
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2011 Sansar Choinyambuu * Copyright (C) 2011-2012 Sansar Choinyambuu, Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil * HSR Hochschule fuer Technik Rapperswil
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
@@ -80,14 +80,9 @@ struct private_tcg_pts_attr_file_meta_t {
tcg_pts_attr_file_meta_t public; tcg_pts_attr_file_meta_t public;
/** /**
* Attribute vendor ID * Vendor-specific attribute type
*/ */
pen_t vendor_id; pen_type_t type;
/**
* Attribute type
*/
u_int32_t type;
/** /**
* Attribute value * Attribute value
@@ -110,13 +105,7 @@ struct private_tcg_pts_attr_file_meta_t {
refcount_t ref; refcount_t ref;
}; };
METHOD(pa_tnc_attr_t, get_vendor_id, pen_t, METHOD(pa_tnc_attr_t, get_type, pen_type_t,
private_tcg_pts_attr_file_meta_t *this)
{
return this->vendor_id;
}
METHOD(pa_tnc_attr_t, get_type, u_int32_t,
private_tcg_pts_attr_file_meta_t *this) private_tcg_pts_attr_file_meta_t *this)
{ {
return this->type; return this->type;
@@ -310,7 +299,6 @@ pa_tnc_attr_t *tcg_pts_attr_unix_file_meta_create(pts_file_meta_t *metadata)
INIT(this, INIT(this,
.public = { .public = {
.pa_tnc_attribute = { .pa_tnc_attribute = {
.get_vendor_id = _get_vendor_id,
.get_type = _get_type, .get_type = _get_type,
.get_value = _get_value, .get_value = _get_value,
.get_noskip_flag = _get_noskip_flag, .get_noskip_flag = _get_noskip_flag,
@@ -322,8 +310,7 @@ pa_tnc_attr_t *tcg_pts_attr_unix_file_meta_create(pts_file_meta_t *metadata)
}, },
.get_metadata = _get_metadata, .get_metadata = _get_metadata,
}, },
.vendor_id = PEN_TCG, .type = { PEN_TCG, TCG_PTS_UNIX_FILE_META },
.type = TCG_PTS_UNIX_FILE_META,
.metadata = metadata, .metadata = metadata,
.ref = 1, .ref = 1,
); );
@@ -342,7 +329,6 @@ pa_tnc_attr_t *tcg_pts_attr_unix_file_meta_create_from_data(chunk_t data)
INIT(this, INIT(this,
.public = { .public = {
.pa_tnc_attribute = { .pa_tnc_attribute = {
.get_vendor_id = _get_vendor_id,
.get_type = _get_type, .get_type = _get_type,
.get_value = _get_value, .get_value = _get_value,
.get_noskip_flag = _get_noskip_flag, .get_noskip_flag = _get_noskip_flag,
@@ -354,8 +340,7 @@ pa_tnc_attr_t *tcg_pts_attr_unix_file_meta_create_from_data(chunk_t data)
}, },
.get_metadata = _get_metadata, .get_metadata = _get_metadata,
}, },
.vendor_id = PEN_TCG, .type = { PEN_TCG, TCG_PTS_UNIX_FILE_META },
.type = TCG_PTS_UNIX_FILE_META,
.value = chunk_clone(data), .value = chunk_clone(data),
.ref = 1, .ref = 1,
); );
+19 -1
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2011 Andreas Steffen * Copyright (C) 2011-2012 Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil * HSR Hochschule fuer Technik Rapperswil
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
@@ -27,6 +27,7 @@
#include <library.h> #include <library.h>
typedef enum pen_t pen_t; typedef enum pen_t pen_t;
typedef struct pen_type_t pen_type_t;
enum pen_t { enum pen_t {
PEN_IETF = 0x000000, /* 0 */ PEN_IETF = 0x000000, /* 0 */
@@ -40,6 +41,23 @@ enum pen_t {
PEN_RESERVED = 0xffffff, /* 16777215 */ PEN_RESERVED = 0xffffff, /* 16777215 */
}; };
/**
* Vendor specific type
*/
struct pen_type_t {
pen_t vendor_id;
u_int32_t type;
};
/**
* Create a pen_type_t struct
*/
static inline pen_type_t pen_type_create(pen_t vendor_id, u_int32_t type)
{
pen_type_t pen_type = {vendor_id, type};
return pen_type;
}
/** /**
* enum names for pen_t. * enum names for pen_t.
*/ */