diff options
author | Sansar Choinyambuu <schoinya@hsr.ch> | 2011-09-30 14:54:39 +0200 |
---|---|---|
committer | Andreas Steffen <andreas.steffen@strongswan.org> | 2011-11-28 14:34:21 +0100 |
commit | 7c7034f64c6d19d1c13659b83fc5ed111aabe4b5 (patch) | |
tree | 7b2e9cc109804cfbb3b577e86865666df5ab0e18 /src/libpts/tcg | |
parent | 97ebeaa45cfb3c1e003c513d1990f13610bd5430 (diff) | |
download | strongswan-7c7034f64c6d19d1c13659b83fc5ed111aabe4b5.tar.bz2 strongswan-7c7034f64c6d19d1c13659b83fc5ed111aabe4b5.tar.xz |
Use struct containing the parameters for Create function
Deleted unnecessary setter functions
Diffstat (limited to 'src/libpts/tcg')
-rw-r--r-- | src/libpts/tcg/tcg_pts_attr_simple_comp_evid.c | 131 | ||||
-rw-r--r-- | src/libpts/tcg/tcg_pts_attr_simple_comp_evid.h | 139 |
2 files changed, 39 insertions, 231 deletions
diff --git a/src/libpts/tcg/tcg_pts_attr_simple_comp_evid.c b/src/libpts/tcg/tcg_pts_attr_simple_comp_evid.c index 95a83c6a3..69ff00de1 100644 --- a/src/libpts/tcg/tcg_pts_attr_simple_comp_evid.c +++ b/src/libpts/tcg/tcg_pts_attr_simple_comp_evid.c @@ -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), ); diff --git a/src/libpts/tcg/tcg_pts_attr_simple_comp_evid.h b/src/libpts/tcg/tcg_pts_attr_simple_comp_evid.h index 5da20e96e..70f98833d 100644 --- a/src/libpts/tcg/tcg_pts_attr_simple_comp_evid.h +++ b/src/libpts/tcg/tcg_pts_attr_simple_comp_evid.h @@ -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" @@ -61,6 +62,25 @@ enum pts_pcr_transform_t { }; /** + * 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 @@ -115,29 +127,12 @@ 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 * * @return Component Functional Name */ 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 * @@ -153,14 +148,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 * * @return Hash Algorithm @@ -168,14 +155,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 * * @return Transformation type of PCR @@ -183,14 +162,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 * * @return Measurement time @@ -198,14 +169,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 * * @return Policy URI @@ -213,14 +176,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 * * @return Length of PCR before/after values @@ -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 * @@ -250,60 +197,20 @@ 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 * * @return Component Measurement Hash */ 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 |