Changed the type of hash algorithm to the enum variable

Replaced the values of flag enum variables
This commit is contained in:
Sansar Choinyambuu
2011-09-08 12:08:09 +02:00
committed by Andreas Steffen
parent adc954a77d
commit 89f7bf2276
2 changed files with 18 additions and 16 deletions
@@ -126,7 +126,7 @@ struct private_tcg_pts_attr_simple_comp_evid_t {
bool noskip_flag; bool noskip_flag;
/** /**
* Set of flags for Request Functional Component * Set of flags for Simple Component Evidence
*/ */
pts_attr_simple_comp_evid_flag_t flags; pts_attr_simple_comp_evid_flag_t flags;
@@ -168,7 +168,7 @@ struct private_tcg_pts_attr_simple_comp_evid_t {
/** /**
* Hash Algorithm * Hash Algorithm
*/ */
u_int16_t hash_algorithm; pts_attr_meas_algorithms_t hash_algorithm;
/** /**
* Transformation type for PCR * Transformation type for PCR
@@ -285,13 +285,14 @@ METHOD(pa_tnc_attr_t, build, void,
writer->write_data (writer, this->measurement_time); writer->write_data (writer, this->measurement_time);
/* Optional fields */ /* Optional fields */
if(this->policy_uri.ptr) 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)
{ {
writer->write_uint16 (writer, this->pcr_before.len); writer->write_uint16 (writer, this->pcr_before.len);
writer->write_data (writer, this->pcr_before); writer->write_data (writer, this->pcr_before);
@@ -493,14 +494,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, u_int16_t, METHOD(tcg_pts_attr_simple_comp_evid_t, get_hash_algorithm, pts_attr_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, u_int16_t hash_algorithm) private_tcg_pts_attr_simple_comp_evid_t *this, pts_attr_meas_algorithms_t hash_algorithm)
{ {
this->hash_algorithm = hash_algorithm; this->hash_algorithm = hash_algorithm;
} }
@@ -569,7 +570,8 @@ METHOD(tcg_pts_attr_simple_comp_evid_t, get_pcr_len, u_int16_t,
private_tcg_pts_attr_simple_comp_evid_t *this) private_tcg_pts_attr_simple_comp_evid_t *this)
{ {
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)
return this->pcr_before.len; return this->pcr_before.len;
else return 0; else return 0;
} }
@@ -596,7 +598,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,
u_int16_t hash_algorithm, pts_attr_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,
@@ -38,15 +38,15 @@ typedef enum pts_attr_simple_comp_evid_pcr_transform_t pts_attr_simple_comp_evid
*/ */
enum pts_attr_simple_comp_evid_flag_t { enum pts_attr_simple_comp_evid_flag_t {
/** PCR information fields inlcuded */ /** PCR information fields inlcuded */
PTS_SIMPLE_COMP_EVID_FLAG_PCR = (1<<0), PTS_SIMPLE_COMP_EVID_FLAG_PCR = 0,
/** No Validation was attempted */ /** No Validation was attempted */
PTS_SIMPLE_COMP_EVID_FLAG_NO_VALID = (1<<1), PTS_SIMPLE_COMP_EVID_FLAG_NO_VALID = 1,
/** Attempted validation, unable to verify */ /** Attempted validation, unable to verify */
PTS_SIMPLE_COMP_EVID_FLAG_NO_VER = (1<<2), PTS_SIMPLE_COMP_EVID_FLAG_NO_VER = 2,
/** Attempted validation, verification failed */ /** Attempted validation, verification failed */
PTS_SIMPLE_COMP_EVID_FLAG_VER_FAIL = (1<<3), PTS_SIMPLE_COMP_EVID_FLAG_VER_FAIL = 3,
/** Attempted validation, verification passed */ /** Attempted validation, verification passed */
PTS_SIMPLE_COMP_EVID_FLAG_VER_PASS = (1<<4), PTS_SIMPLE_COMP_EVID_FLAG_VER_PASS = 4,
}; };
/** /**
@@ -168,7 +168,7 @@ struct tcg_pts_attr_simple_comp_evid_t {
* *
* @return Hash Algorithm * @return Hash Algorithm
*/ */
u_int16_t (*get_hash_algorithm)(tcg_pts_attr_simple_comp_evid_t *this); pts_attr_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,
u_int16_t hash_algorithm); pts_attr_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,
u_int16_t hash_algorithm, pts_attr_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,