/**
- * Selected Measurement Algorithm, which is selected during the PTS Measurement Algorithm attributes exchange
+ * Selected Measurement Algorithm, which is selected during
+ * the PTS Measurement Algorithm attributes exchange
* Default value is SHA256
*/
-static pts_attr_meas_algorithms_t selected_algorithm = PTS_MEAS_ALGO_SHA256;
+static pts_meas_algorithms_t selected_algorithm = PTS_MEAS_ALGO_SHA256;
/**
* List of files and directories to measure
{
case IMC_ATTESTATION_STATE_REQ_PROTO_CAP:
{
- pts_attr_proto_caps_flag_t flags;
+ pts_proto_caps_flag_t flags;
flags = PTS_PROTO_CAPS_T | PTS_PROTO_CAPS_VER;
attr = tcg_pts_attr_proto_caps_create(flags);
break;
}
case IMC_ATTESTATION_STATE_REQ_MEAS_ALGO:
{
- pts_attr_meas_algorithms_t algorithm;
+ pts_meas_algorithms_t algorithm;
algorithm = PTS_MEAS_ALGO_SHA1;
/* Save the selected algorithm for further attributes creation */
selected_algorithm = algorithm;
case IMV_ATTESTATION_STATE_INIT:
{
/* Send Request Protocol Capabilities attribute */
- pts_attr_req_proto_caps_flag_t flags;
+ pts_proto_caps_flag_t flags;
flags = PTS_PROTO_CAPS_T | PTS_PROTO_CAPS_VER | PTS_PROTO_CAPS_CURRENT;
attr = tcg_pts_attr_req_proto_caps_create(flags);
break;
case IMV_ATTESTATION_STATE_PROTO_CAP:
{
/* Send Measurement Algorithms attribute */
- pts_attr_meas_algorithms_t algorithms;
+ pts_meas_algorithms_t algorithms;
algorithms = PTS_MEAS_ALGO_SHA1 | PTS_MEAS_ALGO_SHA256 | PTS_MEAS_ALGO_SHA384;
attr = tcg_pts_attr_meas_algo_create(algorithms);
break;
msg = pa_tnc_msg_create();
- /** Add files to measure to PTS Request File Measurement attribute
+ /**
+ * Add files to measure to PTS Request File Measurement attribute
*/
enumerator = enumerator_create_single(file_list, NULL);
while (enumerator->enumerate(enumerator, &entry))
};
/**
- * File Measurement (see section 3.19.2 of PTS Protocol: Binding to TNC IF-M Specification)
+ * File Measurement
+ * see section 3.19.2 of PTS Protocol: Binding to TNC IF-M Specification
*
* 1 2 3
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
typedef struct private_tcg_pts_attr_gen_attest_evid_t private_tcg_pts_attr_gen_attest_evid_t;
/**
- * Generate Attestation Evidence (see section 3.14.2 of PTS Protocol: Binding to TNC IF-M Specification)
+ * Generate Attestation Evidence
+ * see section 3.14.2 of PTS Protocol: Binding to TNC IF-M Specification
*
* 1 2 3
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
*/
#define PTS_GEN_ATTEST_EVID_SIZE 4
-#define PTS_GEN_ATTEST_EVID_RESERVED 0x00
+#define PTS_GEN_ATTEST_EVID_RESERVED 0x00
/**
* Private data of an tcg_pts_attr_gen_attest_evid_t object.
typedef struct private_tcg_pts_attr_get_aik_t private_tcg_pts_attr_get_aik_t;
/**
- * Get Attestation Identity Key (see section 3.12 of PTS Protocol: Binding to TNC IF-M Specification)
+ * Get Attestation Identity Key
+ * see section 3.12 of PTS Protocol: Binding to TNC IF-M Specification
*
* 1 2 3
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
typedef struct private_tcg_pts_attr_get_tpm_version_info_t private_tcg_pts_attr_get_tpm_version_info_t;
/**
- * Get TPM Version Information (see section 3.10 of PTS Protocol: Binding to TNC IF-M Specification)
+ * Get TPM Version Information
+ * see section 3.10 of PTS Protocol: Binding to TNC IF-M Specification
*
* 1 2 3
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
*/
#define PTS_GET_TPM_VER_INFO_SIZE 4
-#define PTS_GET_TPM_VER_INFO_RESERVED 0x00
+#define PTS_GET_TPM_VER_INFO_RESERVED 0x00
/**
* Private data of an tcg_pts_attr_get_tpm_version_info_t object.
typedef struct private_tcg_pts_attr_meas_algo_t private_tcg_pts_attr_meas_algo_t;
/**
- * PTS Measurement Algorithm (see section 3.9.1 of PTS Protocol: Binding to TNC IF-M Specification)
+ * PTS Measurement Algorithm
+ * see section 3.9.1 of PTS Protocol: Binding to TNC IF-M Specification
*
* 1 2 3
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
*/
/**
- * Diffie-Hellman Hash Algorithm Values (see section 3.8.5 of PTS Protocol: Binding to TNC IF-M Specification)
+ * Diffie-Hellman Hash Algorithm Values
+ * see section 3.8.5 of PTS Protocol: Binding to TNC IF-M Specification
*
* 1
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
/**
* Set of algorithms
*/
- pts_attr_meas_algorithms_t algorithms;
+ pts_meas_algorithms_t algorithms;
};
writer->write_uint16 (writer, PTS_MEAS_ALGO_RESERVED);
/* Determine the hash algorithms to set*/
- if(this->algorithms & PTS_MEAS_ALGO_SHA384) algorithms += 8192;
- if(this->algorithms & PTS_MEAS_ALGO_SHA256) algorithms += 16384;
- if(this->algorithms & PTS_MEAS_ALGO_SHA1) algorithms += 32768;
+ if (this->algorithms & PTS_MEAS_ALGO_SHA384)
+ {
+ algorithms += 8192;
+ }
+ if (this->algorithms & PTS_MEAS_ALGO_SHA256)
+ {
+ algorithms += 16384;
+ }
+ if (this->algorithms & PTS_MEAS_ALGO_SHA1)
+ {
+ algorithms += 32768;
+ }
writer->write_uint16(writer, algorithms);
this->value = chunk_clone(writer->get_buf(writer));
reader->read_uint16 (reader, &reserved);
reader->read_uint16(reader, &algorithms);
- if((algorithms >> 13) & 1) this->algorithms |= PTS_MEAS_ALGO_SHA384;
- if((algorithms >> 14) & 1) this->algorithms |= PTS_MEAS_ALGO_SHA256;
- if((algorithms >> 15) & 1) this->algorithms |= PTS_MEAS_ALGO_SHA1;
+ if ((algorithms >> 13) & 1)
+ {
+ this->algorithms |= PTS_MEAS_ALGO_SHA384;
+ }
+ if ((algorithms >> 14) & 1)
+ {
+ this->algorithms |= PTS_MEAS_ALGO_SHA256;
+ }
+ if ((algorithms >> 15) & 1)
+ {
+ this->algorithms |= PTS_MEAS_ALGO_SHA1;
+ }
reader->destroy(reader);
free(this);
}
-METHOD(tcg_pts_attr_meas_algo_t, get_algorithms, pts_attr_meas_algorithms_t,
+METHOD(tcg_pts_attr_meas_algo_t, get_algorithms, pts_meas_algorithms_t,
private_tcg_pts_attr_meas_algo_t *this)
{
return this->algorithms;
METHOD(tcg_pts_attr_meas_algo_t, set_algorithms, void,
private_tcg_pts_attr_meas_algo_t *this,
- pts_attr_meas_algorithms_t algorithms)
+ pts_meas_algorithms_t algorithms)
{
this->algorithms = algorithms;
}
/**
* Described in header.
*/
-pa_tnc_attr_t *tcg_pts_attr_meas_algo_create(pts_attr_meas_algorithms_t algorithms)
+pa_tnc_attr_t *tcg_pts_attr_meas_algo_create(pts_meas_algorithms_t algorithms)
{
private_tcg_pts_attr_meas_algo_t *this;
#define TCG_PTS_ATTR_MEAS_ALGO_H_
typedef struct tcg_pts_attr_meas_algo_t tcg_pts_attr_meas_algo_t;
-typedef enum pts_attr_meas_algorithms_t pts_attr_meas_algorithms_t;
+typedef enum pts_meas_algorithms_t pts_meas_algorithms_t;
#include "tcg_attr.h"
#include "pa_tnc/pa_tnc_attr.h"
/**
* PTS Measurement Algorithms
*/
-enum pts_attr_meas_algorithms_t {
+enum pts_meas_algorithms_t {
/** SHA-384 */
PTS_MEAS_ALGO_SHA1 = (1<<0),
/** SHA-256 */
*
* @return set of algorithms
*/
- pts_attr_meas_algorithms_t (*get_algorithms)(tcg_pts_attr_meas_algo_t *this);
+ pts_meas_algorithms_t (*get_algorithms)(tcg_pts_attr_meas_algo_t *this);
/**
* Set PTS Measurement Algorithm Set
* @param flags set of algorithms
*/
void (*set_algorithms)(tcg_pts_attr_meas_algo_t *this,
- pts_attr_meas_algorithms_t algorithms);
+ pts_meas_algorithms_t algorithms);
};
*
* @param algorithms set of algorithms
*/
-pa_tnc_attr_t* tcg_pts_attr_meas_algo_create(pts_attr_meas_algorithms_t algorithms);
+pa_tnc_attr_t* tcg_pts_attr_meas_algo_create(pts_meas_algorithms_t algorithms);
/**
* Creates an tcg_pts_attr_meas_algo_t object from received data
typedef struct private_tcg_pts_attr_meas_algo_selection_t private_tcg_pts_attr_meas_algo_selection_t;
/**
- * PTS Measurement Algorithm Selection (see section 3.9.2 of PTS Protocol: Binding to TNC IF-M Specification)
+ * PTS Measurement Algorithm Selection
+ * see section 3.9.2 of PTS Protocol: Binding to TNC IF-M Specification
*
* 1 2 3
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
/**
* A Selected Measurement Algorithm
*/
- pts_attr_meas_algorithms_t algorithm;
+ pts_meas_algorithms_t algorithm;
};
writer->write_uint16 (writer, PTS_MEAS_ALGO_SEL_RESERVED);
/* Determine the hash algorithm to set*/
- if(this->algorithm & PTS_MEAS_ALGO_SHA384) algorithm = 8192;
- else if(this->algorithm & PTS_MEAS_ALGO_SHA256) algorithm = 16384;
- else if(this->algorithm & PTS_MEAS_ALGO_SHA1) algorithm = 32768;
+ if (this->algorithm & PTS_MEAS_ALGO_SHA384)
+ {
+ algorithm = 8192;
+ }
+ else if (this->algorithm & PTS_MEAS_ALGO_SHA256)
+ {
+ algorithm = 16384;
+ }
+ else if (this->algorithm & PTS_MEAS_ALGO_SHA1)
+ {
+ algorithm = 32768;
+ }
writer->write_uint16(writer, algorithm);
this->value = chunk_clone(writer->get_buf(writer));
reader->read_uint16 (reader, &reserved);
reader->read_uint16(reader, &algorithm);
- if((algorithm >> 13) & 1) this->algorithm = PTS_MEAS_ALGO_SHA384;
- else if((algorithm >> 14) & 1) this->algorithm = PTS_MEAS_ALGO_SHA256;
- else if((algorithm >> 15) & 1) this->algorithm = PTS_MEAS_ALGO_SHA1;
+ if ((algorithm >> 13) & 1)
+ {
+ this->algorithm = PTS_MEAS_ALGO_SHA384;
+ }
+ else if ((algorithm >> 14) & 1)
+ {
+ this->algorithm = PTS_MEAS_ALGO_SHA256;
+ }
+ else if ((algorithm >> 15) & 1)
+ {
+ this->algorithm = PTS_MEAS_ALGO_SHA1;
+ }
reader->destroy(reader);
free(this);
}
-METHOD(tcg_pts_attr_meas_algo_selection_t, get_algorithm, pts_attr_meas_algorithms_t,
+METHOD(tcg_pts_attr_meas_algo_selection_t, get_algorithm, pts_meas_algorithms_t,
private_tcg_pts_attr_meas_algo_selection_t *this)
{
return this->algorithm;
METHOD(tcg_pts_attr_meas_algo_selection_t, set_algorithm, void,
private_tcg_pts_attr_meas_algo_selection_t *this,
- pts_attr_meas_algorithms_t algorithm)
+ pts_meas_algorithms_t algorithm)
{
this->algorithm = algorithm;
}
/**
* Described in header.
*/
-pa_tnc_attr_t *tcg_pts_attr_meas_algo_selection_create(pts_attr_meas_algorithms_t algorithm)
+pa_tnc_attr_t *tcg_pts_attr_meas_algo_selection_create(pts_meas_algorithms_t algorithm)
{
private_tcg_pts_attr_meas_algo_selection_t *this;
#define TCG_PTS_ATTR_MEAS_ALGO_SELECTION_H_
typedef struct tcg_pts_attr_meas_algo_selection_t tcg_pts_attr_meas_algo_selection_t;
-typedef enum pts_attr_meas_algorithms_t pts_attr_meas_algorithms_t;
#include "tcg_attr.h"
#include "pa_tnc/pa_tnc_attr.h"
-
-/**
- * PTS Measurement Algorithms
- */
-enum pts_attr_meas_algorithms_t {
- /** SHA-384 */
- PTS_MEAS_ALGO_SHA1 = (1<<0),
- /** SHA-256 */
- PTS_MEAS_ALGO_SHA256 = (1<<1),
- /** SHA-1 */
- PTS_MEAS_ALGO_SHA384 = (1<<2),
-};
+#include "tcg_pts_attr_meas_algo.h"
/**
* Class implementing the TCG Measurement Algorithm Selection Attribute
/**
* Get a selected PTS Measurement Algorithm
*
- * @return A Selected Measurement Algorithm
+ * @return A Selected Measurement Algorithm
*/
- pts_attr_meas_algorithms_t (*get_algorithm)(tcg_pts_attr_meas_algo_selection_t *this);
+ pts_meas_algorithms_t (*get_algorithm)(tcg_pts_attr_meas_algo_selection_t *this);
/**
* Set PTS Measurement Algorithm
* @param flags A Selected Measurement Algorithm
*/
void (*set_algorithm)(tcg_pts_attr_meas_algo_selection_t *this,
- pts_attr_meas_algorithms_t algorithm);
+ pts_meas_algorithms_t algorithm);
};
*
* @param algorithm A Selected Measurement Algorithm
*/
-pa_tnc_attr_t* tcg_pts_attr_meas_algo_selection_create(pts_attr_meas_algorithms_t algorithm);
+pa_tnc_attr_t* tcg_pts_attr_meas_algo_selection_create(pts_meas_algorithms_t algorithm);
/**
* Creates an tcg_pts_attr_meas_algo_selection_t object from received data
typedef struct private_tcg_pts_attr_proto_caps_t private_tcg_pts_attr_proto_caps_t;
/**
- * PTS Protocol Capabilities (see section 3.7 of PTS Protocol: Binding to TNC IF-M Specification)
+ * PTS Protocol Capabilities
+ * see section 3.7 of PTS Protocol: Binding to TNC IF-M Specification
*
* 1 2 3
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
/**
* Set of flags
*/
- pts_attr_proto_caps_flag_t flags;
+ pts_proto_caps_flag_t flags;
};
writer->write_uint24 (writer, PTS_PROTO_CAPS_RESERVED);
/* Determine the flags to set*/
- if(this->flags & PTS_PROTO_CAPS_XML) flags += 1;
- if(this->flags & PTS_PROTO_CAPS_T) flags += 2;
- if(this->flags & PTS_PROTO_CAPS_DH) flags += 4;
- if(this->flags & PTS_PROTO_CAPS_VER) flags += 8;
- if(this->flags & PTS_PROTO_CAPS_CURRENT) flags += 16;
+ if (this->flags & PTS_PROTO_CAPS_XML)
+ {
+ flags += 1;
+ }
+ if (this->flags & PTS_PROTO_CAPS_T)
+ {
+ flags += 2;
+ }
+ if (this->flags & PTS_PROTO_CAPS_DH)
+ {
+ flags += 4;
+ }
+ if (this->flags & PTS_PROTO_CAPS_VER)
+ {
+ flags += 8;
+ }
+ if (this->flags & PTS_PROTO_CAPS_CURRENT)
+ {
+ flags += 16;
+ }
writer->write_uint8(writer, flags);
this->value = chunk_clone(writer->get_buf(writer));
reader->read_uint24 (reader, &reserved);
reader->read_uint8(reader, &flags);
- if((flags >> 0) & 1) this->flags |= PTS_PROTO_CAPS_XML;
- if((flags >> 1) & 1) this->flags |= PTS_PROTO_CAPS_T;
- if((flags >> 2) & 1) this->flags |= PTS_PROTO_CAPS_DH;
- if((flags >> 3) & 1) this->flags |= PTS_PROTO_CAPS_VER;
- if((flags >> 4) & 1) this->flags |= PTS_PROTO_CAPS_CURRENT;
-
+ if ((flags >> 0) & 1)
+ {
+ this->flags |= PTS_PROTO_CAPS_XML;
+ }
+ if ((flags >> 1) & 1)
+ {
+ this->flags |= PTS_PROTO_CAPS_T;
+ }
+ if ((flags >> 2) & 1)
+ {
+ this->flags |= PTS_PROTO_CAPS_DH;
+ }
+ if ((flags >> 3) & 1)
+ {
+ this->flags |= PTS_PROTO_CAPS_VER;
+ }
+ if ((flags >> 4) & 1)
+ {
+ this->flags |= PTS_PROTO_CAPS_CURRENT;
+ }
+
reader->destroy(reader);
return SUCCESS;
free(this);
}
-METHOD(tcg_pts_attr_proto_caps_t, get_flags, pts_attr_proto_caps_flag_t,
+METHOD(tcg_pts_attr_proto_caps_t, get_flags, pts_proto_caps_flag_t,
private_tcg_pts_attr_proto_caps_t *this)
{
return this->flags;
METHOD(tcg_pts_attr_proto_caps_t, set_flags, void,
private_tcg_pts_attr_proto_caps_t *this,
- pts_attr_proto_caps_flag_t flags)
+ pts_proto_caps_flag_t flags)
{
this->flags = flags;
}
/**
* Described in header.
*/
-pa_tnc_attr_t *tcg_pts_attr_proto_caps_create(pts_attr_proto_caps_flag_t flags)
+pa_tnc_attr_t *tcg_pts_attr_proto_caps_create(pts_proto_caps_flag_t flags)
{
private_tcg_pts_attr_proto_caps_t *this;
#define TCG_PTS_ATTR_PROTO_CAPS_H_
typedef struct tcg_pts_attr_proto_caps_t tcg_pts_attr_proto_caps_t;
-typedef enum pts_attr_proto_caps_flag_t pts_attr_proto_caps_flag_t;
+typedef enum pts_proto_caps_flag_t pts_proto_caps_flag_t;
#include "tcg_attr.h"
#include "pa_tnc/pa_tnc_attr.h"
/**
* PTS Protocol Capabilities Flags
*/
-enum pts_attr_proto_caps_flag_t {
+enum pts_proto_caps_flag_t {
/** XML based Evidence Support flag */
- PTS_PROTO_CAPS_XML = (1<<0),
+ PTS_PROTO_CAPS_XML = (1<<0),
/** Trusted Platform Evidence flag */
- PTS_PROTO_CAPS_T = (1<<1),
+ PTS_PROTO_CAPS_T = (1<<1),
/** DH Nonce Negotiation Support flag */
- PTS_PROTO_CAPS_DH = (1<<2),
+ PTS_PROTO_CAPS_DH = (1<<2),
/** Verification Support flag */
- PTS_PROTO_CAPS_VER = (1<<3),
+ PTS_PROTO_CAPS_VER = (1<<3),
/** Current (In-Memory) Evidence Support flag */
- PTS_PROTO_CAPS_CURRENT = (1<<4),
+ PTS_PROTO_CAPS_CURRENT = (1<<4),
};
/**
*
* @return set of flags
*/
- pts_attr_proto_caps_flag_t (*get_flags)(tcg_pts_attr_proto_caps_t *this);
+ pts_proto_caps_flag_t (*get_flags)(tcg_pts_attr_proto_caps_t *this);
/**
* Set PTS procol capabilities flags
*
- * @param flags set of flags
+ * @param flags set of flags
*/
void (*set_flags)(tcg_pts_attr_proto_caps_t *this,
- pts_attr_proto_caps_flag_t flags);
+ pts_proto_caps_flag_t flags);
};
*
* @param flags set of flags
*/
-pa_tnc_attr_t* tcg_pts_attr_proto_caps_create(pts_attr_proto_caps_flag_t flags);
+pa_tnc_attr_t* tcg_pts_attr_proto_caps_create(pts_proto_caps_flag_t flags);
/**
* Creates an tcg_pts_attr_proto_caps_t object from received data
typedef struct private_tcg_pts_attr_req_file_meas_t private_tcg_pts_attr_req_file_meas_t;
/**
- * Request File Measurement (see section 3.19.1 of PTS Protocol: Binding to TNC IF-M Specification)
+ * Request File Measurement
+ * see section 3.19.1 of PTS Protocol: Binding to TNC IF-M Specification
*
* 1 2 3
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
writer = bio_writer_create(PTS_REQ_FILE_MEAS_SIZE);
- if(this->directory_flag) flags += 128;
+ if (this->directory_flag)
+ {
+ flags += 128;
+ }
writer->write_uint8(writer, flags);
writer->write_uint8(writer, PTS_REQ_FILE_MEAS_RESERVED);
writer->write_uint16(writer, this->request_id);
typedef struct private_tcg_pts_attr_req_funct_comp_evid_t private_tcg_pts_attr_req_funct_comp_evid_t;
/**
- * Request Functional Component Evidence (see section 3.14.1 of PTS Protocol: Binding to TNC IF-M Specification)
+ * Request Functional Component Evidence
+ * see section 3.14.1 of PTS Protocol: Binding to TNC IF-M Specification
*
* 1 2 3
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
*/
/**
- * Qualifier for Functional Component (see section 5.2 of PTS Protocol: Binding to TNC IF-M Specification)
+ * Qualifier for Functional Component
+ * see section 5.2 of PTS Protocol: Binding to TNC IF-M Specification
*
*
* 0 1 2 3 4 5
writer = bio_writer_create(PTS_REQ_FUNCT_COMP_EVID_SIZE);
/* Determine the flags to set*/
- if(this->flags & PTS_REQ_FUNC_COMP_FLAG_PCR) flags += 128;
- if(this->flags & PTS_REQ_FUNC_COMP_FLAG_CURR) flags += 64;
- if(this->flags & PTS_REQ_FUNC_COMP_FLAG_VER) flags += 32;
- if(this->flags & PTS_REQ_FUNC_COMP_FLAG_TTC) flags += 16;
-
+ if (this->flags & PTS_REQ_FUNC_COMP_FLAG_PCR)
+ {
+ flags += 128;
+ }
+ if (this->flags & PTS_REQ_FUNC_COMP_FLAG_CURR)
+ {
+ flags += 64;
+ }
+ if (this->flags & PTS_REQ_FUNC_COMP_FLAG_VER)
+ {
+ flags += 32;
+ }
+ if (this->flags & PTS_REQ_FUNC_COMP_FLAG_TTC)
+ {
+ flags += 16;
+ }
writer->write_uint8(writer, flags);
writer->write_uint24 (writer, this->depth);
}
qualifier += this->qualifier.type;
- if(this->qualifier.kernel) qualifier += 16;
- if(this->qualifier.sub_component) qualifier += 32;
-
+ if (this->qualifier.kernel)
+ {
+ qualifier += 16;
+ }
+ if (this->qualifier.sub_component)
+ {
+ qualifier += 32;
+ }
writer->write_uint8 (writer, qualifier);
writer->write_uint32 (writer, this->name);
reader = bio_reader_create(this->value);
reader->read_uint8(reader, &flags);
- if((flags >> 4) & 1) this->flags |= PTS_REQ_FUNC_COMP_FLAG_PCR;
- if((flags >> 5) & 1) this->flags |= PTS_REQ_FUNC_COMP_FLAG_CURR;
- if((flags >> 6) & 1) this->flags |= PTS_REQ_FUNC_COMP_FLAG_VER;
- if((flags >> 7) & 1) this->flags |= PTS_REQ_FUNC_COMP_FLAG_TTC;
+ if ((flags >> 4) & 1)
+ {
+ this->flags |= PTS_REQ_FUNC_COMP_FLAG_PCR;
+ }
+ if ((flags >> 5) & 1)
+ {
+ this->flags |= PTS_REQ_FUNC_COMP_FLAG_CURR;
+ }
+ if ((flags >> 6) & 1)
+ {
+ this->flags |= PTS_REQ_FUNC_COMP_FLAG_VER;
+ }
+ if ((flags >> 7) & 1)
+ {
+ this->flags |= PTS_REQ_FUNC_COMP_FLAG_TTC;
+ }
reader->read_uint24(reader, &this->depth);
reader->read_uint24(reader, &this->comp_vendor_id);
reader->read_uint8(reader, &fam_and_qualifier);
- if(((fam_and_qualifier >> 6) & 1) ) this->family += 1;
- if(((fam_and_qualifier >> 7) & 1) ) this->family += 2;
+ if (((fam_and_qualifier >> 6) & 1) )
+ {
+ this->family += 1;
+ }
+ if (((fam_and_qualifier >> 7) & 1) )
+ {
+ this->family += 2;
+ }
/* TODO: Generate an IF-M error attribute indicating */
/* TCG_PTS_INVALID_NAME_FAM */
// DBG1(DBG_TNC, "Functional Name Encoding Family is not set to 00");
//}
- if(((fam_and_qualifier >> 5) & 1) ) this->qualifier.kernel = true;
- if(((fam_and_qualifier >> 4) & 1) ) this->qualifier.sub_component = true;
+ if (((fam_and_qualifier >> 5) & 1) )
+ {
+ this->qualifier.kernel = true;
+ }
+ if (((fam_and_qualifier >> 4) & 1) )
+ {
+ this->qualifier.sub_component = true;
+ }
this->qualifier.type = ( fam_and_qualifier & 0xF );
/* TODO: Check the type is defined in pts_attr_req_funct_comp_type_t */
typedef struct private_tcg_pts_attr_req_proto_caps_t private_tcg_pts_attr_req_proto_caps_t;
/**
- * Request PTS Protocol Capabilities (see section 3.6 of PTS Protocol: Binding to TNC IF-M Specification)
+ * Request PTS Protocol Capabilities
+ * see section 3.6 of PTS Protocol: Binding to TNC IF-M Specification
*
* 1 2 3
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
/**
* Set of flags
*/
- pts_attr_req_proto_caps_flag_t flags;
+ pts_proto_caps_flag_t flags;
};
writer->write_uint24 (writer, PTS_PROTO_CAPS_RESERVED);
/* Determine the flags to set*/
- if(this->flags & PTS_PROTO_CAPS_XML) flags += 1;
- if(this->flags & PTS_PROTO_CAPS_T) flags += 2;
- if(this->flags & PTS_PROTO_CAPS_DH) flags += 4;
- if(this->flags & PTS_PROTO_CAPS_VER) flags += 8;
- if(this->flags & PTS_PROTO_CAPS_CURRENT) flags += 16;
+ if (this->flags & PTS_PROTO_CAPS_XML)
+ {
+ flags += 1;
+ }
+ if (this->flags & PTS_PROTO_CAPS_T)
+ {
+ flags += 2;
+ }
+ if (this->flags & PTS_PROTO_CAPS_DH)
+ {
+ flags += 4;
+ }
+ if (this->flags & PTS_PROTO_CAPS_VER)
+ {
+ flags += 8;
+ }
+ if (this->flags & PTS_PROTO_CAPS_CURRENT)
+ {
+ flags += 16;
+ }
writer->write_uint8(writer, flags);
this->value = chunk_clone(writer->get_buf(writer));
reader->read_uint24 (reader, &reserved);
reader->read_uint8(reader, &flags);
- if((flags >> 0) & 1) this->flags |= PTS_PROTO_CAPS_XML;
- if((flags >> 1) & 1) this->flags |= PTS_PROTO_CAPS_T;
- if((flags >> 2) & 1) this->flags |= PTS_PROTO_CAPS_DH;
- if((flags >> 3) & 1) this->flags |= PTS_PROTO_CAPS_VER;
- if((flags >> 4) & 1) this->flags |= PTS_PROTO_CAPS_CURRENT;
+ if ((flags >> 0) & 1)
+ {
+ this->flags |= PTS_PROTO_CAPS_XML;
+ }
+ if ((flags >> 1) & 1)
+ {
+ this->flags |= PTS_PROTO_CAPS_T;
+ }
+ if ((flags >> 2) & 1)
+ {
+ this->flags |= PTS_PROTO_CAPS_DH;
+ }
+ if ((flags >> 3) & 1)
+ {
+ this->flags |= PTS_PROTO_CAPS_VER;
+ }
+ if ((flags >> 4) & 1)
+ {
+ this->flags |= PTS_PROTO_CAPS_CURRENT;
+ }
reader->destroy(reader);
free(this);
}
-METHOD(tcg_pts_attr_req_proto_caps_t, get_flags, pts_attr_req_proto_caps_flag_t,
+METHOD(tcg_pts_attr_req_proto_caps_t, get_flags, pts_proto_caps_flag_t,
private_tcg_pts_attr_req_proto_caps_t *this)
{
return this->flags;
}
METHOD(tcg_pts_attr_req_proto_caps_t, set_flags, void,
- private_tcg_pts_attr_req_proto_caps_t *this,
- pts_attr_req_proto_caps_flag_t flags)
+ private_tcg_pts_attr_req_proto_caps_t *this, pts_proto_caps_flag_t flags)
{
this->flags = flags;
}
/**
* Described in header.
*/
-pa_tnc_attr_t *tcg_pts_attr_req_proto_caps_create(pts_attr_req_proto_caps_flag_t flags)
+pa_tnc_attr_t *tcg_pts_attr_req_proto_caps_create(pts_proto_caps_flag_t flags)
{
private_tcg_pts_attr_req_proto_caps_t *this;
#define TCG_PTS_ATTR_REQ_PROTO_CAPS_H_
typedef struct tcg_pts_attr_req_proto_caps_t tcg_pts_attr_req_proto_caps_t;
-typedef enum pts_attr_req_proto_caps_flag_t pts_attr_req_proto_caps_flag_t;
#include "tcg_attr.h"
#include "pa_tnc/pa_tnc_attr.h"
-
-/**
- * PTS Request Protocol Capabilities Flags
- */
-enum pts_attr_req_proto_caps_flag_t {
- /** XML based Evidence Support flag */
- PTS_PROTO_CAPS_XML = (1<<0),
- /** Trusted Platform Evidence flag */
- PTS_PROTO_CAPS_T = (1<<1),
- /** DH Nonce Negotiation Support flag */
- PTS_PROTO_CAPS_DH = (1<<2),
- /** Verification Support flag */
- PTS_PROTO_CAPS_VER = (1<<3),
- /** Current (In-Memory) Evidence Support flag */
- PTS_PROTO_CAPS_CURRENT = (1<<4),
-};
+#include "tcg_pts_attr_proto_caps.h"
/**
* Class implementing the TCG Request PTS Protocol Capabilities Attribute
*
* @return set of flags
*/
- pts_attr_req_proto_caps_flag_t (*get_flags)(tcg_pts_attr_req_proto_caps_t *this);
+ pts_proto_caps_flag_t (*get_flags)(tcg_pts_attr_req_proto_caps_t *this);
/**
* Set PTS procol capabilities flags
* @param flags set of flags
*/
void (*set_flags)(tcg_pts_attr_req_proto_caps_t *this,
- pts_attr_req_proto_caps_flag_t flags);
+ pts_proto_caps_flag_t flags);
};
*
* @param flags set of flags
*/
-pa_tnc_attr_t* tcg_pts_attr_req_proto_caps_create(pts_attr_req_proto_caps_flag_t flags);
+pa_tnc_attr_t* tcg_pts_attr_req_proto_caps_create(pts_proto_caps_flag_t flags);
/**
* Creates an tcg_pts_attr_req_proto_caps_t object from received data
typedef struct private_tcg_pts_attr_simple_comp_evid_t private_tcg_pts_attr_simple_comp_evid_t;
/**
- * Simple Component Evidence (see section 3.15.1 of PTS Protocol: Binding to TNC IF-M Specification)
+ * Simple Component Evidence
+ * see section 3.15.1 of PTS Protocol: Binding to TNC IF-M Specification
*
* 1 2 3
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
/**
* Specific Functional Component -> Component Functional Name Structure
- * (see section 5.1 of PTS Protocol: Binding to TNC IF-M Specification)
+ * see section 5.1 of PTS Protocol: Binding to TNC IF-M Specification
*
* 1 2 3
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
*/
/**
- * Qualifier for Functional Component (see section 5.2 of PTS Protocol: Binding to TNC IF-M Specification)
+ * Qualifier for Functional Component
+ * see section 5.2 of PTS Protocol: Binding to TNC IF-M Specification
*
*
* 0 1 2 3 4 5
/**
* Hash Algorithm
*/
- pts_attr_meas_algorithms_t hash_algorithm;
+ pts_meas_algorithms_t hash_algorithm;
/**
* Transformation type for PCR
writer = bio_writer_create(PTS_SIMPLE_COMP_EVID_SIZE);
/* Determine the flags to set*/
- if(this->flags & PTS_SIMPLE_COMP_EVID_FLAG_PCR) flags += 128;
- if(this->flags & PTS_SIMPLE_COMP_EVID_FLAG_NO_VER) flags += 32;
- else if(this->flags & PTS_SIMPLE_COMP_EVID_FLAG_VER_FAIL) flags += 64;
- else if(this->flags & PTS_SIMPLE_COMP_EVID_FLAG_VER_PASS) flags += 96;
+ if (this->flags & PTS_SIMPLE_COMP_EVID_FLAG_PCR)
+ {
+ flags += 128;
+ }
+ if (this->flags & PTS_SIMPLE_COMP_EVID_FLAG_NO_VER)
+ {
+ flags += 32;
+ }
+ else if (this->flags & PTS_SIMPLE_COMP_EVID_FLAG_VER_FAIL)
+ {
+ flags += 64;
+ }
+ else if (this->flags & PTS_SIMPLE_COMP_EVID_FLAG_VER_PASS)
+ {
+ flags += 96;
+ }
writer->write_uint8(writer, flags);
writer->write_uint24 (writer, this->depth);
writer->write_uint24 (writer, this->comp_vendor_id);
- if(this->family != PTS_REQ_FUNCT_COMP_FAM_BIN_ENUM)
+ if (this->family != PTS_REQ_FUNCT_COMP_FAM_BIN_ENUM)
{
DBG1(DBG_TNC, "Functional Name Encoding Family is not set to 00");
}
qualifier += this->qualifier.type;
- if(this->qualifier.kernel) qualifier += 16;
- if(this->qualifier.sub_component) qualifier += 32;
+ if (this->qualifier.kernel)
+ {
+ qualifier += 16;
+ }
+ if (this->qualifier.sub_component)
+ {
+ qualifier += 32;
+ }
/* Unknown or Wildcard should not be used for Qualification*/
- if(!qualifier || qualifier == 63)
+ if (!qualifier || qualifier == 63)
{
DBG1(DBG_TNC, "Unknown or Wildcard should not be used for"
" Functional Name Qualifier");
writer->write_uint24 (writer, this->extended_pcr);
/* Determine the hash algorithm to set*/
- if(this->hash_algorithm & PTS_MEAS_ALGO_SHA384) algorithm = 8192;
- else if(this->hash_algorithm & PTS_MEAS_ALGO_SHA256) algorithm = 16384;
- else if(this->hash_algorithm & PTS_MEAS_ALGO_SHA1) algorithm = 32768;
+ if (this->hash_algorithm & PTS_MEAS_ALGO_SHA384)
+ {
+ algorithm = 8192;
+ }
+ else if (this->hash_algorithm & PTS_MEAS_ALGO_SHA256)
+ {
+ algorithm = 16384;
+ }
+ else if (this->hash_algorithm & PTS_MEAS_ALGO_SHA1)
+ {
+ algorithm = 32768;
+ }
writer->write_uint16(writer, algorithm);
writer->write_uint8 (writer, this->transformation);
writer->write_data (writer, this->measurement_time);
/* Optional fields */
- if(this->policy_uri.ptr && this->policy_uri.len > 0)
+ if (this->policy_uri.ptr && this->policy_uri.len > 0)
{
writer->write_uint16 (writer, this->policy_uri.len);
writer->write_data (writer, this->policy_uri);
}
- if(this->pcr_before.ptr && this->pcr_after.ptr &&
+ if (this->pcr_before.ptr && this->pcr_after.ptr &&
this->pcr_before.len == this->pcr_after.len &&
this->pcr_before.len > 0 && this->pcr_after.len > 0)
{
reader->read_uint8(reader, &flags);
/* Determine the flags to set*/
- if((flags >> 7) & 1) this->flags |= PTS_SIMPLE_COMP_EVID_FLAG_PCR;
-
- if(!((flags >> 6) & 1) && !((flags >> 5) & 1))
+ if ((flags >> 7) & 1)
+ {
+ this->flags |= PTS_SIMPLE_COMP_EVID_FLAG_PCR;
+ }
+ if (!((flags >> 6) & 1) && !((flags >> 5) & 1))
+ {
this->flags |= PTS_SIMPLE_COMP_EVID_FLAG_NO_VALID;
- else if(!((flags >> 6) & 1) && ((flags >> 5) & 1))
+ }
+ else if (!((flags >> 6) & 1) && ((flags >> 5) & 1))
+ {
this->flags |= PTS_SIMPLE_COMP_EVID_FLAG_NO_VER;
- else if(((flags >> 6) & 1) && !((flags >> 5) & 1))
+ }
+ else if (((flags >> 6) & 1) && !((flags >> 5) & 1))
+ {
this->flags |= PTS_SIMPLE_COMP_EVID_FLAG_VER_FAIL;
- else if(((flags >> 6) & 1) && ((flags >> 5) & 1))
+ }
+ else if (((flags >> 6) & 1) && ((flags >> 5) & 1))
+ {
this->flags |= PTS_SIMPLE_COMP_EVID_FLAG_VER_PASS;
+ }
reader->read_uint24(reader, &this->depth);
reader->read_uint24(reader, &this->comp_vendor_id);
reader->read_uint8(reader, &fam_and_qualifier);
- if(((fam_and_qualifier >> 6) & 1) ) this->family += 1;
- if(((fam_and_qualifier >> 7) & 1) ) this->family += 2;
+ if (((fam_and_qualifier >> 6) & 1) )
+ {
+ this->family += 1;
+ }
+ if (((fam_and_qualifier >> 7) & 1) )
+ {
+ this->family += 2;
+ }
/* TODO: Generate an IF-M error attribute indicating */
/* TCG_PTS_INVALID_NAME_FAM */
// DBG1(DBG_TNC, "Functional Name Encoding Family is not set to 00");
//}
- if(((fam_and_qualifier >> 5) & 1) ) this->qualifier.kernel = true;
- if(((fam_and_qualifier >> 4) & 1) ) this->qualifier.sub_component = true;
+ if (((fam_and_qualifier >> 5) & 1) )
+ {
+ this->qualifier.kernel = true;
+ }
+ if (((fam_and_qualifier >> 4) & 1) )
+ {
+ this->qualifier.sub_component = true;
+ }
this->qualifier.type = ( fam_and_qualifier & 0xF );
/* TODO: Check the type is defined in pts_attr_req_funct_comp_type_t */
/* Unknown or Wildcard should not be used for Qualification*/
- if(!(fam_and_qualifier & 0x3F) || (fam_and_qualifier & 0x3F) == 0x3F)
+ if (!(fam_and_qualifier & 0x3F) || (fam_and_qualifier & 0x3F) == 0x3F)
{
DBG1(DBG_TNC, "Unknown or Wildcard should not be used for"
" Functional Name Qualifier");
reader->read_uint24(reader, &this->extended_pcr);
reader->read_uint16(reader, &algorithm);
- if((algorithm >> 13) & 1) this->hash_algorithm = PTS_MEAS_ALGO_SHA384;
- else if((algorithm >> 14) & 1) this->hash_algorithm = PTS_MEAS_ALGO_SHA256;
- else if((algorithm >> 15) & 1) this->hash_algorithm = PTS_MEAS_ALGO_SHA1;
+ if ((algorithm >> 13) & 1)
+ {
+ this->hash_algorithm = PTS_MEAS_ALGO_SHA384;
+ }
+ else if ((algorithm >> 14) & 1)
+ {
+ this->hash_algorithm = PTS_MEAS_ALGO_SHA256;
+ }
+ else if ((algorithm >> 15) & 1)
+ {
+ this->hash_algorithm = PTS_MEAS_ALGO_SHA1;
+ }
reader->read_uint8(reader, &transformation);
this->transformation = transformation;
&this->measurement_time);
/* Optional Policy URI field is included */
- if(this->flags & PTS_SIMPLE_COMP_EVID_FLAG_VER_FAIL ||
+ if (this->flags & PTS_SIMPLE_COMP_EVID_FLAG_VER_FAIL ||
this->flags & PTS_SIMPLE_COMP_EVID_FLAG_VER_PASS)
{
u_int16_t policy_uri_len;
}
/* Optional PCR value fields are included */
- if(this->flags & PTS_SIMPLE_COMP_EVID_FLAG_PCR)
+ if (this->flags & PTS_SIMPLE_COMP_EVID_FLAG_PCR)
{
u_int16_t pcr_value_len;
reader->read_uint16(reader, &pcr_value_len);
this->extended_pcr = extended_pcr;
}
-METHOD(tcg_pts_attr_simple_comp_evid_t, get_hash_algorithm, pts_attr_meas_algorithms_t,
+METHOD(tcg_pts_attr_simple_comp_evid_t, get_hash_algorithm, pts_meas_algorithms_t,
private_tcg_pts_attr_simple_comp_evid_t *this)
{
return this->hash_algorithm;
}
METHOD(tcg_pts_attr_simple_comp_evid_t, set_hash_algorithm, void,
- private_tcg_pts_attr_simple_comp_evid_t *this, pts_attr_meas_algorithms_t hash_algorithm)
+ private_tcg_pts_attr_simple_comp_evid_t *this, pts_meas_algorithms_t hash_algorithm)
{
this->hash_algorithm = hash_algorithm;
}
tcg_pts_qualifier_t qualifier,
pts_attr_req_funct_comp_name_bin_enum_t name,
u_int32_t extended_pcr,
- pts_attr_meas_algorithms_t hash_algorithm,
+ pts_meas_algorithms_t hash_algorithm,
pts_attr_simple_comp_evid_pcr_transform_t transformation,
chunk_t measurement_time,
chunk_t policy_uri,
*
* @return Hash Algorithm
*/
- pts_attr_meas_algorithms_t (*get_hash_algorithm)(tcg_pts_attr_simple_comp_evid_t *this);
+ pts_meas_algorithms_t (*get_hash_algorithm)(tcg_pts_attr_simple_comp_evid_t *this);
/**
* Set Hash Algorithm
* @param hash_algorithm Hash Algorithm
*/
void (*set_hash_algorithm)(tcg_pts_attr_simple_comp_evid_t *this,
- pts_attr_meas_algorithms_t hash_algorithm);
+ pts_meas_algorithms_t hash_algorithm);
/**
* Get PCR Transformation
tcg_pts_qualifier_t qualifier,
pts_attr_req_funct_comp_name_bin_enum_t name,
u_int32_t extended_pcr,
- pts_attr_meas_algorithms_t hash_algorithm,
+ pts_meas_algorithms_t hash_algorithm,
pts_attr_simple_comp_evid_pcr_transform_t transformation,
chunk_t measurement_time,
chunk_t policy_uri,
typedef struct private_tcg_pts_attr_simple_evid_final_t private_tcg_pts_attr_simple_evid_final_t;
/**
- * Simple Evidence Final (see section 3.15.2 of PTS Protocol: Binding to TNC IF-M Specification)
+ * Simple Evidence Final
+ * see section 3.15.2 of PTS Protocol: Binding to TNC IF-M Specification
*
* 1 2 3
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
/**
* Set of flags for Simple Evidence Final
*/
- pts_attr_simple_evid_final_flag_t flags;
+ pts_simple_evid_final_flag_t flags;
/**
* Optional Composite Hash Algorithm
*/
- pts_attr_meas_algorithms_t comp_hash_algorithm;
+ pts_meas_algorithms_t comp_hash_algorithm;
/**
* Optional TPM PCR Composite
writer = bio_writer_create(PTS_SIMPLE_EVID_FINAL_SIZE);
/* Determine the flags to set*/
- if(this->flags & PTS_SIMPLE_EVID_FINAL_FLAG_TPM_QUOTE_INFO) flags += 64;
- else if(this->flags & PTS_SIMPLE_EVID_FINAL_FLAG_TPM_QUOTE_INFO2) flags += 128;
- else if(this->flags & PTS_SIMPLE_EVID_FINAL_FLAG_TPM_QUOTE_INFO2_CAP_VER) flags += 192;
-
- if(this->flags & PTS_SIMPLE_EVID_FINAL_FLAG_EVID) flags += 32;
-
+ if (this->flags & PTS_SIMPLE_EVID_FINAL_FLAG_TPM_QUOTE_INFO)
+ {
+ flags += 64;
+ }
+ else if (this->flags & PTS_SIMPLE_EVID_FINAL_FLAG_TPM_QUOTE_INFO2)
+ {
+ flags += 128;
+ }
+ else if (this->flags & PTS_SIMPLE_EVID_FINAL_FLAG_TPM_QUOTE_INFO2_CAP_VER)
+ {
+ flags += 192;
+ }
+ if (this->flags & PTS_SIMPLE_EVID_FINAL_FLAG_EVID)
+ {
+ flags += 32;
+ }
writer->write_uint8(writer, flags);
writer->write_uint8(writer, PTS_SIMPLE_EVID_FINAL_RESERVED);
/* Determine the hash algorithm to set*/
- if(this->comp_hash_algorithm & PTS_MEAS_ALGO_SHA384) algorithm = 8192;
- else if(this->comp_hash_algorithm & PTS_MEAS_ALGO_SHA256) algorithm = 16384;
- else if(this->comp_hash_algorithm & PTS_MEAS_ALGO_SHA1) algorithm = 32768;
+ if (this->comp_hash_algorithm & PTS_MEAS_ALGO_SHA384)
+ {
+ algorithm = 8192;
+ }
+ else if (this->comp_hash_algorithm & PTS_MEAS_ALGO_SHA256)
+ {
+ algorithm = 16384;
+ }
+ else if (this->comp_hash_algorithm & PTS_MEAS_ALGO_SHA1)
+ {
+ algorithm = 32768;
+ }
writer->write_uint16(writer, algorithm);
/* Optional fields */
- if(this->pcr_comp.ptr && this->pcr_comp.len > 0)
+ if (this->pcr_comp.ptr && this->pcr_comp.len > 0)
{
writer->write_uint32 (writer, this->pcr_comp.len);
writer->write_data (writer, this->pcr_comp);
}
- if(this->tpm_quote_sign.ptr && this->tpm_quote_sign.len > 0)
+ if (this->tpm_quote_sign.ptr && this->tpm_quote_sign.len > 0)
{
writer->write_uint32 (writer, this->tpm_quote_sign.len);
writer->write_data (writer, this->tpm_quote_sign);
}
- if(this->evid_sign.ptr && this->evid_sign.len > 0)
+ if (this->evid_sign.ptr && this->evid_sign.len > 0)
{
writer->write_data (writer, this->evid_sign);
}
reader->read_uint8(reader, &flags);
/* Determine the flags to set*/
- if(!((flags >> 7) & 1) && !((flags >> 6) & 1))
+ if (!((flags >> 7) & 1) && !((flags >> 6) & 1))
+ {
this->flags |= PTS_SIMPLE_EVID_FINAL_FLAG_NO;
- else if(!((flags >> 7) & 1) && ((flags >> 6) & 1))
+ }
+ else if (!((flags >> 7) & 1) && ((flags >> 6) & 1))
+ {
this->flags |= PTS_SIMPLE_EVID_FINAL_FLAG_TPM_QUOTE_INFO;
- else if(((flags >> 7) & 1) && !((flags >> 6) & 1))
+ }
+ else if (((flags >> 7) & 1) && !((flags >> 6) & 1))
+ {
this->flags |= PTS_SIMPLE_EVID_FINAL_FLAG_TPM_QUOTE_INFO2;
- else if(((flags >> 7) & 1) && ((flags >> 6) & 1))
+ }
+ else if (((flags >> 7) & 1) && ((flags >> 6) & 1))
+ {
this->flags |= PTS_SIMPLE_EVID_FINAL_FLAG_TPM_QUOTE_INFO2_CAP_VER;
-
- if((flags >> 5) & 1) this->flags |= PTS_SIMPLE_EVID_FINAL_FLAG_EVID;
+ }
+ if ((flags >> 5) & 1)
+ {
+ this->flags |= PTS_SIMPLE_EVID_FINAL_FLAG_EVID;
+ }
reader->read_uint8(reader, &reserved);
reader->read_uint16(reader, &algorithm);
- if((algorithm >> 13) & 1) this->comp_hash_algorithm = PTS_MEAS_ALGO_SHA384;
- else if((algorithm >> 14) & 1) this->comp_hash_algorithm = PTS_MEAS_ALGO_SHA256;
- else if((algorithm >> 15) & 1) this->comp_hash_algorithm = PTS_MEAS_ALGO_SHA1;
+ if ((algorithm >> 13) & 1)
+ {
+ this->comp_hash_algorithm = PTS_MEAS_ALGO_SHA384;
+ }
+ else if ((algorithm >> 14) & 1)
+ {
+ this->comp_hash_algorithm = PTS_MEAS_ALGO_SHA256;
+ }
+ else if ((algorithm >> 15) & 1)
+ {
+ this->comp_hash_algorithm = PTS_MEAS_ALGO_SHA1;
+ }
/* Optional TPM PCR Composite field is included */
- if(!(this->flags & PTS_SIMPLE_EVID_FINAL_FLAG_NO))
+ if (!(this->flags & PTS_SIMPLE_EVID_FINAL_FLAG_NO))
{
u_int32_t pcr_comp_len;
u_int32_t tpm_quote_sign_len;
}
/* Optional Evidence Signature field is included */
- if(this->flags & PTS_SIMPLE_EVID_FINAL_FLAG_EVID)
+ if (this->flags & PTS_SIMPLE_EVID_FINAL_FLAG_EVID)
{
u_int32_t evid_sign_len = reader->remaining(reader);
reader->read_data(reader, evid_sign_len, &this->evid_sign);
free(this);
}
-METHOD(tcg_pts_attr_simple_evid_final_t, get_flags, pts_attr_simple_evid_final_flag_t,
+METHOD(tcg_pts_attr_simple_evid_final_t, get_flags, pts_simple_evid_final_flag_t,
private_tcg_pts_attr_simple_evid_final_t *this)
{
return this->flags;
}
METHOD(tcg_pts_attr_simple_evid_final_t, set_flags, void,
- private_tcg_pts_attr_simple_evid_final_t *this, pts_attr_simple_evid_final_flag_t flags)
+ private_tcg_pts_attr_simple_evid_final_t *this, pts_simple_evid_final_flag_t flags)
{
this->flags = flags;
}
-METHOD(tcg_pts_attr_simple_evid_final_t, get_comp_hash_algorithm, pts_attr_meas_algorithms_t,
+METHOD(tcg_pts_attr_simple_evid_final_t, get_comp_hash_algorithm, pts_meas_algorithms_t,
private_tcg_pts_attr_simple_evid_final_t *this)
{
return this->comp_hash_algorithm;
}
METHOD(tcg_pts_attr_simple_evid_final_t, set_comp_hash_algorithm, void,
- private_tcg_pts_attr_simple_evid_final_t *this, pts_attr_meas_algorithms_t comp_hash_algorithm)
+ private_tcg_pts_attr_simple_evid_final_t *this, pts_meas_algorithms_t comp_hash_algorithm)
{
this->comp_hash_algorithm = comp_hash_algorithm;
}
METHOD(tcg_pts_attr_simple_evid_final_t, get_comp_pcr_len, u_int32_t,
private_tcg_pts_attr_simple_evid_final_t *this)
{
- if(this->pcr_comp.ptr && this->pcr_comp.len > 0)
- return this->pcr_comp.len;
- else return 0;
+ if (this->pcr_comp.ptr && this->pcr_comp.len > 0)
+ {
+ return this->pcr_comp.len;
+ }
+ return 0;
}
METHOD(tcg_pts_attr_simple_evid_final_t, get_pcr_comp, chunk_t,
METHOD(tcg_pts_attr_simple_evid_final_t, get_tpm_quote_sign_len, u_int32_t,
private_tcg_pts_attr_simple_evid_final_t *this)
{
- if(this->tpm_quote_sign.ptr && this->tpm_quote_sign.len > 0)
- return this->tpm_quote_sign.len;
- else return 0;
+ if (this->tpm_quote_sign.ptr && this->tpm_quote_sign.len > 0)
+ {
+ return this->tpm_quote_sign.len;
+ }
+ return 0;
}
METHOD(tcg_pts_attr_simple_evid_final_t, get_tpm_quote_sign, chunk_t,
* Described in header.
*/
pa_tnc_attr_t *tcg_pts_attr_simple_evid_final_create(
- pts_attr_simple_evid_final_flag_t flags,
- pts_attr_meas_algorithms_t comp_hash_algorithm,
+ pts_simple_evid_final_flag_t flags,
+ pts_meas_algorithms_t comp_hash_algorithm,
chunk_t pcr_comp,
chunk_t tpm_quote_sign,
chunk_t evid_sign)
#define TCG_PTS_ATTR_SIMPLE_EVID_FINAL_H_
typedef struct tcg_pts_attr_simple_evid_final_t tcg_pts_attr_simple_evid_final_t;
-typedef enum pts_attr_simple_evid_final_flag_t pts_attr_simple_evid_final_flag_t;
+typedef enum pts_simple_evid_final_flag_t pts_simple_evid_final_flag_t;
#include "tcg_attr.h"
#include "pa_tnc/pa_tnc_attr.h"
/**
* PTS Simple Evidence Final Flags
*/
-enum pts_attr_simple_evid_final_flag_t {
+enum pts_simple_evid_final_flag_t {
/** No Optional TPM PCR Composite nor Optional TPM Quote Signature fields included */
- PTS_SIMPLE_EVID_FINAL_FLAG_NO = 0,
+ PTS_SIMPLE_EVID_FINAL_FLAG_NO = 0,
/** Optional TPM PCR Composite and Optional TPM Quote Signature fields included */
/** using TPM_QUOTE_INFO */
- PTS_SIMPLE_EVID_FINAL_FLAG_TPM_QUOTE_INFO = 1,
+ PTS_SIMPLE_EVID_FINAL_FLAG_TPM_QUOTE_INFO = 1,
/** Optional TPM PCR Composite and Optional TPM Quote Signature fields included */
/** using TPM_QUOTE_INFO2, TPM_CAP_VERSION_INFO was not appended */
- PTS_SIMPLE_EVID_FINAL_FLAG_TPM_QUOTE_INFO2 = 2,
+ PTS_SIMPLE_EVID_FINAL_FLAG_TPM_QUOTE_INFO2 = 2,
/** Optional TPM PCR Composite and Optional TPM Quote Signature fields included */
/** using TPM_QUOTE_INFO2, TPM_CAP_VERSION_INFO was appended */
- PTS_SIMPLE_EVID_FINAL_FLAG_TPM_QUOTE_INFO2_CAP_VER = 3,
+ PTS_SIMPLE_EVID_FINAL_FLAG_TPM_QUOTE_INFO2_CAP_VER = 3,
/** Optional Evidence Signature included */
- PTS_SIMPLE_EVID_FINAL_FLAG_EVID = 4,
+ PTS_SIMPLE_EVID_FINAL_FLAG_EVID = 4,
};
/**
*
* @return Set of flags
*/
- pts_attr_simple_evid_final_flag_t (*get_flags)(tcg_pts_attr_simple_evid_final_t *this);
+ pts_simple_evid_final_flag_t (*get_flags)(tcg_pts_attr_simple_evid_final_t *this);
/**
* Set flags for PTS Simple Evidence Final
* @param flags Set of flags
*/
void (*set_flags)(tcg_pts_attr_simple_evid_final_t *this,
- pts_attr_simple_evid_final_flag_t flags);
+ pts_simple_evid_final_flag_t flags);
/**
* Get Optional Composite Hash Algorithm
*
* @return Composite Hash Algorithm
*/
- pts_attr_meas_algorithms_t (*get_comp_hash_algorithm)(tcg_pts_attr_simple_evid_final_t *this);
+ pts_meas_algorithms_t (*get_comp_hash_algorithm)(tcg_pts_attr_simple_evid_final_t *this);
/**
* Set Optional Composite Hash Algorithm
* @param hash_algorithm Composite Hash Algorithm
*/
void (*set_comp_hash_algorithm)(tcg_pts_attr_simple_evid_final_t *this,
- pts_attr_meas_algorithms_t hash_algorithm);
+ pts_meas_algorithms_t hash_algorithm);
/**
* Get Optional TPM PCR Composite Length
* @param tpm_quote_sign Optional TPM Quote Signature
* @param evid_sign Optional Evidence Signature
*/
-pa_tnc_attr_t* tcg_pts_attr_simple_evid_final_create(pts_attr_simple_evid_final_flag_t flags,
- pts_attr_meas_algorithms_t comp_hash_algorithm,
+pa_tnc_attr_t* tcg_pts_attr_simple_evid_final_create(pts_simple_evid_final_flag_t flags,
+ pts_meas_algorithms_t comp_hash_algorithm,
chunk_t pcr_comp,
chunk_t tpm_quote_sign,
chunk_t evid_sign);
typedef struct private_tcg_pts_attr_tpm_version_info_t private_tcg_pts_attr_tpm_version_info_t;
/**
- * TPM Version Information (see section 3.11 of PTS Protocol: Binding to TNC IF-M Specification)
+ * TPM Version Information
+ * see section 3.11 of PTS Protocol: Binding to TNC IF-M Specification
*
* 1 2 3
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1