Make sure libstrongswan is initialized first in IMCs and IMVs
This commit is contained in:
parent
4eb6149ae8
commit
5ec08a6a05
|
@ -779,6 +779,14 @@ imv_agent_if_t *imv_os_agent_create(const char *name, TNC_IMVID id,
|
|||
TNC_Version *actual_version)
|
||||
{
|
||||
private_imv_os_agent_t *this;
|
||||
imv_agent_t *agent;
|
||||
|
||||
agent = imv_agent_create(name, msg_types, countof(msg_types), id,
|
||||
actual_version);
|
||||
if (!agent)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
INIT(this,
|
||||
.public = {
|
||||
|
@ -790,16 +798,10 @@ imv_agent_if_t *imv_os_agent_create(const char *name, TNC_IMVID id,
|
|||
.solicit_recommendation = _solicit_recommendation,
|
||||
.destroy = _destroy,
|
||||
},
|
||||
.agent = imv_agent_create(name, msg_types, countof(msg_types), id,
|
||||
actual_version),
|
||||
.agent = agent,
|
||||
.db = imv_os_database_create(imcv_db),
|
||||
);
|
||||
|
||||
if (!this->agent)
|
||||
{
|
||||
destroy(this);
|
||||
return NULL;
|
||||
}
|
||||
return &this->public;
|
||||
}
|
||||
|
||||
|
|
|
@ -296,6 +296,14 @@ imv_agent_if_t *imv_test_agent_create(const char *name, TNC_IMVID id,
|
|||
TNC_Version *actual_version)
|
||||
{
|
||||
private_imv_test_agent_t *this;
|
||||
imv_agent_t *agent;
|
||||
|
||||
agent = imv_agent_create(name, msg_types, countof(msg_types), id,
|
||||
actual_version);
|
||||
if (!agent)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
INIT(this,
|
||||
.public = {
|
||||
|
@ -307,15 +315,9 @@ imv_agent_if_t *imv_test_agent_create(const char *name, TNC_IMVID id,
|
|||
.solicit_recommendation = _solicit_recommendation,
|
||||
.destroy = _destroy,
|
||||
},
|
||||
.agent = imv_agent_create(name, msg_types, countof(msg_types), id,
|
||||
actual_version),
|
||||
.agent = agent,
|
||||
);
|
||||
|
||||
if (!this->agent)
|
||||
{
|
||||
destroy(this);
|
||||
return NULL;
|
||||
}
|
||||
return &this->public;
|
||||
}
|
||||
|
||||
|
|
|
@ -71,11 +71,6 @@ TNC_Result TNC_IMC_Initialize(TNC_IMCID imc_id,
|
|||
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, countof(msg_types),
|
||||
imc_id, actual_version);
|
||||
if (!imc_attestation)
|
||||
|
@ -83,6 +78,13 @@ TNC_Result TNC_IMC_Initialize(TNC_IMCID imc_id,
|
|||
return TNC_RESULT_FATAL;
|
||||
}
|
||||
|
||||
if (!pts_meas_algo_probe(&supported_algorithms) ||
|
||||
!pts_dh_group_probe(&supported_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)
|
||||
|
|
|
@ -564,8 +564,16 @@ imv_agent_if_t *imv_attestation_agent_create(const char *name, TNC_IMVID id,
|
|||
TNC_Version *actual_version)
|
||||
{
|
||||
private_imv_attestation_agent_t *this;
|
||||
imv_agent_t *agent;
|
||||
char *hash_alg, *dh_group, *cadir;
|
||||
|
||||
agent = imv_agent_create(name, msg_types, countof(msg_types), id,
|
||||
actual_version);
|
||||
if (!agent)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
hash_alg = lib->settings->get_str(lib->settings,
|
||||
"libimcv.plugins.imv-attestation.hash_algorithm", "sha256");
|
||||
dh_group = lib->settings->get_str(lib->settings,
|
||||
|
@ -583,8 +591,7 @@ imv_agent_if_t *imv_attestation_agent_create(const char *name, TNC_IMVID id,
|
|||
.solicit_recommendation = _solicit_recommendation,
|
||||
.destroy = _destroy,
|
||||
},
|
||||
.agent = imv_agent_create(name, msg_types, countof(msg_types), id,
|
||||
actual_version),
|
||||
.agent = agent,
|
||||
.supported_algorithms = PTS_MEAS_ALGO_NONE,
|
||||
.supported_dh_groups = PTS_DH_GROUP_NONE,
|
||||
.pts_credmgr = credential_manager_create(),
|
||||
|
@ -594,8 +601,7 @@ imv_agent_if_t *imv_attestation_agent_create(const char *name, TNC_IMVID id,
|
|||
|
||||
libpts_init();
|
||||
|
||||
if (!this->agent ||
|
||||
!pts_meas_algo_probe(&this->supported_algorithms) ||
|
||||
if (!pts_meas_algo_probe(&this->supported_algorithms) ||
|
||||
!pts_dh_group_probe(&this->supported_dh_groups) ||
|
||||
!pts_meas_algo_update(hash_alg, &this->supported_algorithms) ||
|
||||
!pts_dh_group_update(dh_group, &this->supported_dh_groups))
|
||||
|
@ -612,4 +618,3 @@ imv_agent_if_t *imv_attestation_agent_create(const char *name, TNC_IMVID id,
|
|||
|
||||
return &this->public;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue