buffer PA-TNC attributes until Generate Attestation Evidence attribute is received
authorAndreas Steffen <andreas.steffen@strongswan.org>
Sat, 21 Jul 2012 14:43:24 +0000 (16:43 +0200)
committerAndreas Steffen <andreas.steffen@strongswan.org>
Sat, 21 Jul 2012 14:43:24 +0000 (16:43 +0200)
src/libpts/plugins/imc_attestation/imc_attestation_process.c
src/libpts/plugins/imc_attestation/imc_attestation_state.c
src/libpts/plugins/imc_attestation/imc_attestation_state.h

index 5ba9f87..2b87a71 100644 (file)
@@ -394,14 +394,15 @@ bool imc_attestation_process(pa_tnc_attr_t *attr, linked_list_t *attr_list,
                                        {
                                                break;
                                        }
-                                       attestation_state->add_evidence(attestation_state, evid);
                                        if (measurements)
                                        {
                                                DBG2(DBG_IMC, "collected %d file measurements",
                                                         measurements->get_file_count(measurements));
                                                attr = tcg_pts_attr_file_meas_create(measurements);
-                                               attr_list->insert_last(attr_list, attr);
+                                               attestation_state->add_attr(attestation_state, attr);
                                        }
+                                       attr = tcg_pts_attr_simple_comp_evid_create(evid);
+                                       attestation_state->add_attr(attestation_state, attr);
                                }
                                while (status == NEED_MORE);
                                comp->destroy(comp);
@@ -413,14 +414,12 @@ bool imc_attestation_process(pa_tnc_attr_t *attr, linked_list_t *attr_list,
                {
                        pts_simple_evid_final_flag_t flags;
                        pts_meas_algorithms_t comp_hash_algorithm;
-                       pts_comp_evidence_t *evid;
                        chunk_t pcr_composite, quote_sig;
                        bool use_quote2;
 
-                       /* Send buffered Simple Component Evidences */
-                       while (attestation_state->next_evidence(attestation_state, &evid))
+                       /* Send buffered PA-TNC attributes */
+                       while (attestation_state->next_attr(attestation_state, &attr))
                        {
-                               attr = tcg_pts_attr_simple_comp_evid_create(evid);
                                attr_list->insert_last(attr_list, attr);
                        }
 
index c7f4150..83b1c77 100644 (file)
@@ -61,7 +61,7 @@ struct private_imc_attestation_state_t {
        pts_t *pts;
 
        /**
-        * PTS Component Evidence list
+        * PA-TNC attribute cache list
         */
        linked_list_t *list;
 
@@ -125,16 +125,16 @@ METHOD(imc_attestation_state_t, get_pts, pts_t*,
        return this->pts;
 }
 
-METHOD(imc_attestation_state_t, add_evidence, void,
-       private_imc_attestation_state_t *this, pts_comp_evidence_t *evidence)
+METHOD(imc_attestation_state_t, add_attr, void,
+       private_imc_attestation_state_t *this, pa_tnc_attr_t *attr)
 {
-       this->list->insert_last(this->list, evidence);
+       this->list->insert_last(this->list, attr);
 }
 
-METHOD(imc_attestation_state_t, next_evidence, bool,
-       private_imc_attestation_state_t *this, pts_comp_evidence_t **evid)
+METHOD(imc_attestation_state_t, next_attr, bool,
+       private_imc_attestation_state_t *this, pa_tnc_attr_t **attr)
 {
-       return this->list->remove_first(this->list, (void**)evid) == SUCCESS;
+       return this->list->remove_first(this->list, (void**)attr) == SUCCESS;
 }
 
 /**
@@ -158,8 +158,8 @@ imc_state_t *imc_attestation_state_create(TNC_ConnectionID connection_id)
                                .destroy = _destroy,
                        },
                        .get_pts = _get_pts,
-                       .add_evidence = _add_evidence,
-                       .next_evidence = _next_evidence,
+                       .add_attr = _add_attr,
+                       .next_attr = _next_attr,
                },
                .connection_id = connection_id,
                .state = TNC_CONNECTION_STATE_CREATE,
index 22b0bba..9e7a132 100644 (file)
@@ -47,19 +47,19 @@ struct imc_attestation_state_t {
        pts_t* (*get_pts)(imc_attestation_state_t *this);
 
        /**
-        * Add an entry to the Component Evidence list
+        * Add an entry to the PA-TNC attribute cache list
         *
-        * @param entry                         Component Evidence entry
+        * @param attr                          PA-TNC attribute entry
         */
-       void (*add_evidence)(imc_attestation_state_t *this, pts_comp_evidence_t *entry);
+       void (*add_attr)(imc_attestation_state_t *this, pa_tnc_attr_t *attr);
 
        /**
-        * Removes next Component Evidence entry from list and returns it
+        * Removes next entry from the PA-TNC attribute cash list and returns it
         *
-        * @param evid                          Next Component Evidence entry
+        * @param attr                          Next PA-TNC attribute entry
         * @return                                      TRUE if next entry is available
         */
-       bool (*next_evidence)(imc_attestation_state_t *this, pts_comp_evidence_t** evid);
+       bool (*next_attr)(imc_attestation_state_t *this, pa_tnc_attr_t** attr);
 
 };