log selected PTS measurement algorithm
authorAndreas Steffen <andreas.steffen@strongswan.org>
Sat, 20 Aug 2011 13:47:55 +0000 (15:47 +0200)
committerAndreas Steffen <andreas.steffen@strongswan.org>
Thu, 8 Sep 2011 10:08:12 +0000 (12:08 +0200)
src/libimcv/plugins/imc_attestation/imc_attestation.c
src/libimcv/plugins/imv_attestation/imv_attestation.c

index 87f5b45..64b3fe1 100644 (file)
@@ -566,7 +566,12 @@ TNC_Result TNC_IMC_ReceiveMessage(TNC_IMCID imc_id,
                                        else
                                        {
                                                /* TODO generate an error message */
+                                               selected_algorithm = PTS_MEAS_ALGO_SHA256;
                                        }
+                                       DBG2(DBG_IMC, "selected PTS measurement algorithm is %N",
+                                                hash_algorithm_names, 
+                                                pts_meas_to_hash_algorithm(selected_algorithm));
+
                                        attestation_state->set_handshake_state(attestation_state,
                                                                                IMC_ATTESTATION_STATE_REQ_MEAS_ALGO);
                                        break;
index f9f10e4..44b0ead 100644 (file)
@@ -433,11 +433,20 @@ TNC_Result TNC_IMV_ReceiveMessage(TNC_IMVID imv_id,
                                }
                                case TCG_PTS_MEAS_ALGO_SELECTION:
                                {
-                                       tcg_pts_attr_meas_algo_t *attr_meas_algo_selection;
+                                       tcg_pts_attr_meas_algo_t *attr_meas;
                                        pts_meas_algorithms_t selected_algorithm;
+                                       hash_algorithm_t hash_alg;
                                        
-                                       attr_meas_algo_selection = (tcg_pts_attr_meas_algo_t*)attr;
-                                       selected_algorithm = attr_meas_algo_selection->get_algorithms(attr_meas_algo_selection);
+                                       attr_meas = (tcg_pts_attr_meas_algo_t*)attr;
+                                       selected_algorithm = attr_meas->get_algorithms(attr_meas);
+                                       hash_alg = pts_meas_to_hash_algorithm(selected_algorithm);
+                                       if (hash_alg == HASH_UNKNOWN)
+                                       {
+                                               /* TODO generate an error message */
+                                               break;
+                                       }
+                                       DBG2(DBG_IMV, "selected PTS measurement algorithm is %N",
+                                                                  hash_algorithm_names, hash_alg);
                                        /* TODO: What to do with the selected algorithm from imc */
                                        
                                        attestation_state->set_handshake_state(attestation_state,
@@ -587,7 +596,7 @@ TNC_Result TNC_IMV_BatchEnding(TNC_IMVID imv_id,
        }
        attestation_state = (imv_attestation_state_t*)state;
 
-       /* Check if IMV has to initiate the IF-M exchange */
+       /* Check if IMV has to initiate the PA-TNC exchange */
        if (attestation_state->get_handshake_state(attestation_state) ==
                IMV_ATTESTATION_STATE_INIT)
        {