SHA384 is set as strongest hashing algorithm
authorSansar Choinyambuu <schoinya@hsr.ch>
Wed, 31 Aug 2011 06:16:53 +0000 (08:16 +0200)
committerAndreas Steffen <andreas.steffen@strongswan.org>
Thu, 8 Sep 2011 10:08:14 +0000 (12:08 +0200)
src/libimcv/plugins/imc_attestation/imc_attestation.c

index 9506f14..9d70aa1 100644 (file)
@@ -236,16 +236,16 @@ TNC_Result TNC_IMC_ReceiveMessage(TNC_IMCID imc_id,
                                        attr_cast = (tcg_pts_attr_meas_algo_t*)attr;
                                        selected_algorithm = attr_cast->get_algorithms(attr_cast);
 
-                                       if ((supported_algorithms & PTS_MEAS_ALGO_SHA256) &&
-                                               (selected_algorithm & PTS_MEAS_ALGO_SHA256))
-                                       {
-                                               pts->set_meas_algorithm(pts, PTS_MEAS_ALGO_SHA256);
-                                       }
-                                       else if ((supported_algorithms & PTS_MEAS_ALGO_SHA384) &&
+                                       if ((supported_algorithms & PTS_MEAS_ALGO_SHA384) &&
                                                (selected_algorithm & PTS_MEAS_ALGO_SHA384))
                                        {
                                                pts->set_meas_algorithm(pts, PTS_MEAS_ALGO_SHA384);
                                        }
+                                       else if ((supported_algorithms & PTS_MEAS_ALGO_SHA256) &&
+                                               (selected_algorithm & PTS_MEAS_ALGO_SHA256))
+                                       {
+                                               pts->set_meas_algorithm(pts, PTS_MEAS_ALGO_SHA256);
+                                       }
 
                                        else if ((supported_algorithms & PTS_MEAS_ALGO_SHA1) &&
                                                (selected_algorithm & PTS_MEAS_ALGO_SHA1))
@@ -316,13 +316,13 @@ TNC_Result TNC_IMC_ReceiveMessage(TNC_IMCID imc_id,
                                        /* Send File Measurement attribute */
                                        selected_algorithm = pts->get_meas_algorithm(pts);
                                        meas_len = HASH_SIZE_SHA1;
-                                       if(selected_algorithm & PTS_MEAS_ALGO_SHA256
+                                       if(selected_algorithm & PTS_MEAS_ALGO_SHA384
                                        {
-                                               meas_len = HASH_SIZE_SHA256;
+                                               meas_len = HASH_SIZE_SHA384;
                                        }
-                                       else if (selected_algorithm & PTS_MEAS_ALGO_SHA384)
+                                       else if (selected_algorithm & PTS_MEAS_ALGO_SHA256)
                                        {
-                                               meas_len = HASH_SIZE_SHA384;
+                                               meas_len = HASH_SIZE_SHA256;
                                        }
 
                                        /**