/** * see section 3.8.1 of TCG TNC IF-IMC Specification 1.3 */ TNC_Result TNC_IMC_Initialize(TNC_IMCID imc_id, TNC_Version min_version, TNC_Version max_version, TNC_Version *actual_version) { if (imc_swid) { DBG1(DBG_IMC, "IMC \"%s\" has already been initialized", imc_name); return TNC_RESULT_ALREADY_INITIALIZED; } imc_swid = imc_agent_create(imc_name, msg_types, countof(msg_types), imc_id, actual_version); if (!imc_swid) { return TNC_RESULT_FATAL; } libpts_init(); if (min_version > TNC_IFIMC_VERSION_1 || max_version < TNC_IFIMC_VERSION_1) { DBG1(DBG_IMC, "no common IF-IMC version"); return TNC_RESULT_NO_COMMON_VERSION; } return TNC_RESULT_SUCCESS; }
/** * see section 3.8.1 of TCG TNC IF-IMC Specification 1.3 */ TNC_Result TNC_IMC_Initialize(TNC_IMCID imc_id, TNC_Version min_version, TNC_Version max_version, TNC_Version *actual_version) { if (imc_attestation) { DBG1(DBG_IMC, "IMC \"%s\" has already been initialized", imc_name); return TNC_RESULT_ALREADY_INITIALIZED; } if (!pts_meas_algo_probe(&supported_algorithms) || !pts_dh_group_probe(&supported_dh_groups)) { return TNC_RESULT_FATAL; } imc_attestation = imc_agent_create(imc_name, msg_types, 1, imc_id, actual_version); if (!imc_attestation) { return TNC_RESULT_FATAL; } libpts_init(); if (min_version > TNC_IFIMC_VERSION_1 || max_version < TNC_IFIMC_VERSION_1) { DBG1(DBG_IMC, "no common IF-IMC version"); return TNC_RESULT_NO_COMMON_VERSION; } return TNC_RESULT_SUCCESS; }
/** * see section 3.8.1 of TCG TNC IF-IMC Specification 1.3 */ TNC_Result TNC_IMC_Initialize(TNC_IMCID imc_id, TNC_Version min_version, TNC_Version max_version, TNC_Version *actual_version) { bool mandatory_dh_groups; if (imc_attestation) { DBG1(DBG_IMC, "IMC \"%s\" has already been initialized", imc_name); return TNC_RESULT_ALREADY_INITIALIZED; } imc_attestation = imc_agent_create(imc_name, msg_types, countof(msg_types), imc_id, actual_version); if (!imc_attestation) { return TNC_RESULT_FATAL; } mandatory_dh_groups = lib->settings->get_bool(lib->settings, "%s.plugins.imc-attestation.mandatory_dh_groups", TRUE, lib->ns); if (!pts_meas_algo_probe(&supported_algorithms) || !pts_dh_group_probe(&supported_dh_groups, mandatory_dh_groups)) { imc_attestation->destroy(imc_attestation); imc_attestation = NULL; return TNC_RESULT_FATAL; } libpts_init(); if (min_version > TNC_IFIMC_VERSION_1 || max_version < TNC_IFIMC_VERSION_1) { DBG1(DBG_IMC, "no common IF-IMC version"); return TNC_RESULT_NO_COMMON_VERSION; } return TNC_RESULT_SUCCESS; }
/** * see section 3.8.1 of TCG TNC IF-IMV Specification 1.3 */ TNC_Result TNC_IMV_Initialize(TNC_IMVID imv_id, TNC_Version min_version, TNC_Version max_version, TNC_Version *actual_version) { char *hash_alg, *dh_group, *uri, *cadir; if (imv_attestation) { DBG1(DBG_IMV, "IMV \"%s\" has already been initialized", imv_name); return TNC_RESULT_ALREADY_INITIALIZED; } if (!pts_meas_algo_probe(&supported_algorithms) || !pts_dh_group_probe(&supported_dh_groups)) { return TNC_RESULT_FATAL; } imv_attestation = imv_agent_create(imv_name, msg_types, countof(msg_types), imv_id, actual_version); if (!imv_attestation) { return TNC_RESULT_FATAL; } libpts_init(); if (min_version > TNC_IFIMV_VERSION_1 || max_version < TNC_IFIMV_VERSION_1) { DBG1(DBG_IMV, "no common IF-IMV version"); return TNC_RESULT_NO_COMMON_VERSION; } hash_alg = lib->settings->get_str(lib->settings, "libimcv.plugins.imv-attestation.hash_algorithm", "sha256"); dh_group = lib->settings->get_str(lib->settings, "libimcv.plugins.imv-attestation.dh_group", "ecp256"); if (!pts_meas_algo_update(hash_alg, &supported_algorithms) || !pts_dh_group_update(dh_group, &supported_dh_groups)) { return TNC_RESULT_FATAL; } /* create a PTS credential manager */ pts_credmgr = credential_manager_create(); /* create PTS credential set */ cadir = lib->settings->get_str(lib->settings, "libimcv.plugins.imv-attestation.cadir", NULL); pts_creds = pts_creds_create(cadir); if (pts_creds) { pts_credmgr->add_set(pts_credmgr, pts_creds->get_set(pts_creds)); } /* attach file measurement database */ uri = lib->settings->get_str(lib->settings, "libimcv.plugins.imv-attestation.database", NULL); pts_db = pts_database_create(uri); return TNC_RESULT_SUCCESS; }