Changes according to the new PTS Attributes addition
[strongswan.git] / src / libimcv / plugins / imc_attestation / imc_attestation.c
index 89735fc..f0de1c8 100644 (file)
 #include <ietf/ietf_attr_pa_tnc_error.h>
 #include <tcg/tcg_attr.h>
 
 #include <ietf/ietf_attr_pa_tnc_error.h>
 #include <tcg/tcg_attr.h>
 
-#include <pen/pen.h>
+#include <tncif_pa_subtypes.h>
 
 
+#include <pen/pen.h>
 #include <debug.h>
 
 /* IMC definitions */
 
 static const char imc_name[] = "Attestation";
 
 #include <debug.h>
 
 /* IMC definitions */
 
 static const char imc_name[] = "Attestation";
 
-#define IMC_VENDOR_ID  PEN_ITA
-#define IMC_SUBTYPE            0x02
+#define IMC_VENDOR_ID  PEN_TCG
+#define IMC_SUBTYPE    PA_SUBTYPE_TCG_PTS
 
 static imc_agent_t *imc_attestation;
  
 
 static imc_agent_t *imc_attestation;
  
@@ -86,7 +87,8 @@ TNC_Result TNC_IMC_NotifyConnectionChange(TNC_IMCID imc_id,
                case TNC_CONNECTION_STATE_ACCESS_ISOLATED:
                case TNC_CONNECTION_STATE_ACCESS_NONE:
                default:
                case TNC_CONNECTION_STATE_ACCESS_ISOLATED:
                case TNC_CONNECTION_STATE_ACCESS_NONE:
                default:
-                       return imc_attestation->change_state(imc_attestation, connection_id, new_state);
+                       return imc_attestation->change_state(imc_attestation, connection_id,
+                                                                                                 new_state, NULL);
        }
 }
 
        }
 }
 
@@ -171,6 +173,7 @@ TNC_Result TNC_IMC_ReceiveMessage(TNC_IMCID imc_id,
                        ietf_attr_pa_tnc_error_t *error_attr;
                        pa_tnc_error_code_t error_code;
                        chunk_t msg_info, attr_info;
                        ietf_attr_pa_tnc_error_t *error_attr;
                        pa_tnc_error_code_t error_code;
                        chunk_t msg_info, attr_info;
+                       u_int32_t offset;
 
                        error_attr = (ietf_attr_pa_tnc_error_t*)attr;
                        error_code = error_attr->get_error_code(error_attr);
 
                        error_attr = (ietf_attr_pa_tnc_error_t*)attr;
                        error_code = error_attr->get_error_code(error_attr);
@@ -180,6 +183,10 @@ TNC_Result TNC_IMC_ReceiveMessage(TNC_IMCID imc_id,
                                 pa_tnc_error_code_names, error_code, &msg_info);
                        switch (error_code)
                        {
                                 pa_tnc_error_code_names, error_code, &msg_info);
                        switch (error_code)
                        {
+                               case PA_ERROR_INVALID_PARAMETER:
+                                       offset = error_attr->get_offset(error_attr);
+                                       DBG1(DBG_IMC, "  occurred at offset of %u bytes", offset);
+                                       break;
                                case PA_ERROR_ATTR_TYPE_NOT_SUPPORTED:
                                        attr_info = error_attr->get_attr_info(error_attr);
                                        DBG1(DBG_IMC, "  unsupported attribute %#B", &attr_info);
                                case PA_ERROR_ATTR_TYPE_NOT_SUPPORTED:
                                        attr_info = error_attr->get_attr_info(error_attr);
                                        DBG1(DBG_IMC, "  unsupported attribute %#B", &attr_info);
@@ -194,6 +201,60 @@ TNC_Result TNC_IMC_ReceiveMessage(TNC_IMCID imc_id,
                        /**
                         * Handle TCG PTS attributes
                         */
                        /**
                         * Handle TCG PTS attributes
                         */
+                       switch(attr->get_type(attr))
+                       {
+                               case TCG_PTS_REQ_PROTO_CAPS:
+                                       break;
+                               case TCG_PTS_DH_NONCE_PARAMS_REQ:
+                                       break;
+                               case TCG_PTS_DH_NONCE_FINISH:
+                                       break;
+                               case TCG_PTS_MEAS_ALGO:
+                                       break;
+                               case TCG_PTS_GET_TPM_VERSION_INFO:
+                                       break;
+                               case TCG_PTS_REQ_TEMPL_REF_MANI_SET_META:
+                                       break;
+                               case TCG_PTS_UPDATE_TEMPL_REF_MANI:
+                                       break;
+                               case TCG_PTS_GET_AIK:
+                                       break;
+                                       
+                               /* PTS-based Attestation Evidence */
+                               case TCG_PTS_REQ_FUNCT_COMP_EVID:
+                                       break;
+                               case TCG_PTS_GEN_ATTEST_EVID:
+                                       break;
+                               case TCG_PTS_REQ_FILE_META:
+                                       break;
+                               case TCG_PTS_REQ_FILE_MEAS:
+                                       break;
+                               case TCG_PTS_REQ_INTEG_MEAS_LOG:
+                                       break;
+                                       
+                               /* On Windows only*/
+                               case TCG_PTS_REQ_REGISTRY_VALUE:
+                               /* Received on IMV side only*/
+                               case TCG_PTS_PROTO_CAPS:
+                               case TCG_PTS_DH_NONCE_PARAMS_RESP:
+                               case TCG_PTS_MEAS_ALGO_SELECTION:
+                               case TCG_PTS_TPM_VERSION_INFO:
+                               case TCG_PTS_TEMPL_REF_MANI_SET_META:
+                               case TCG_PTS_AIK:                               
+                               case TCG_PTS_SIMPLE_COMP_EVID:
+                               case TCG_PTS_SIMPLE_EVID_FINAL:
+                               case TCG_PTS_VERIFICATION_RESULT:
+                               case TCG_PTS_INTEG_REPORT:
+                               case TCG_PTS_UNIX_FILE_META:
+                               case TCG_PTS_FILE_MEAS:
+                               case TCG_PTS_INTEG_MEAS_LOG:
+                               default:
+                                       DBG1(DBG_IMC, "received unsupported attribute '%N'",
+                                               tcg_attr_names, attr->get_type(attr));
+                                       break;
+                       }
+                       
+                       
                }
        }
        enumerator->destroy(enumerator);
                }
        }
        enumerator->destroy(enumerator);