shortened some type names and enforced encoding rules
This commit is contained in:
@@ -51,10 +51,11 @@ static imc_agent_t *imc_attestation;
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
|
* 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
|
* List of files and directories to measure
|
||||||
@@ -254,14 +255,14 @@ static TNC_Result send_message(TNC_ConnectionID connection_id)
|
|||||||
{
|
{
|
||||||
case IMC_ATTESTATION_STATE_REQ_PROTO_CAP:
|
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;
|
flags = PTS_PROTO_CAPS_T | PTS_PROTO_CAPS_VER;
|
||||||
attr = tcg_pts_attr_proto_caps_create(flags);
|
attr = tcg_pts_attr_proto_caps_create(flags);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IMC_ATTESTATION_STATE_REQ_MEAS_ALGO:
|
case IMC_ATTESTATION_STATE_REQ_MEAS_ALGO:
|
||||||
{
|
{
|
||||||
pts_attr_meas_algorithms_t algorithm;
|
pts_meas_algorithms_t algorithm;
|
||||||
algorithm = PTS_MEAS_ALGO_SHA1;
|
algorithm = PTS_MEAS_ALGO_SHA1;
|
||||||
/* Save the selected algorithm for further attributes creation */
|
/* Save the selected algorithm for further attributes creation */
|
||||||
selected_algorithm = algorithm;
|
selected_algorithm = algorithm;
|
||||||
|
|||||||
@@ -204,7 +204,7 @@ static TNC_Result send_message(TNC_ConnectionID connection_id)
|
|||||||
case IMV_ATTESTATION_STATE_INIT:
|
case IMV_ATTESTATION_STATE_INIT:
|
||||||
{
|
{
|
||||||
/* Send Request Protocol Capabilities attribute */
|
/* 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;
|
flags = PTS_PROTO_CAPS_T | PTS_PROTO_CAPS_VER | PTS_PROTO_CAPS_CURRENT;
|
||||||
attr = tcg_pts_attr_req_proto_caps_create(flags);
|
attr = tcg_pts_attr_req_proto_caps_create(flags);
|
||||||
break;
|
break;
|
||||||
@@ -212,7 +212,7 @@ static TNC_Result send_message(TNC_ConnectionID connection_id)
|
|||||||
case IMV_ATTESTATION_STATE_PROTO_CAP:
|
case IMV_ATTESTATION_STATE_PROTO_CAP:
|
||||||
{
|
{
|
||||||
/* Send Measurement Algorithms attribute */
|
/* 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;
|
algorithms = PTS_MEAS_ALGO_SHA1 | PTS_MEAS_ALGO_SHA256 | PTS_MEAS_ALGO_SHA384;
|
||||||
attr = tcg_pts_attr_meas_algo_create(algorithms);
|
attr = tcg_pts_attr_meas_algo_create(algorithms);
|
||||||
break;
|
break;
|
||||||
@@ -241,7 +241,8 @@ static TNC_Result send_message(TNC_ConnectionID connection_id)
|
|||||||
|
|
||||||
msg = pa_tnc_msg_create();
|
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);
|
enumerator = enumerator_create_single(file_list, NULL);
|
||||||
while (enumerator->enumerate(enumerator, &entry))
|
while (enumerator->enumerate(enumerator, &entry))
|
||||||
|
|||||||
@@ -36,7 +36,8 @@ struct file_meas_entry_t {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
|
* 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
|
* 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
|
||||||
|
|||||||
@@ -23,7 +23,8 @@
|
|||||||
typedef struct private_tcg_pts_attr_gen_attest_evid_t private_tcg_pts_attr_gen_attest_evid_t;
|
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
|
* 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
|
* 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
|
||||||
@@ -35,7 +36,7 @@ typedef struct private_tcg_pts_attr_gen_attest_evid_t private_tcg_pts_attr_gen_a
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#define PTS_GEN_ATTEST_EVID_SIZE 4
|
#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.
|
* Private data of an tcg_pts_attr_gen_attest_evid_t object.
|
||||||
|
|||||||
@@ -23,7 +23,8 @@
|
|||||||
typedef struct private_tcg_pts_attr_get_aik_t private_tcg_pts_attr_get_aik_t;
|
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
|
* 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
|
* 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
|
||||||
|
|||||||
@@ -23,7 +23,8 @@
|
|||||||
typedef struct private_tcg_pts_attr_get_tpm_version_info_t private_tcg_pts_attr_get_tpm_version_info_t;
|
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
|
* 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
|
* 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
|
||||||
@@ -35,7 +36,7 @@ typedef struct private_tcg_pts_attr_get_tpm_version_info_t private_tcg_pts_attr_
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#define PTS_GET_TPM_VER_INFO_SIZE 4
|
#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.
|
* Private data of an tcg_pts_attr_get_tpm_version_info_t object.
|
||||||
|
|||||||
@@ -23,7 +23,8 @@
|
|||||||
typedef struct private_tcg_pts_attr_meas_algo_t private_tcg_pts_attr_meas_algo_t;
|
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
|
* 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
|
* 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
|
||||||
@@ -35,7 +36,8 @@ typedef struct private_tcg_pts_attr_meas_algo_t private_tcg_pts_attr_meas_algo_t
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
|
* 1
|
||||||
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
|
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
|
||||||
@@ -82,7 +84,7 @@ struct private_tcg_pts_attr_meas_algo_t {
|
|||||||
/**
|
/**
|
||||||
* Set of algorithms
|
* Set of algorithms
|
||||||
*/
|
*/
|
||||||
pts_attr_meas_algorithms_t algorithms;
|
pts_meas_algorithms_t algorithms;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -126,9 +128,18 @@ METHOD(pa_tnc_attr_t, build, void,
|
|||||||
writer->write_uint16 (writer, PTS_MEAS_ALGO_RESERVED);
|
writer->write_uint16 (writer, PTS_MEAS_ALGO_RESERVED);
|
||||||
|
|
||||||
/* Determine the hash algorithms to set*/
|
/* Determine the hash algorithms to set*/
|
||||||
if(this->algorithms & PTS_MEAS_ALGO_SHA384) algorithms += 8192;
|
if (this->algorithms & PTS_MEAS_ALGO_SHA384)
|
||||||
if(this->algorithms & PTS_MEAS_ALGO_SHA256) algorithms += 16384;
|
{
|
||||||
if(this->algorithms & PTS_MEAS_ALGO_SHA1) algorithms += 32768;
|
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);
|
writer->write_uint16(writer, algorithms);
|
||||||
|
|
||||||
this->value = chunk_clone(writer->get_buf(writer));
|
this->value = chunk_clone(writer->get_buf(writer));
|
||||||
@@ -152,9 +163,18 @@ METHOD(pa_tnc_attr_t, process, status_t,
|
|||||||
reader->read_uint16 (reader, &reserved);
|
reader->read_uint16 (reader, &reserved);
|
||||||
reader->read_uint16(reader, &algorithms);
|
reader->read_uint16(reader, &algorithms);
|
||||||
|
|
||||||
if((algorithms >> 13) & 1) this->algorithms |= PTS_MEAS_ALGO_SHA384;
|
if ((algorithms >> 13) & 1)
|
||||||
if((algorithms >> 14) & 1) this->algorithms |= PTS_MEAS_ALGO_SHA256;
|
{
|
||||||
if((algorithms >> 15) & 1) this->algorithms |= PTS_MEAS_ALGO_SHA1;
|
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);
|
reader->destroy(reader);
|
||||||
|
|
||||||
@@ -168,7 +188,7 @@ METHOD(pa_tnc_attr_t, destroy, void,
|
|||||||
free(this);
|
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)
|
private_tcg_pts_attr_meas_algo_t *this)
|
||||||
{
|
{
|
||||||
return this->algorithms;
|
return this->algorithms;
|
||||||
@@ -176,7 +196,7 @@ METHOD(tcg_pts_attr_meas_algo_t, get_algorithms, pts_attr_meas_algorithms_t,
|
|||||||
|
|
||||||
METHOD(tcg_pts_attr_meas_algo_t, set_algorithms, void,
|
METHOD(tcg_pts_attr_meas_algo_t, set_algorithms, void,
|
||||||
private_tcg_pts_attr_meas_algo_t *this,
|
private_tcg_pts_attr_meas_algo_t *this,
|
||||||
pts_attr_meas_algorithms_t algorithms)
|
pts_meas_algorithms_t algorithms)
|
||||||
{
|
{
|
||||||
this->algorithms = algorithms;
|
this->algorithms = algorithms;
|
||||||
}
|
}
|
||||||
@@ -184,7 +204,7 @@ METHOD(tcg_pts_attr_meas_algo_t, set_algorithms, void,
|
|||||||
/**
|
/**
|
||||||
* Described in header.
|
* 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;
|
private_tcg_pts_attr_meas_algo_t *this;
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
#define TCG_PTS_ATTR_MEAS_ALGO_H_
|
#define TCG_PTS_ATTR_MEAS_ALGO_H_
|
||||||
|
|
||||||
typedef struct tcg_pts_attr_meas_algo_t tcg_pts_attr_meas_algo_t;
|
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 "tcg_attr.h"
|
||||||
#include "pa_tnc/pa_tnc_attr.h"
|
#include "pa_tnc/pa_tnc_attr.h"
|
||||||
@@ -30,7 +30,7 @@ typedef enum pts_attr_meas_algorithms_t pts_attr_meas_algorithms_t;
|
|||||||
/**
|
/**
|
||||||
* PTS Measurement Algorithms
|
* PTS Measurement Algorithms
|
||||||
*/
|
*/
|
||||||
enum pts_attr_meas_algorithms_t {
|
enum pts_meas_algorithms_t {
|
||||||
/** SHA-384 */
|
/** SHA-384 */
|
||||||
PTS_MEAS_ALGO_SHA1 = (1<<0),
|
PTS_MEAS_ALGO_SHA1 = (1<<0),
|
||||||
/** SHA-256 */
|
/** SHA-256 */
|
||||||
@@ -55,7 +55,7 @@ struct tcg_pts_attr_meas_algo_t {
|
|||||||
*
|
*
|
||||||
* @return set of algorithms
|
* @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
|
* Set PTS Measurement Algorithm Set
|
||||||
@@ -63,7 +63,7 @@ struct tcg_pts_attr_meas_algo_t {
|
|||||||
* @param flags set of algorithms
|
* @param flags set of algorithms
|
||||||
*/
|
*/
|
||||||
void (*set_algorithms)(tcg_pts_attr_meas_algo_t *this,
|
void (*set_algorithms)(tcg_pts_attr_meas_algo_t *this,
|
||||||
pts_attr_meas_algorithms_t algorithms);
|
pts_meas_algorithms_t algorithms);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -72,7 +72,7 @@ struct tcg_pts_attr_meas_algo_t {
|
|||||||
*
|
*
|
||||||
* @param algorithms set of 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
|
* Creates an tcg_pts_attr_meas_algo_t object from received data
|
||||||
|
|||||||
@@ -23,7 +23,8 @@
|
|||||||
typedef struct private_tcg_pts_attr_meas_algo_selection_t private_tcg_pts_attr_meas_algo_selection_t;
|
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
|
* 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
|
* 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
|
||||||
@@ -82,7 +83,7 @@ struct private_tcg_pts_attr_meas_algo_selection_t {
|
|||||||
/**
|
/**
|
||||||
* A Selected Measurement Algorithm
|
* A Selected Measurement Algorithm
|
||||||
*/
|
*/
|
||||||
pts_attr_meas_algorithms_t algorithm;
|
pts_meas_algorithms_t algorithm;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -126,9 +127,18 @@ METHOD(pa_tnc_attr_t, build, void,
|
|||||||
writer->write_uint16 (writer, PTS_MEAS_ALGO_SEL_RESERVED);
|
writer->write_uint16 (writer, PTS_MEAS_ALGO_SEL_RESERVED);
|
||||||
|
|
||||||
/* Determine the hash algorithm to set*/
|
/* Determine the hash algorithm to set*/
|
||||||
if(this->algorithm & PTS_MEAS_ALGO_SHA384) algorithm = 8192;
|
if (this->algorithm & PTS_MEAS_ALGO_SHA384)
|
||||||
else if(this->algorithm & PTS_MEAS_ALGO_SHA256) algorithm = 16384;
|
{
|
||||||
else if(this->algorithm & PTS_MEAS_ALGO_SHA1) algorithm = 32768;
|
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);
|
writer->write_uint16(writer, algorithm);
|
||||||
|
|
||||||
this->value = chunk_clone(writer->get_buf(writer));
|
this->value = chunk_clone(writer->get_buf(writer));
|
||||||
@@ -152,9 +162,18 @@ METHOD(pa_tnc_attr_t, process, status_t,
|
|||||||
reader->read_uint16 (reader, &reserved);
|
reader->read_uint16 (reader, &reserved);
|
||||||
reader->read_uint16(reader, &algorithm);
|
reader->read_uint16(reader, &algorithm);
|
||||||
|
|
||||||
if((algorithm >> 13) & 1) this->algorithm = PTS_MEAS_ALGO_SHA384;
|
if ((algorithm >> 13) & 1)
|
||||||
else if((algorithm >> 14) & 1) this->algorithm = PTS_MEAS_ALGO_SHA256;
|
{
|
||||||
else if((algorithm >> 15) & 1) this->algorithm = PTS_MEAS_ALGO_SHA1;
|
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);
|
reader->destroy(reader);
|
||||||
|
|
||||||
@@ -168,7 +187,7 @@ METHOD(pa_tnc_attr_t, destroy, void,
|
|||||||
free(this);
|
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)
|
private_tcg_pts_attr_meas_algo_selection_t *this)
|
||||||
{
|
{
|
||||||
return this->algorithm;
|
return this->algorithm;
|
||||||
@@ -176,7 +195,7 @@ METHOD(tcg_pts_attr_meas_algo_selection_t, get_algorithm, pts_attr_meas_algorith
|
|||||||
|
|
||||||
METHOD(tcg_pts_attr_meas_algo_selection_t, set_algorithm, void,
|
METHOD(tcg_pts_attr_meas_algo_selection_t, set_algorithm, void,
|
||||||
private_tcg_pts_attr_meas_algo_selection_t *this,
|
private_tcg_pts_attr_meas_algo_selection_t *this,
|
||||||
pts_attr_meas_algorithms_t algorithm)
|
pts_meas_algorithms_t algorithm)
|
||||||
{
|
{
|
||||||
this->algorithm = algorithm;
|
this->algorithm = algorithm;
|
||||||
}
|
}
|
||||||
@@ -184,7 +203,7 @@ METHOD(tcg_pts_attr_meas_algo_selection_t, set_algorithm, void,
|
|||||||
/**
|
/**
|
||||||
* Described in header.
|
* 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;
|
private_tcg_pts_attr_meas_algo_selection_t *this;
|
||||||
|
|
||||||
|
|||||||
@@ -22,22 +22,10 @@
|
|||||||
#define TCG_PTS_ATTR_MEAS_ALGO_SELECTION_H_
|
#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 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 "tcg_attr.h"
|
||||||
#include "pa_tnc/pa_tnc_attr.h"
|
#include "pa_tnc/pa_tnc_attr.h"
|
||||||
|
#include "tcg_pts_attr_meas_algo.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),
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class implementing the TCG Measurement Algorithm Selection Attribute
|
* Class implementing the TCG Measurement Algorithm Selection Attribute
|
||||||
@@ -53,9 +41,9 @@ struct tcg_pts_attr_meas_algo_selection_t {
|
|||||||
/**
|
/**
|
||||||
* Get a selected PTS Measurement Algorithm
|
* 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
|
* Set PTS Measurement Algorithm
|
||||||
@@ -63,7 +51,7 @@ struct tcg_pts_attr_meas_algo_selection_t {
|
|||||||
* @param flags A Selected Measurement Algorithm
|
* @param flags A Selected Measurement Algorithm
|
||||||
*/
|
*/
|
||||||
void (*set_algorithm)(tcg_pts_attr_meas_algo_selection_t *this,
|
void (*set_algorithm)(tcg_pts_attr_meas_algo_selection_t *this,
|
||||||
pts_attr_meas_algorithms_t algorithm);
|
pts_meas_algorithms_t algorithm);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -72,7 +60,7 @@ struct tcg_pts_attr_meas_algo_selection_t {
|
|||||||
*
|
*
|
||||||
* @param algorithm A Selected Measurement 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
|
* Creates an tcg_pts_attr_meas_algo_selection_t object from received data
|
||||||
|
|||||||
@@ -23,7 +23,8 @@
|
|||||||
typedef struct private_tcg_pts_attr_proto_caps_t private_tcg_pts_attr_proto_caps_t;
|
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
|
* 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
|
* 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
|
||||||
@@ -70,7 +71,7 @@ struct private_tcg_pts_attr_proto_caps_t {
|
|||||||
/**
|
/**
|
||||||
* Set of flags
|
* Set of flags
|
||||||
*/
|
*/
|
||||||
pts_attr_proto_caps_flag_t flags;
|
pts_proto_caps_flag_t flags;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -114,11 +115,26 @@ METHOD(pa_tnc_attr_t, build, void,
|
|||||||
writer->write_uint24 (writer, PTS_PROTO_CAPS_RESERVED);
|
writer->write_uint24 (writer, PTS_PROTO_CAPS_RESERVED);
|
||||||
|
|
||||||
/* Determine the flags to set*/
|
/* Determine the flags to set*/
|
||||||
if(this->flags & PTS_PROTO_CAPS_XML) flags += 1;
|
if (this->flags & PTS_PROTO_CAPS_XML)
|
||||||
if(this->flags & PTS_PROTO_CAPS_T) flags += 2;
|
{
|
||||||
if(this->flags & PTS_PROTO_CAPS_DH) flags += 4;
|
flags += 1;
|
||||||
if(this->flags & PTS_PROTO_CAPS_VER) flags += 8;
|
}
|
||||||
if(this->flags & PTS_PROTO_CAPS_CURRENT) flags += 16;
|
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);
|
writer->write_uint8(writer, flags);
|
||||||
|
|
||||||
this->value = chunk_clone(writer->get_buf(writer));
|
this->value = chunk_clone(writer->get_buf(writer));
|
||||||
@@ -142,12 +158,27 @@ METHOD(pa_tnc_attr_t, process, status_t,
|
|||||||
reader->read_uint24 (reader, &reserved);
|
reader->read_uint24 (reader, &reserved);
|
||||||
reader->read_uint8(reader, &flags);
|
reader->read_uint8(reader, &flags);
|
||||||
|
|
||||||
if((flags >> 0) & 1) this->flags |= PTS_PROTO_CAPS_XML;
|
if ((flags >> 0) & 1)
|
||||||
if((flags >> 1) & 1) this->flags |= PTS_PROTO_CAPS_T;
|
{
|
||||||
if((flags >> 2) & 1) this->flags |= PTS_PROTO_CAPS_DH;
|
this->flags |= PTS_PROTO_CAPS_XML;
|
||||||
if((flags >> 3) & 1) this->flags |= PTS_PROTO_CAPS_VER;
|
}
|
||||||
if((flags >> 4) & 1) this->flags |= PTS_PROTO_CAPS_CURRENT;
|
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);
|
reader->destroy(reader);
|
||||||
|
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
@@ -160,7 +191,7 @@ METHOD(pa_tnc_attr_t, destroy, void,
|
|||||||
free(this);
|
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)
|
private_tcg_pts_attr_proto_caps_t *this)
|
||||||
{
|
{
|
||||||
return this->flags;
|
return this->flags;
|
||||||
@@ -168,7 +199,7 @@ METHOD(tcg_pts_attr_proto_caps_t, get_flags, pts_attr_proto_caps_flag_t,
|
|||||||
|
|
||||||
METHOD(tcg_pts_attr_proto_caps_t, set_flags, void,
|
METHOD(tcg_pts_attr_proto_caps_t, set_flags, void,
|
||||||
private_tcg_pts_attr_proto_caps_t *this,
|
private_tcg_pts_attr_proto_caps_t *this,
|
||||||
pts_attr_proto_caps_flag_t flags)
|
pts_proto_caps_flag_t flags)
|
||||||
{
|
{
|
||||||
this->flags = flags;
|
this->flags = flags;
|
||||||
}
|
}
|
||||||
@@ -176,7 +207,7 @@ METHOD(tcg_pts_attr_proto_caps_t, set_flags, void,
|
|||||||
/**
|
/**
|
||||||
* Described in header.
|
* 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;
|
private_tcg_pts_attr_proto_caps_t *this;
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
#define TCG_PTS_ATTR_PROTO_CAPS_H_
|
#define TCG_PTS_ATTR_PROTO_CAPS_H_
|
||||||
|
|
||||||
typedef struct tcg_pts_attr_proto_caps_t tcg_pts_attr_proto_caps_t;
|
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 "tcg_attr.h"
|
||||||
#include "pa_tnc/pa_tnc_attr.h"
|
#include "pa_tnc/pa_tnc_attr.h"
|
||||||
@@ -30,17 +30,17 @@ typedef enum pts_attr_proto_caps_flag_t pts_attr_proto_caps_flag_t;
|
|||||||
/**
|
/**
|
||||||
* PTS Protocol Capabilities Flags
|
* PTS Protocol Capabilities Flags
|
||||||
*/
|
*/
|
||||||
enum pts_attr_proto_caps_flag_t {
|
enum pts_proto_caps_flag_t {
|
||||||
/** XML based Evidence Support flag */
|
/** XML based Evidence Support flag */
|
||||||
PTS_PROTO_CAPS_XML = (1<<0),
|
PTS_PROTO_CAPS_XML = (1<<0),
|
||||||
/** Trusted Platform Evidence flag */
|
/** Trusted Platform Evidence flag */
|
||||||
PTS_PROTO_CAPS_T = (1<<1),
|
PTS_PROTO_CAPS_T = (1<<1),
|
||||||
/** DH Nonce Negotiation Support flag */
|
/** DH Nonce Negotiation Support flag */
|
||||||
PTS_PROTO_CAPS_DH = (1<<2),
|
PTS_PROTO_CAPS_DH = (1<<2),
|
||||||
/** Verification Support flag */
|
/** Verification Support flag */
|
||||||
PTS_PROTO_CAPS_VER = (1<<3),
|
PTS_PROTO_CAPS_VER = (1<<3),
|
||||||
/** Current (In-Memory) Evidence Support flag */
|
/** Current (In-Memory) Evidence Support flag */
|
||||||
PTS_PROTO_CAPS_CURRENT = (1<<4),
|
PTS_PROTO_CAPS_CURRENT = (1<<4),
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -59,15 +59,15 @@ struct tcg_pts_attr_proto_caps_t {
|
|||||||
*
|
*
|
||||||
* @return set of flags
|
* @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
|
* 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,
|
void (*set_flags)(tcg_pts_attr_proto_caps_t *this,
|
||||||
pts_attr_proto_caps_flag_t flags);
|
pts_proto_caps_flag_t flags);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -76,7 +76,7 @@ struct tcg_pts_attr_proto_caps_t {
|
|||||||
*
|
*
|
||||||
* @param flags set of 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
|
* Creates an tcg_pts_attr_proto_caps_t object from received data
|
||||||
|
|||||||
@@ -23,7 +23,8 @@
|
|||||||
typedef struct private_tcg_pts_attr_req_file_meas_t private_tcg_pts_attr_req_file_meas_t;
|
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
|
* 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
|
* 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
|
||||||
@@ -130,7 +131,10 @@ METHOD(pa_tnc_attr_t, build, void,
|
|||||||
|
|
||||||
writer = bio_writer_create(PTS_REQ_FILE_MEAS_SIZE);
|
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, flags);
|
||||||
writer->write_uint8(writer, PTS_REQ_FILE_MEAS_RESERVED);
|
writer->write_uint8(writer, PTS_REQ_FILE_MEAS_RESERVED);
|
||||||
writer->write_uint16(writer, this->request_id);
|
writer->write_uint16(writer, this->request_id);
|
||||||
|
|||||||
@@ -23,7 +23,8 @@
|
|||||||
typedef struct private_tcg_pts_attr_req_funct_comp_evid_t private_tcg_pts_attr_req_funct_comp_evid_t;
|
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
|
* 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
|
* 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
|
||||||
@@ -51,7 +52,8 @@ typedef struct private_tcg_pts_attr_req_funct_comp_evid_t private_tcg_pts_attr_r
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
|
* 0 1 2 3 4 5
|
||||||
@@ -164,11 +166,22 @@ METHOD(pa_tnc_attr_t, build, void,
|
|||||||
writer = bio_writer_create(PTS_REQ_FUNCT_COMP_EVID_SIZE);
|
writer = bio_writer_create(PTS_REQ_FUNCT_COMP_EVID_SIZE);
|
||||||
|
|
||||||
/* Determine the flags to set*/
|
/* Determine the flags to set*/
|
||||||
if(this->flags & PTS_REQ_FUNC_COMP_FLAG_PCR) flags += 128;
|
if (this->flags & PTS_REQ_FUNC_COMP_FLAG_PCR)
|
||||||
if(this->flags & PTS_REQ_FUNC_COMP_FLAG_CURR) flags += 64;
|
{
|
||||||
if(this->flags & PTS_REQ_FUNC_COMP_FLAG_VER) flags += 32;
|
flags += 128;
|
||||||
if(this->flags & PTS_REQ_FUNC_COMP_FLAG_TTC) flags += 16;
|
}
|
||||||
|
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_uint8(writer, flags);
|
||||||
|
|
||||||
writer->write_uint24 (writer, this->depth);
|
writer->write_uint24 (writer, this->depth);
|
||||||
@@ -180,9 +193,14 @@ METHOD(pa_tnc_attr_t, build, void,
|
|||||||
}
|
}
|
||||||
|
|
||||||
qualifier += this->qualifier.type;
|
qualifier += this->qualifier.type;
|
||||||
if(this->qualifier.kernel) qualifier += 16;
|
if (this->qualifier.kernel)
|
||||||
if(this->qualifier.sub_component) qualifier += 32;
|
{
|
||||||
|
qualifier += 16;
|
||||||
|
}
|
||||||
|
if (this->qualifier.sub_component)
|
||||||
|
{
|
||||||
|
qualifier += 32;
|
||||||
|
}
|
||||||
writer->write_uint8 (writer, qualifier);
|
writer->write_uint8 (writer, qualifier);
|
||||||
writer->write_uint32 (writer, this->name);
|
writer->write_uint32 (writer, this->name);
|
||||||
|
|
||||||
@@ -206,17 +224,35 @@ METHOD(pa_tnc_attr_t, process, status_t,
|
|||||||
reader = bio_reader_create(this->value);
|
reader = bio_reader_create(this->value);
|
||||||
|
|
||||||
reader->read_uint8(reader, &flags);
|
reader->read_uint8(reader, &flags);
|
||||||
if((flags >> 4) & 1) this->flags |= PTS_REQ_FUNC_COMP_FLAG_PCR;
|
if ((flags >> 4) & 1)
|
||||||
if((flags >> 5) & 1) this->flags |= PTS_REQ_FUNC_COMP_FLAG_CURR;
|
{
|
||||||
if((flags >> 6) & 1) this->flags |= PTS_REQ_FUNC_COMP_FLAG_VER;
|
this->flags |= PTS_REQ_FUNC_COMP_FLAG_PCR;
|
||||||
if((flags >> 7) & 1) this->flags |= PTS_REQ_FUNC_COMP_FLAG_TTC;
|
}
|
||||||
|
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->depth);
|
||||||
reader->read_uint24(reader, &this->comp_vendor_id);
|
reader->read_uint24(reader, &this->comp_vendor_id);
|
||||||
reader->read_uint8(reader, &fam_and_qualifier);
|
reader->read_uint8(reader, &fam_and_qualifier);
|
||||||
|
|
||||||
if(((fam_and_qualifier >> 6) & 1) ) this->family += 1;
|
if (((fam_and_qualifier >> 6) & 1) )
|
||||||
if(((fam_and_qualifier >> 7) & 1) ) this->family += 2;
|
{
|
||||||
|
this->family += 1;
|
||||||
|
}
|
||||||
|
if (((fam_and_qualifier >> 7) & 1) )
|
||||||
|
{
|
||||||
|
this->family += 2;
|
||||||
|
}
|
||||||
|
|
||||||
/* TODO: Generate an IF-M error attribute indicating */
|
/* TODO: Generate an IF-M error attribute indicating */
|
||||||
/* TCG_PTS_INVALID_NAME_FAM */
|
/* TCG_PTS_INVALID_NAME_FAM */
|
||||||
@@ -225,8 +261,14 @@ METHOD(pa_tnc_attr_t, process, status_t,
|
|||||||
// DBG1(DBG_TNC, "Functional Name Encoding Family is not set to 00");
|
// 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 >> 5) & 1) )
|
||||||
if(((fam_and_qualifier >> 4) & 1) ) this->qualifier.sub_component = true;
|
{
|
||||||
|
this->qualifier.kernel = true;
|
||||||
|
}
|
||||||
|
if (((fam_and_qualifier >> 4) & 1) )
|
||||||
|
{
|
||||||
|
this->qualifier.sub_component = true;
|
||||||
|
}
|
||||||
this->qualifier.type = ( fam_and_qualifier & 0xF );
|
this->qualifier.type = ( fam_and_qualifier & 0xF );
|
||||||
/* TODO: Check the type is defined in pts_attr_req_funct_comp_type_t */
|
/* TODO: Check the type is defined in pts_attr_req_funct_comp_type_t */
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,8 @@
|
|||||||
typedef struct private_tcg_pts_attr_req_proto_caps_t private_tcg_pts_attr_req_proto_caps_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
|
* 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
|
* 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
|
||||||
@@ -70,7 +71,7 @@ struct private_tcg_pts_attr_req_proto_caps_t {
|
|||||||
/**
|
/**
|
||||||
* Set of flags
|
* Set of flags
|
||||||
*/
|
*/
|
||||||
pts_attr_req_proto_caps_flag_t flags;
|
pts_proto_caps_flag_t flags;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -114,11 +115,26 @@ METHOD(pa_tnc_attr_t, build, void,
|
|||||||
writer->write_uint24 (writer, PTS_PROTO_CAPS_RESERVED);
|
writer->write_uint24 (writer, PTS_PROTO_CAPS_RESERVED);
|
||||||
|
|
||||||
/* Determine the flags to set*/
|
/* Determine the flags to set*/
|
||||||
if(this->flags & PTS_PROTO_CAPS_XML) flags += 1;
|
if (this->flags & PTS_PROTO_CAPS_XML)
|
||||||
if(this->flags & PTS_PROTO_CAPS_T) flags += 2;
|
{
|
||||||
if(this->flags & PTS_PROTO_CAPS_DH) flags += 4;
|
flags += 1;
|
||||||
if(this->flags & PTS_PROTO_CAPS_VER) flags += 8;
|
}
|
||||||
if(this->flags & PTS_PROTO_CAPS_CURRENT) flags += 16;
|
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);
|
writer->write_uint8(writer, flags);
|
||||||
|
|
||||||
this->value = chunk_clone(writer->get_buf(writer));
|
this->value = chunk_clone(writer->get_buf(writer));
|
||||||
@@ -142,11 +158,26 @@ METHOD(pa_tnc_attr_t, process, status_t,
|
|||||||
reader->read_uint24 (reader, &reserved);
|
reader->read_uint24 (reader, &reserved);
|
||||||
reader->read_uint8(reader, &flags);
|
reader->read_uint8(reader, &flags);
|
||||||
|
|
||||||
if((flags >> 0) & 1) this->flags |= PTS_PROTO_CAPS_XML;
|
if ((flags >> 0) & 1)
|
||||||
if((flags >> 1) & 1) this->flags |= PTS_PROTO_CAPS_T;
|
{
|
||||||
if((flags >> 2) & 1) this->flags |= PTS_PROTO_CAPS_DH;
|
this->flags |= PTS_PROTO_CAPS_XML;
|
||||||
if((flags >> 3) & 1) this->flags |= PTS_PROTO_CAPS_VER;
|
}
|
||||||
if((flags >> 4) & 1) this->flags |= PTS_PROTO_CAPS_CURRENT;
|
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);
|
reader->destroy(reader);
|
||||||
|
|
||||||
@@ -160,15 +191,14 @@ METHOD(pa_tnc_attr_t, destroy, void,
|
|||||||
free(this);
|
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)
|
private_tcg_pts_attr_req_proto_caps_t *this)
|
||||||
{
|
{
|
||||||
return this->flags;
|
return this->flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(tcg_pts_attr_req_proto_caps_t, set_flags, void,
|
METHOD(tcg_pts_attr_req_proto_caps_t, set_flags, void,
|
||||||
private_tcg_pts_attr_req_proto_caps_t *this,
|
private_tcg_pts_attr_req_proto_caps_t *this, pts_proto_caps_flag_t flags)
|
||||||
pts_attr_req_proto_caps_flag_t flags)
|
|
||||||
{
|
{
|
||||||
this->flags = flags;
|
this->flags = flags;
|
||||||
}
|
}
|
||||||
@@ -176,7 +206,7 @@ METHOD(tcg_pts_attr_req_proto_caps_t, set_flags, void,
|
|||||||
/**
|
/**
|
||||||
* Described in header.
|
* 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;
|
private_tcg_pts_attr_req_proto_caps_t *this;
|
||||||
|
|
||||||
|
|||||||
@@ -22,26 +22,10 @@
|
|||||||
#define TCG_PTS_ATTR_REQ_PROTO_CAPS_H_
|
#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 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 "tcg_attr.h"
|
||||||
#include "pa_tnc/pa_tnc_attr.h"
|
#include "pa_tnc/pa_tnc_attr.h"
|
||||||
|
#include "tcg_pts_attr_proto_caps.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),
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class implementing the TCG Request PTS Protocol Capabilities Attribute
|
* Class implementing the TCG Request PTS Protocol Capabilities Attribute
|
||||||
@@ -59,7 +43,7 @@ struct tcg_pts_attr_req_proto_caps_t {
|
|||||||
*
|
*
|
||||||
* @return set of flags
|
* @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
|
* Set PTS procol capabilities flags
|
||||||
@@ -67,7 +51,7 @@ struct tcg_pts_attr_req_proto_caps_t {
|
|||||||
* @param flags set of flags
|
* @param flags set of flags
|
||||||
*/
|
*/
|
||||||
void (*set_flags)(tcg_pts_attr_req_proto_caps_t *this,
|
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);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -76,7 +60,7 @@ struct tcg_pts_attr_req_proto_caps_t {
|
|||||||
*
|
*
|
||||||
* @param flags set of 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
|
* Creates an tcg_pts_attr_req_proto_caps_t object from received data
|
||||||
|
|||||||
@@ -23,7 +23,8 @@
|
|||||||
typedef struct private_tcg_pts_attr_simple_comp_evid_t private_tcg_pts_attr_simple_comp_evid_t;
|
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
|
* 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
|
* 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
|
||||||
@@ -65,7 +66,7 @@ typedef struct private_tcg_pts_attr_simple_comp_evid_t private_tcg_pts_attr_simp
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Specific Functional Component -> Component Functional Name Structure
|
* 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
|
* 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
|
* 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
|
||||||
@@ -79,7 +80,8 @@ typedef struct private_tcg_pts_attr_simple_comp_evid_t private_tcg_pts_attr_simp
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
|
* 0 1 2 3 4 5
|
||||||
@@ -168,7 +170,7 @@ struct private_tcg_pts_attr_simple_comp_evid_t {
|
|||||||
/**
|
/**
|
||||||
* Hash Algorithm
|
* Hash Algorithm
|
||||||
*/
|
*/
|
||||||
pts_attr_meas_algorithms_t hash_algorithm;
|
pts_meas_algorithms_t hash_algorithm;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Transformation type for PCR
|
* Transformation type for PCR
|
||||||
@@ -243,27 +245,45 @@ METHOD(pa_tnc_attr_t, build, void,
|
|||||||
writer = bio_writer_create(PTS_SIMPLE_COMP_EVID_SIZE);
|
writer = bio_writer_create(PTS_SIMPLE_COMP_EVID_SIZE);
|
||||||
|
|
||||||
/* Determine the flags to set*/
|
/* Determine the flags to set*/
|
||||||
if(this->flags & PTS_SIMPLE_COMP_EVID_FLAG_PCR) flags += 128;
|
if (this->flags & PTS_SIMPLE_COMP_EVID_FLAG_PCR)
|
||||||
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;
|
flags += 128;
|
||||||
else if(this->flags & PTS_SIMPLE_COMP_EVID_FLAG_VER_PASS) flags += 96;
|
}
|
||||||
|
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_uint8(writer, flags);
|
||||||
|
|
||||||
writer->write_uint24 (writer, this->depth);
|
writer->write_uint24 (writer, this->depth);
|
||||||
writer->write_uint24 (writer, this->comp_vendor_id);
|
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");
|
DBG1(DBG_TNC, "Functional Name Encoding Family is not set to 00");
|
||||||
}
|
}
|
||||||
|
|
||||||
qualifier += this->qualifier.type;
|
qualifier += this->qualifier.type;
|
||||||
if(this->qualifier.kernel) qualifier += 16;
|
if (this->qualifier.kernel)
|
||||||
if(this->qualifier.sub_component) qualifier += 32;
|
{
|
||||||
|
qualifier += 16;
|
||||||
|
}
|
||||||
|
if (this->qualifier.sub_component)
|
||||||
|
{
|
||||||
|
qualifier += 32;
|
||||||
|
}
|
||||||
|
|
||||||
/* Unknown or Wildcard should not be used for Qualification*/
|
/* 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"
|
DBG1(DBG_TNC, "Unknown or Wildcard should not be used for"
|
||||||
" Functional Name Qualifier");
|
" Functional Name Qualifier");
|
||||||
@@ -276,21 +296,30 @@ METHOD(pa_tnc_attr_t, build, void,
|
|||||||
writer->write_uint24 (writer, this->extended_pcr);
|
writer->write_uint24 (writer, this->extended_pcr);
|
||||||
|
|
||||||
/* Determine the hash algorithm to set*/
|
/* Determine the hash algorithm to set*/
|
||||||
if(this->hash_algorithm & PTS_MEAS_ALGO_SHA384) algorithm = 8192;
|
if (this->hash_algorithm & PTS_MEAS_ALGO_SHA384)
|
||||||
else if(this->hash_algorithm & PTS_MEAS_ALGO_SHA256) algorithm = 16384;
|
{
|
||||||
else if(this->hash_algorithm & PTS_MEAS_ALGO_SHA1) algorithm = 32768;
|
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_uint16(writer, algorithm);
|
||||||
|
|
||||||
writer->write_uint8 (writer, this->transformation);
|
writer->write_uint8 (writer, this->transformation);
|
||||||
writer->write_data (writer, this->measurement_time);
|
writer->write_data (writer, this->measurement_time);
|
||||||
|
|
||||||
/* Optional fields */
|
/* 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_uint16 (writer, this->policy_uri.len);
|
||||||
writer->write_data (writer, this->policy_uri);
|
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 == this->pcr_after.len &&
|
||||||
this->pcr_before.len > 0 && this->pcr_after.len > 0)
|
this->pcr_before.len > 0 && this->pcr_after.len > 0)
|
||||||
{
|
{
|
||||||
@@ -327,23 +356,39 @@ METHOD(pa_tnc_attr_t, process, status_t,
|
|||||||
reader->read_uint8(reader, &flags);
|
reader->read_uint8(reader, &flags);
|
||||||
|
|
||||||
/* Determine the flags to set*/
|
/* Determine the flags to set*/
|
||||||
if((flags >> 7) & 1) this->flags |= PTS_SIMPLE_COMP_EVID_FLAG_PCR;
|
if ((flags >> 7) & 1)
|
||||||
|
{
|
||||||
if(!((flags >> 6) & 1) && !((flags >> 5) & 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;
|
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;
|
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;
|
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;
|
this->flags |= PTS_SIMPLE_COMP_EVID_FLAG_VER_PASS;
|
||||||
|
}
|
||||||
|
|
||||||
reader->read_uint24(reader, &this->depth);
|
reader->read_uint24(reader, &this->depth);
|
||||||
reader->read_uint24(reader, &this->comp_vendor_id);
|
reader->read_uint24(reader, &this->comp_vendor_id);
|
||||||
reader->read_uint8(reader, &fam_and_qualifier);
|
reader->read_uint8(reader, &fam_and_qualifier);
|
||||||
|
|
||||||
if(((fam_and_qualifier >> 6) & 1) ) this->family += 1;
|
if (((fam_and_qualifier >> 6) & 1) )
|
||||||
if(((fam_and_qualifier >> 7) & 1) ) this->family += 2;
|
{
|
||||||
|
this->family += 1;
|
||||||
|
}
|
||||||
|
if (((fam_and_qualifier >> 7) & 1) )
|
||||||
|
{
|
||||||
|
this->family += 2;
|
||||||
|
}
|
||||||
|
|
||||||
/* TODO: Generate an IF-M error attribute indicating */
|
/* TODO: Generate an IF-M error attribute indicating */
|
||||||
/* TCG_PTS_INVALID_NAME_FAM */
|
/* TCG_PTS_INVALID_NAME_FAM */
|
||||||
@@ -352,13 +397,19 @@ METHOD(pa_tnc_attr_t, process, status_t,
|
|||||||
// DBG1(DBG_TNC, "Functional Name Encoding Family is not set to 00");
|
// 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 >> 5) & 1) )
|
||||||
if(((fam_and_qualifier >> 4) & 1) ) this->qualifier.sub_component = true;
|
{
|
||||||
|
this->qualifier.kernel = true;
|
||||||
|
}
|
||||||
|
if (((fam_and_qualifier >> 4) & 1) )
|
||||||
|
{
|
||||||
|
this->qualifier.sub_component = true;
|
||||||
|
}
|
||||||
this->qualifier.type = ( fam_and_qualifier & 0xF );
|
this->qualifier.type = ( fam_and_qualifier & 0xF );
|
||||||
/* TODO: Check the type is defined in pts_attr_req_funct_comp_type_t */
|
/* TODO: Check the type is defined in pts_attr_req_funct_comp_type_t */
|
||||||
|
|
||||||
/* Unknown or Wildcard should not be used for Qualification*/
|
/* 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"
|
DBG1(DBG_TNC, "Unknown or Wildcard should not be used for"
|
||||||
" Functional Name Qualifier");
|
" Functional Name Qualifier");
|
||||||
@@ -373,9 +424,18 @@ METHOD(pa_tnc_attr_t, process, status_t,
|
|||||||
reader->read_uint24(reader, &this->extended_pcr);
|
reader->read_uint24(reader, &this->extended_pcr);
|
||||||
reader->read_uint16(reader, &algorithm);
|
reader->read_uint16(reader, &algorithm);
|
||||||
|
|
||||||
if((algorithm >> 13) & 1) this->hash_algorithm = PTS_MEAS_ALGO_SHA384;
|
if ((algorithm >> 13) & 1)
|
||||||
else if((algorithm >> 14) & 1) this->hash_algorithm = PTS_MEAS_ALGO_SHA256;
|
{
|
||||||
else if((algorithm >> 15) & 1) this->hash_algorithm = PTS_MEAS_ALGO_SHA1;
|
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);
|
reader->read_uint8(reader, &transformation);
|
||||||
this->transformation = transformation;
|
this->transformation = transformation;
|
||||||
@@ -385,7 +445,7 @@ METHOD(pa_tnc_attr_t, process, status_t,
|
|||||||
&this->measurement_time);
|
&this->measurement_time);
|
||||||
|
|
||||||
/* Optional Policy URI field is included */
|
/* 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)
|
this->flags & PTS_SIMPLE_COMP_EVID_FLAG_VER_PASS)
|
||||||
{
|
{
|
||||||
u_int16_t policy_uri_len;
|
u_int16_t policy_uri_len;
|
||||||
@@ -394,7 +454,7 @@ METHOD(pa_tnc_attr_t, process, status_t,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Optional PCR value fields are included */
|
/* 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;
|
u_int16_t pcr_value_len;
|
||||||
reader->read_uint16(reader, &pcr_value_len);
|
reader->read_uint16(reader, &pcr_value_len);
|
||||||
@@ -494,14 +554,14 @@ METHOD(tcg_pts_attr_simple_comp_evid_t, set_extended_pcr, void,
|
|||||||
this->extended_pcr = extended_pcr;
|
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)
|
private_tcg_pts_attr_simple_comp_evid_t *this)
|
||||||
{
|
{
|
||||||
return this->hash_algorithm;
|
return this->hash_algorithm;
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(tcg_pts_attr_simple_comp_evid_t, set_hash_algorithm, void,
|
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;
|
this->hash_algorithm = hash_algorithm;
|
||||||
}
|
}
|
||||||
@@ -598,7 +658,7 @@ pa_tnc_attr_t *tcg_pts_attr_simple_comp_evid_create(
|
|||||||
tcg_pts_qualifier_t qualifier,
|
tcg_pts_qualifier_t qualifier,
|
||||||
pts_attr_req_funct_comp_name_bin_enum_t name,
|
pts_attr_req_funct_comp_name_bin_enum_t name,
|
||||||
u_int32_t extended_pcr,
|
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,
|
pts_attr_simple_comp_evid_pcr_transform_t transformation,
|
||||||
chunk_t measurement_time,
|
chunk_t measurement_time,
|
||||||
chunk_t policy_uri,
|
chunk_t policy_uri,
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ struct tcg_pts_attr_simple_comp_evid_t {
|
|||||||
*
|
*
|
||||||
* @return Hash Algorithm
|
* @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
|
* Set Hash Algorithm
|
||||||
@@ -176,7 +176,7 @@ struct tcg_pts_attr_simple_comp_evid_t {
|
|||||||
* @param hash_algorithm Hash Algorithm
|
* @param hash_algorithm Hash Algorithm
|
||||||
*/
|
*/
|
||||||
void (*set_hash_algorithm)(tcg_pts_attr_simple_comp_evid_t *this,
|
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
|
* Get PCR Transformation
|
||||||
@@ -300,7 +300,7 @@ pa_tnc_attr_t* tcg_pts_attr_simple_comp_evid_create(pts_attr_simple_comp_evid_fl
|
|||||||
tcg_pts_qualifier_t qualifier,
|
tcg_pts_qualifier_t qualifier,
|
||||||
pts_attr_req_funct_comp_name_bin_enum_t name,
|
pts_attr_req_funct_comp_name_bin_enum_t name,
|
||||||
u_int32_t extended_pcr,
|
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,
|
pts_attr_simple_comp_evid_pcr_transform_t transformation,
|
||||||
chunk_t measurement_time,
|
chunk_t measurement_time,
|
||||||
chunk_t policy_uri,
|
chunk_t policy_uri,
|
||||||
|
|||||||
@@ -23,7 +23,8 @@
|
|||||||
typedef struct private_tcg_pts_attr_simple_evid_final_t private_tcg_pts_attr_simple_evid_final_t;
|
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
|
* 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
|
* 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
|
||||||
@@ -79,12 +80,12 @@ struct private_tcg_pts_attr_simple_evid_final_t {
|
|||||||
/**
|
/**
|
||||||
* Set of flags for Simple Evidence Final
|
* 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
|
* Optional Composite Hash Algorithm
|
||||||
*/
|
*/
|
||||||
pts_attr_meas_algorithms_t comp_hash_algorithm;
|
pts_meas_algorithms_t comp_hash_algorithm;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Optional TPM PCR Composite
|
* Optional TPM PCR Composite
|
||||||
@@ -143,33 +144,52 @@ METHOD(pa_tnc_attr_t, build, void,
|
|||||||
writer = bio_writer_create(PTS_SIMPLE_EVID_FINAL_SIZE);
|
writer = bio_writer_create(PTS_SIMPLE_EVID_FINAL_SIZE);
|
||||||
|
|
||||||
/* Determine the flags to set*/
|
/* Determine the flags to set*/
|
||||||
if(this->flags & PTS_SIMPLE_EVID_FINAL_FLAG_TPM_QUOTE_INFO) flags += 64;
|
if (this->flags & PTS_SIMPLE_EVID_FINAL_FLAG_TPM_QUOTE_INFO)
|
||||||
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;
|
flags += 64;
|
||||||
|
}
|
||||||
if(this->flags & PTS_SIMPLE_EVID_FINAL_FLAG_EVID) flags += 32;
|
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, flags);
|
||||||
writer->write_uint8(writer, PTS_SIMPLE_EVID_FINAL_RESERVED);
|
writer->write_uint8(writer, PTS_SIMPLE_EVID_FINAL_RESERVED);
|
||||||
|
|
||||||
/* Determine the hash algorithm to set*/
|
/* Determine the hash algorithm to set*/
|
||||||
if(this->comp_hash_algorithm & PTS_MEAS_ALGO_SHA384) algorithm = 8192;
|
if (this->comp_hash_algorithm & PTS_MEAS_ALGO_SHA384)
|
||||||
else if(this->comp_hash_algorithm & PTS_MEAS_ALGO_SHA256) algorithm = 16384;
|
{
|
||||||
else if(this->comp_hash_algorithm & PTS_MEAS_ALGO_SHA1) algorithm = 32768;
|
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);
|
writer->write_uint16(writer, algorithm);
|
||||||
|
|
||||||
/* Optional fields */
|
/* 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_uint32 (writer, this->pcr_comp.len);
|
||||||
writer->write_data (writer, this->pcr_comp);
|
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_uint32 (writer, this->tpm_quote_sign.len);
|
||||||
writer->write_data (writer, this->tpm_quote_sign);
|
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);
|
writer->write_data (writer, this->evid_sign);
|
||||||
}
|
}
|
||||||
@@ -197,26 +217,45 @@ METHOD(pa_tnc_attr_t, process, status_t,
|
|||||||
reader->read_uint8(reader, &flags);
|
reader->read_uint8(reader, &flags);
|
||||||
|
|
||||||
/* Determine the flags to set*/
|
/* 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;
|
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;
|
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;
|
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;
|
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_uint8(reader, &reserved);
|
||||||
reader->read_uint16(reader, &algorithm);
|
reader->read_uint16(reader, &algorithm);
|
||||||
|
|
||||||
if((algorithm >> 13) & 1) this->comp_hash_algorithm = PTS_MEAS_ALGO_SHA384;
|
if ((algorithm >> 13) & 1)
|
||||||
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;
|
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 */
|
/* 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 pcr_comp_len;
|
||||||
u_int32_t tpm_quote_sign_len;
|
u_int32_t tpm_quote_sign_len;
|
||||||
@@ -227,7 +266,7 @@ METHOD(pa_tnc_attr_t, process, status_t,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Optional Evidence Signature field is included */
|
/* 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);
|
u_int32_t evid_sign_len = reader->remaining(reader);
|
||||||
reader->read_data(reader, evid_sign_len, &this->evid_sign);
|
reader->read_data(reader, evid_sign_len, &this->evid_sign);
|
||||||
@@ -247,26 +286,26 @@ METHOD(pa_tnc_attr_t, destroy, void,
|
|||||||
free(this);
|
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)
|
private_tcg_pts_attr_simple_evid_final_t *this)
|
||||||
{
|
{
|
||||||
return this->flags;
|
return this->flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(tcg_pts_attr_simple_evid_final_t, set_flags, void,
|
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;
|
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)
|
private_tcg_pts_attr_simple_evid_final_t *this)
|
||||||
{
|
{
|
||||||
return this->comp_hash_algorithm;
|
return this->comp_hash_algorithm;
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(tcg_pts_attr_simple_evid_final_t, set_comp_hash_algorithm, void,
|
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;
|
this->comp_hash_algorithm = comp_hash_algorithm;
|
||||||
}
|
}
|
||||||
@@ -274,9 +313,11 @@ METHOD(tcg_pts_attr_simple_evid_final_t, set_comp_hash_algorithm, void,
|
|||||||
METHOD(tcg_pts_attr_simple_evid_final_t, get_comp_pcr_len, u_int32_t,
|
METHOD(tcg_pts_attr_simple_evid_final_t, get_comp_pcr_len, u_int32_t,
|
||||||
private_tcg_pts_attr_simple_evid_final_t *this)
|
private_tcg_pts_attr_simple_evid_final_t *this)
|
||||||
{
|
{
|
||||||
if(this->pcr_comp.ptr && this->pcr_comp.len > 0)
|
if (this->pcr_comp.ptr && this->pcr_comp.len > 0)
|
||||||
return this->pcr_comp.len;
|
{
|
||||||
else return 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_pcr_comp, chunk_t,
|
||||||
@@ -294,9 +335,11 @@ METHOD(tcg_pts_attr_simple_evid_final_t, set_pcr_comp, void,
|
|||||||
METHOD(tcg_pts_attr_simple_evid_final_t, get_tpm_quote_sign_len, u_int32_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)
|
private_tcg_pts_attr_simple_evid_final_t *this)
|
||||||
{
|
{
|
||||||
if(this->tpm_quote_sign.ptr && this->tpm_quote_sign.len > 0)
|
if (this->tpm_quote_sign.ptr && this->tpm_quote_sign.len > 0)
|
||||||
return this->tpm_quote_sign.len;
|
{
|
||||||
else return 0;
|
return this->tpm_quote_sign.len;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(tcg_pts_attr_simple_evid_final_t, get_tpm_quote_sign, chunk_t,
|
METHOD(tcg_pts_attr_simple_evid_final_t, get_tpm_quote_sign, chunk_t,
|
||||||
@@ -327,8 +370,8 @@ METHOD(tcg_pts_attr_simple_evid_final_t, set_evid_sign, void,
|
|||||||
* Described in header.
|
* Described in header.
|
||||||
*/
|
*/
|
||||||
pa_tnc_attr_t *tcg_pts_attr_simple_evid_final_create(
|
pa_tnc_attr_t *tcg_pts_attr_simple_evid_final_create(
|
||||||
pts_attr_simple_evid_final_flag_t flags,
|
pts_simple_evid_final_flag_t flags,
|
||||||
pts_attr_meas_algorithms_t comp_hash_algorithm,
|
pts_meas_algorithms_t comp_hash_algorithm,
|
||||||
chunk_t pcr_comp,
|
chunk_t pcr_comp,
|
||||||
chunk_t tpm_quote_sign,
|
chunk_t tpm_quote_sign,
|
||||||
chunk_t evid_sign)
|
chunk_t evid_sign)
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
#define TCG_PTS_ATTR_SIMPLE_EVID_FINAL_H_
|
#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 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 "tcg_attr.h"
|
||||||
#include "pa_tnc/pa_tnc_attr.h"
|
#include "pa_tnc/pa_tnc_attr.h"
|
||||||
@@ -32,20 +32,20 @@ typedef enum pts_attr_simple_evid_final_flag_t pts_attr_simple_evid_final_flag_t
|
|||||||
/**
|
/**
|
||||||
* PTS Simple Evidence Final Flags
|
* 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 */
|
/** 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 */
|
/** Optional TPM PCR Composite and Optional TPM Quote Signature fields included */
|
||||||
/** using TPM_QUOTE_INFO */
|
/** 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 */
|
/** Optional TPM PCR Composite and Optional TPM Quote Signature fields included */
|
||||||
/** using TPM_QUOTE_INFO2, TPM_CAP_VERSION_INFO was not appended */
|
/** 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 */
|
/** Optional TPM PCR Composite and Optional TPM Quote Signature fields included */
|
||||||
/** using TPM_QUOTE_INFO2, TPM_CAP_VERSION_INFO was appended */
|
/** 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 */
|
/** Optional Evidence Signature included */
|
||||||
PTS_SIMPLE_EVID_FINAL_FLAG_EVID = 4,
|
PTS_SIMPLE_EVID_FINAL_FLAG_EVID = 4,
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -64,7 +64,7 @@ struct tcg_pts_attr_simple_evid_final_t {
|
|||||||
*
|
*
|
||||||
* @return Set of flags
|
* @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
|
* Set flags for PTS Simple Evidence Final
|
||||||
@@ -72,14 +72,14 @@ struct tcg_pts_attr_simple_evid_final_t {
|
|||||||
* @param flags Set of flags
|
* @param flags Set of flags
|
||||||
*/
|
*/
|
||||||
void (*set_flags)(tcg_pts_attr_simple_evid_final_t *this,
|
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
|
* Get Optional Composite Hash Algorithm
|
||||||
*
|
*
|
||||||
* @return 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
|
* Set Optional Composite Hash Algorithm
|
||||||
@@ -87,7 +87,7 @@ struct tcg_pts_attr_simple_evid_final_t {
|
|||||||
* @param hash_algorithm Composite Hash Algorithm
|
* @param hash_algorithm Composite Hash Algorithm
|
||||||
*/
|
*/
|
||||||
void (*set_comp_hash_algorithm)(tcg_pts_attr_simple_evid_final_t *this,
|
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
|
* Get Optional TPM PCR Composite Length
|
||||||
@@ -159,8 +159,8 @@ struct tcg_pts_attr_simple_evid_final_t {
|
|||||||
* @param tpm_quote_sign Optional TPM Quote Signature
|
* @param tpm_quote_sign Optional TPM Quote Signature
|
||||||
* @param evid_sign Optional Evidence 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,
|
pa_tnc_attr_t* tcg_pts_attr_simple_evid_final_create(pts_simple_evid_final_flag_t flags,
|
||||||
pts_attr_meas_algorithms_t comp_hash_algorithm,
|
pts_meas_algorithms_t comp_hash_algorithm,
|
||||||
chunk_t pcr_comp,
|
chunk_t pcr_comp,
|
||||||
chunk_t tpm_quote_sign,
|
chunk_t tpm_quote_sign,
|
||||||
chunk_t evid_sign);
|
chunk_t evid_sign);
|
||||||
|
|||||||
@@ -23,7 +23,8 @@
|
|||||||
typedef struct private_tcg_pts_attr_tpm_version_info_t private_tcg_pts_attr_tpm_version_info_t;
|
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
|
* 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
|
* 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
|
||||||
|
|||||||
Reference in New Issue
Block a user