Use struct containing the parameters for Create function
Deleted unnecessary setter functions
This commit is contained in:
committed by
Andreas Steffen
parent
97ebeaa45c
commit
7c7034f64c
@@ -420,12 +420,6 @@ METHOD(tcg_pts_attr_simple_comp_evid_t, get_flags, pts_attr_simple_comp_evid_fla
|
||||
return this->flags;
|
||||
}
|
||||
|
||||
METHOD(tcg_pts_attr_simple_comp_evid_t, set_flags, void,
|
||||
private_tcg_pts_attr_simple_comp_evid_t *this, pts_attr_simple_comp_evid_flag_t flags)
|
||||
{
|
||||
this->flags = flags;
|
||||
}
|
||||
|
||||
METHOD(tcg_pts_attr_simple_comp_evid_t, get_sub_component_depth, u_int32_t,
|
||||
private_tcg_pts_attr_simple_comp_evid_t *this)
|
||||
{
|
||||
@@ -450,25 +444,12 @@ METHOD(tcg_pts_attr_simple_comp_evid_t, get_qualifier, pts_qualifier_t,
|
||||
return this->qualifier;
|
||||
}
|
||||
|
||||
METHOD(tcg_pts_attr_simple_comp_evid_t, set_qualifier, void,
|
||||
private_tcg_pts_attr_simple_comp_evid_t *this,
|
||||
pts_qualifier_t qualifier)
|
||||
{
|
||||
this->qualifier = qualifier;
|
||||
}
|
||||
|
||||
METHOD(tcg_pts_attr_simple_comp_evid_t, get_comp_funct_name, pts_funct_comp_name_t,
|
||||
private_tcg_pts_attr_simple_comp_evid_t *this)
|
||||
{
|
||||
return this->name;
|
||||
}
|
||||
|
||||
METHOD(tcg_pts_attr_simple_comp_evid_t, set_comp_funct_name, void,
|
||||
private_tcg_pts_attr_simple_comp_evid_t *this, pts_funct_comp_name_t name)
|
||||
{
|
||||
this->name = name;
|
||||
}
|
||||
|
||||
METHOD(tcg_pts_attr_simple_comp_evid_t, get_measurement_type, u_int8_t,
|
||||
private_tcg_pts_attr_simple_comp_evid_t *this)
|
||||
{
|
||||
@@ -481,85 +462,42 @@ METHOD(tcg_pts_attr_simple_comp_evid_t, get_extended_pcr, u_int32_t,
|
||||
return this->extended_pcr;
|
||||
}
|
||||
|
||||
METHOD(tcg_pts_attr_simple_comp_evid_t, set_extended_pcr, void,
|
||||
private_tcg_pts_attr_simple_comp_evid_t *this, u_int32_t extended_pcr)
|
||||
{
|
||||
this->extended_pcr = extended_pcr;
|
||||
}
|
||||
|
||||
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_meas_algorithms_t hash_algorithm)
|
||||
{
|
||||
this->hash_algorithm = hash_algorithm;
|
||||
}
|
||||
|
||||
METHOD(tcg_pts_attr_simple_comp_evid_t, get_pcr_trans, pts_pcr_transform_t,
|
||||
private_tcg_pts_attr_simple_comp_evid_t *this)
|
||||
{
|
||||
return this->transformation;
|
||||
}
|
||||
|
||||
METHOD(tcg_pts_attr_simple_comp_evid_t, set_pcr_trans, void,
|
||||
private_tcg_pts_attr_simple_comp_evid_t *this, pts_pcr_transform_t transformation)
|
||||
{
|
||||
this->transformation = transformation;
|
||||
}
|
||||
|
||||
METHOD(tcg_pts_attr_simple_comp_evid_t, get_measurement_time, chunk_t,
|
||||
private_tcg_pts_attr_simple_comp_evid_t *this)
|
||||
{
|
||||
return this->measurement_time;
|
||||
}
|
||||
|
||||
METHOD(tcg_pts_attr_simple_comp_evid_t, set_measurement_time, void,
|
||||
private_tcg_pts_attr_simple_comp_evid_t *this, chunk_t measurement_time)
|
||||
{
|
||||
this->measurement_time = measurement_time;
|
||||
}
|
||||
|
||||
METHOD(tcg_pts_attr_simple_comp_evid_t, get_policy_uri, chunk_t,
|
||||
private_tcg_pts_attr_simple_comp_evid_t *this)
|
||||
{
|
||||
return this->policy_uri;
|
||||
}
|
||||
|
||||
METHOD(tcg_pts_attr_simple_comp_evid_t, set_policy_uri, void,
|
||||
private_tcg_pts_attr_simple_comp_evid_t *this, chunk_t policy_uri)
|
||||
{
|
||||
this->policy_uri = policy_uri;
|
||||
}
|
||||
|
||||
METHOD(tcg_pts_attr_simple_comp_evid_t, get_pcr_before_value, chunk_t,
|
||||
private_tcg_pts_attr_simple_comp_evid_t *this)
|
||||
{
|
||||
return this->pcr_before;
|
||||
}
|
||||
|
||||
METHOD(tcg_pts_attr_simple_comp_evid_t, set_pcr_before_value, void,
|
||||
private_tcg_pts_attr_simple_comp_evid_t *this, chunk_t pcr_before)
|
||||
{
|
||||
this->pcr_before = pcr_before;
|
||||
}
|
||||
|
||||
METHOD(tcg_pts_attr_simple_comp_evid_t, get_pcr_after_value, chunk_t,
|
||||
private_tcg_pts_attr_simple_comp_evid_t *this)
|
||||
{
|
||||
return this->pcr_after;
|
||||
}
|
||||
|
||||
METHOD(tcg_pts_attr_simple_comp_evid_t, set_pcr_after_value, void,
|
||||
private_tcg_pts_attr_simple_comp_evid_t *this, chunk_t pcr_after)
|
||||
{
|
||||
this->pcr_after = pcr_after;
|
||||
}
|
||||
|
||||
METHOD(tcg_pts_attr_simple_comp_evid_t, get_pcr_len, u_int16_t,
|
||||
private_tcg_pts_attr_simple_comp_evid_t *this)
|
||||
{
|
||||
@@ -578,30 +516,14 @@ METHOD(tcg_pts_attr_simple_comp_evid_t, get_comp_measurement, chunk_t,
|
||||
return this->measurement;
|
||||
}
|
||||
|
||||
METHOD(tcg_pts_attr_simple_comp_evid_t, set_comp_measurement, void,
|
||||
private_tcg_pts_attr_simple_comp_evid_t *this, chunk_t measurement)
|
||||
{
|
||||
this->measurement = measurement;
|
||||
}
|
||||
|
||||
/**
|
||||
* Described in header.
|
||||
*/
|
||||
pa_tnc_attr_t *tcg_pts_attr_simple_comp_evid_create(
|
||||
pts_attr_simple_comp_evid_flag_t flags,
|
||||
u_int32_t depth, u_int32_t vendor_id,
|
||||
pts_qualifier_t qualifier,
|
||||
pts_funct_comp_name_t name,
|
||||
u_int32_t extended_pcr,
|
||||
pts_meas_algorithms_t hash_algorithm,
|
||||
pts_pcr_transform_t transformation,
|
||||
chunk_t measurement_time,
|
||||
chunk_t policy_uri,
|
||||
chunk_t pcr_before, chunk_t pcr_after,
|
||||
chunk_t measurement)
|
||||
tcg_pts_attr_simple_comp_evid_params_t params)
|
||||
{
|
||||
private_tcg_pts_attr_simple_comp_evid_t *this;
|
||||
|
||||
|
||||
INIT(this,
|
||||
.public = {
|
||||
.pa_tnc_attribute = {
|
||||
@@ -615,49 +537,38 @@ pa_tnc_attr_t *tcg_pts_attr_simple_comp_evid_create(
|
||||
.destroy = _destroy,
|
||||
},
|
||||
.get_flags= _get_flags,
|
||||
.set_flags= _set_flags,
|
||||
.get_sub_component_depth = _get_sub_component_depth,
|
||||
.get_spec_comp_funct_name_vendor_id = _get_spec_comp_funct_name_vendor_id,
|
||||
.get_family = _get_family,
|
||||
.get_qualifier = _get_qualifier,
|
||||
.set_qualifier = _set_qualifier,
|
||||
.get_comp_funct_name = _get_comp_funct_name,
|
||||
.set_comp_funct_name = _set_comp_funct_name,
|
||||
.get_measurement_type = _get_measurement_type,
|
||||
.get_extended_pcr = _get_extended_pcr,
|
||||
.set_extended_pcr = _set_extended_pcr,
|
||||
.get_hash_algorithm = _get_hash_algorithm,
|
||||
.set_hash_algorithm = _set_hash_algorithm,
|
||||
.get_pcr_trans = _get_pcr_trans,
|
||||
.set_pcr_trans = _set_pcr_trans,
|
||||
.get_measurement_time = _get_measurement_time,
|
||||
.set_measurement_time = _set_measurement_time,
|
||||
.get_policy_uri = _get_policy_uri,
|
||||
.set_policy_uri = _set_policy_uri,
|
||||
.get_pcr_before_value = _get_pcr_before_value,
|
||||
.set_pcr_before_value = _set_pcr_before_value,
|
||||
.get_pcr_after_value = _get_pcr_after_value,
|
||||
.set_pcr_after_value = _set_pcr_after_value,
|
||||
.get_pcr_len = _get_pcr_len,
|
||||
.get_comp_measurement = _get_comp_measurement,
|
||||
.set_comp_measurement = _set_comp_measurement,
|
||||
},
|
||||
.vendor_id = PEN_TCG,
|
||||
.type = TCG_PTS_SIMPLE_COMP_EVID,
|
||||
.flags = flags,
|
||||
.depth = depth,
|
||||
.comp_vendor_id = vendor_id,
|
||||
.flags = params.flags,
|
||||
.depth = params.depth,
|
||||
.comp_vendor_id = params.vendor_id,
|
||||
.family = PTS_REQ_FUNCT_COMP_FAM_BIN_ENUM,
|
||||
.qualifier = qualifier,
|
||||
.name = name,
|
||||
.extended_pcr = extended_pcr,
|
||||
.hash_algorithm = hash_algorithm,
|
||||
.transformation = transformation,
|
||||
.measurement_time = measurement_time,
|
||||
.policy_uri = policy_uri,
|
||||
.pcr_before = pcr_before,
|
||||
.pcr_after = pcr_after,
|
||||
.measurement = measurement,
|
||||
.qualifier = params.qualifier,
|
||||
.name = params.name,
|
||||
.extended_pcr = params.extended_pcr,
|
||||
.hash_algorithm = params.hash_algorithm,
|
||||
.transformation = params.transformation,
|
||||
.measurement_time = params.measurement_time,
|
||||
.policy_uri = params.policy_uri,
|
||||
.pcr_before = params.pcr_before,
|
||||
.pcr_after = params.pcr_after,
|
||||
.measurement = params.measurement,
|
||||
);
|
||||
|
||||
return &this->public.pa_tnc_attribute;
|
||||
@@ -684,35 +595,25 @@ pa_tnc_attr_t *tcg_pts_attr_simple_comp_evid_create_from_data(chunk_t data)
|
||||
.destroy = _destroy,
|
||||
},
|
||||
.get_flags= _get_flags,
|
||||
.set_flags= _set_flags,
|
||||
.get_sub_component_depth = _get_sub_component_depth,
|
||||
.get_spec_comp_funct_name_vendor_id = _get_spec_comp_funct_name_vendor_id,
|
||||
.get_family = _get_family,
|
||||
.get_qualifier = _get_qualifier,
|
||||
.set_qualifier = _set_qualifier,
|
||||
.get_comp_funct_name = _get_comp_funct_name,
|
||||
.set_comp_funct_name = _set_comp_funct_name,
|
||||
.get_measurement_type = _get_measurement_type,
|
||||
.get_extended_pcr = _get_extended_pcr,
|
||||
.set_extended_pcr = _set_extended_pcr,
|
||||
.get_hash_algorithm = _get_hash_algorithm,
|
||||
.set_hash_algorithm = _set_hash_algorithm,
|
||||
.get_pcr_trans = _get_pcr_trans,
|
||||
.set_pcr_trans = _set_pcr_trans,
|
||||
.get_measurement_time = _get_measurement_time,
|
||||
.set_measurement_time = _set_measurement_time,
|
||||
.get_policy_uri = _get_policy_uri,
|
||||
.set_policy_uri = _set_policy_uri,
|
||||
.get_pcr_before_value = _get_pcr_before_value,
|
||||
.set_pcr_before_value = _set_pcr_before_value,
|
||||
.get_pcr_after_value = _get_pcr_after_value,
|
||||
.set_pcr_after_value = _set_pcr_after_value,
|
||||
.get_pcr_len = _get_pcr_len,
|
||||
.get_comp_measurement = _get_comp_measurement,
|
||||
.set_comp_measurement = _set_comp_measurement,
|
||||
},
|
||||
.vendor_id = PEN_TCG,
|
||||
.type = TCG_PTS_SIMPLE_COMP_EVID,
|
||||
.family = PTS_REQ_FUNCT_COMP_FAM_BIN_ENUM,
|
||||
.value = chunk_clone(data),
|
||||
);
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
typedef struct tcg_pts_attr_simple_comp_evid_t tcg_pts_attr_simple_comp_evid_t;
|
||||
typedef enum pts_attr_simple_comp_evid_flag_t pts_attr_simple_comp_evid_flag_t;
|
||||
typedef enum pts_pcr_transform_t pts_pcr_transform_t;
|
||||
typedef struct tcg_pts_attr_simple_comp_evid_params_t tcg_pts_attr_simple_comp_evid_params_t;
|
||||
|
||||
#include "tcg_attr.h"
|
||||
#include "pts/pts_meas_algo.h"
|
||||
@@ -60,6 +61,25 @@ enum pts_pcr_transform_t {
|
||||
PTS_PCR_TRANSFORM_LONG = 3,
|
||||
};
|
||||
|
||||
/**
|
||||
* Parameters for Simple Component Evidence Attribute
|
||||
*/
|
||||
struct tcg_pts_attr_simple_comp_evid_params_t {
|
||||
pts_attr_simple_comp_evid_flag_t flags;
|
||||
u_int32_t depth;
|
||||
u_int32_t vendor_id;
|
||||
pts_qualifier_t qualifier;
|
||||
pts_funct_comp_name_t name;
|
||||
u_int32_t extended_pcr;
|
||||
pts_meas_algorithms_t hash_algorithm;
|
||||
pts_pcr_transform_t transformation;
|
||||
chunk_t measurement_time;
|
||||
chunk_t policy_uri;
|
||||
chunk_t pcr_before;
|
||||
chunk_t pcr_after;
|
||||
chunk_t measurement;
|
||||
};
|
||||
|
||||
/**
|
||||
* Class implementing the TCG PTS Simple Component Evidence attribute
|
||||
*
|
||||
@@ -77,14 +97,6 @@ struct tcg_pts_attr_simple_comp_evid_t {
|
||||
* @return Set of flags
|
||||
*/
|
||||
pts_attr_simple_comp_evid_flag_t (*get_flags)(tcg_pts_attr_simple_comp_evid_t *this);
|
||||
|
||||
/**
|
||||
* Set flags for PTS Simple Component Evidence
|
||||
*
|
||||
* @param flags Set of flags
|
||||
*/
|
||||
void (*set_flags)(tcg_pts_attr_simple_comp_evid_t *this,
|
||||
pts_attr_simple_comp_evid_flag_t flags);
|
||||
|
||||
/**
|
||||
* Get Sub-component Depth
|
||||
@@ -114,14 +126,6 @@ struct tcg_pts_attr_simple_comp_evid_t {
|
||||
*/
|
||||
pts_qualifier_t (*get_qualifier)(tcg_pts_attr_simple_comp_evid_t *this);
|
||||
|
||||
/**
|
||||
* Set qualifier for Component Functional Name
|
||||
*
|
||||
* @param qualifier Functional Name Category Qualifier
|
||||
*/
|
||||
void (*set_qualifier)(tcg_pts_attr_simple_comp_evid_t *this,
|
||||
pts_qualifier_t qualifier);
|
||||
|
||||
/**
|
||||
* Get Special Component Functional Name
|
||||
*
|
||||
@@ -129,15 +133,6 @@ struct tcg_pts_attr_simple_comp_evid_t {
|
||||
*/
|
||||
pts_funct_comp_name_t (*get_comp_funct_name)(tcg_pts_attr_simple_comp_evid_t *this);
|
||||
|
||||
|
||||
/**
|
||||
* Set Component Functional Name
|
||||
*
|
||||
* @param name Component Functional Name
|
||||
*/
|
||||
void (*set_comp_funct_name)(tcg_pts_attr_simple_comp_evid_t *this,
|
||||
pts_funct_comp_name_t name);
|
||||
|
||||
/**
|
||||
* Get Measurement Type
|
||||
*
|
||||
@@ -152,14 +147,6 @@ struct tcg_pts_attr_simple_comp_evid_t {
|
||||
*/
|
||||
u_int32_t (*get_extended_pcr)(tcg_pts_attr_simple_comp_evid_t *this);
|
||||
|
||||
/**
|
||||
* Set which PCR the functional component is extended into
|
||||
*
|
||||
* @param pcr_number Number of PCR
|
||||
*/
|
||||
void (*set_extended_pcr)(tcg_pts_attr_simple_comp_evid_t *this,
|
||||
u_int32_t extended_pcr);
|
||||
|
||||
/**
|
||||
* Get Hash Algorithm
|
||||
*
|
||||
@@ -167,14 +154,6 @@ struct tcg_pts_attr_simple_comp_evid_t {
|
||||
*/
|
||||
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_meas_algorithms_t hash_algorithm);
|
||||
|
||||
/**
|
||||
* Get PCR Transformation
|
||||
*
|
||||
@@ -182,14 +161,6 @@ struct tcg_pts_attr_simple_comp_evid_t {
|
||||
*/
|
||||
pts_pcr_transform_t (*get_pcr_trans)(tcg_pts_attr_simple_comp_evid_t *this);
|
||||
|
||||
/**
|
||||
* Set PCR Transformation
|
||||
*
|
||||
* @param transformation Transformation type of PCR
|
||||
*/
|
||||
void (*set_pcr_trans)(tcg_pts_attr_simple_comp_evid_t *this,
|
||||
pts_pcr_transform_t transformation);
|
||||
|
||||
/**
|
||||
* Get Measurement Time
|
||||
*
|
||||
@@ -197,14 +168,6 @@ struct tcg_pts_attr_simple_comp_evid_t {
|
||||
*/
|
||||
chunk_t (*get_measurement_time)(tcg_pts_attr_simple_comp_evid_t *this);
|
||||
|
||||
/**
|
||||
* Set Measurement Time
|
||||
*
|
||||
* @param time Measurement time
|
||||
*/
|
||||
void (*set_measurement_time)(tcg_pts_attr_simple_comp_evid_t *this,
|
||||
chunk_t time);
|
||||
|
||||
/**
|
||||
* Get Optional Policy URI
|
||||
*
|
||||
@@ -212,14 +175,6 @@ struct tcg_pts_attr_simple_comp_evid_t {
|
||||
*/
|
||||
chunk_t (*get_policy_uri)(tcg_pts_attr_simple_comp_evid_t *this);
|
||||
|
||||
/**
|
||||
* Set Optional Policy URI
|
||||
*
|
||||
* @param policy_uri Policy URI
|
||||
*/
|
||||
void (*set_policy_uri)(tcg_pts_attr_simple_comp_evid_t *this,
|
||||
chunk_t policy_uri);
|
||||
|
||||
/**
|
||||
* Get Optional PCR Length
|
||||
*
|
||||
@@ -233,15 +188,7 @@ struct tcg_pts_attr_simple_comp_evid_t {
|
||||
* @return PCR before value
|
||||
*/
|
||||
chunk_t (*get_pcr_before_value)(tcg_pts_attr_simple_comp_evid_t *this);
|
||||
|
||||
/**
|
||||
* Set Optional PCR before value
|
||||
*
|
||||
* @param pcr_before PCR before value
|
||||
*/
|
||||
void (*set_pcr_before_value)(tcg_pts_attr_simple_comp_evid_t *this,
|
||||
chunk_t pcr_before);
|
||||
|
||||
|
||||
/**
|
||||
* Get Optional PCR after value
|
||||
*
|
||||
@@ -249,14 +196,6 @@ struct tcg_pts_attr_simple_comp_evid_t {
|
||||
*/
|
||||
chunk_t (*get_pcr_after_value)(tcg_pts_attr_simple_comp_evid_t *this);
|
||||
|
||||
/**
|
||||
* Set Optional PCR after value
|
||||
*
|
||||
* @param pcr_after PCR after value
|
||||
*/
|
||||
void (*set_pcr_after_value)(tcg_pts_attr_simple_comp_evid_t *this,
|
||||
chunk_t pcr_after);
|
||||
|
||||
/**
|
||||
* Get Component Measurement
|
||||
*
|
||||
@@ -264,46 +203,14 @@ struct tcg_pts_attr_simple_comp_evid_t {
|
||||
*/
|
||||
chunk_t (*get_comp_measurement)(tcg_pts_attr_simple_comp_evid_t *this);
|
||||
|
||||
/**
|
||||
* Set Component Measurement
|
||||
*
|
||||
* @param measurement Component Measurement Hash
|
||||
*/
|
||||
void (*set_comp_measurement)(tcg_pts_attr_simple_comp_evid_t *this,
|
||||
chunk_t measurement);
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates an tcg_pts_attr_simple_comp_evid_t object
|
||||
*
|
||||
* @param flags Set of flags
|
||||
* @param depth Sub-component Depth
|
||||
* @param vendor_id Component Functional Name Vendor ID
|
||||
* @param qualifier Functional Name Category Qualifier
|
||||
* @param name Component Functional Name
|
||||
* @param extended_pcr Which PCR the functional component is extended into
|
||||
* @param hash_algorithm Hash Algorithm
|
||||
* @param transformation Transformation type for PCR
|
||||
* @param measurement_time Measurement time
|
||||
* @param policy_uri Optional Policy URI
|
||||
* @param pcr_before Optional PCR before value
|
||||
* @param pcr_after Optional PCR after value
|
||||
* @param measurement Component Measurement
|
||||
* @param params Struct of parameters
|
||||
*/
|
||||
pa_tnc_attr_t* tcg_pts_attr_simple_comp_evid_create(pts_attr_simple_comp_evid_flag_t flags,
|
||||
u_int32_t depth,
|
||||
u_int32_t vendor_id,
|
||||
pts_qualifier_t qualifier,
|
||||
pts_funct_comp_name_t name,
|
||||
u_int32_t extended_pcr,
|
||||
pts_meas_algorithms_t hash_algorithm,
|
||||
pts_pcr_transform_t transformation,
|
||||
chunk_t measurement_time,
|
||||
chunk_t policy_uri,
|
||||
chunk_t pcr_before,
|
||||
chunk_t pcr_after,
|
||||
chunk_t measurement);
|
||||
pa_tnc_attr_t* tcg_pts_attr_simple_comp_evid_create(tcg_pts_attr_simple_comp_evid_params_t params);
|
||||
|
||||
/**
|
||||
* Creates an tcg_pts_attr_simple_comp_evid_t object from received data
|
||||
|
||||
Reference in New Issue
Block a user