|
|
|
@@ -25,12 +25,14 @@
|
|
|
|
|
#include <tncif_names.h>
|
|
|
|
|
#include <tncif_pa_subtypes.h>
|
|
|
|
|
|
|
|
|
|
#include <imc/imc_manager.h>
|
|
|
|
|
#include <tnc/tnc.h>
|
|
|
|
|
#include <tnc/imc/imc_manager.h>
|
|
|
|
|
#include <tnc/imv/imv_manager.h>
|
|
|
|
|
#include <tnc/tnccs/tnccs.h>
|
|
|
|
|
#include <tnc/tnccs/tnccs_manager.h>
|
|
|
|
|
|
|
|
|
|
#include <daemon.h>
|
|
|
|
|
#include <debug.h>
|
|
|
|
|
#include <threading/mutex.h>
|
|
|
|
|
#include <tnc/tnccs/tnccs.h>
|
|
|
|
|
|
|
|
|
|
typedef struct private_tnccs_11_t private_tnccs_11_t;
|
|
|
|
|
|
|
|
|
@@ -94,16 +96,6 @@ struct private_tnccs_11_t {
|
|
|
|
|
*/
|
|
|
|
|
recommendations_t *recs;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* TNC IMC manager controlling Integrity Measurement Collectors
|
|
|
|
|
*/
|
|
|
|
|
imc_manager_t *imcs;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* TNC IMV manager controlling Integrity Measurement Verifiers
|
|
|
|
|
*/
|
|
|
|
|
imc_manager_t *imvs;
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
METHOD(tnccs_t, send_msg, TNC_Result,
|
|
|
|
@@ -186,12 +178,12 @@ static void handle_message(private_tnccs_11_t *this, tnccs_msg_t *msg)
|
|
|
|
|
this->send_msg = TRUE;
|
|
|
|
|
if (this->is_server)
|
|
|
|
|
{
|
|
|
|
|
this->imvs->receive_message(this->imvs,
|
|
|
|
|
tnc->imvs->receive_message(tnc->imvs,
|
|
|
|
|
this->connection_id, msg_body.ptr, msg_body.len, msg_type);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
this->imcs->receive_message(this->imcs,
|
|
|
|
|
tnc->imcs->receive_message(tnc->imcs,
|
|
|
|
|
this->connection_id, msg_body.ptr, msg_body.len,msg_type);
|
|
|
|
|
}
|
|
|
|
|
this->send_msg = FALSE;
|
|
|
|
@@ -225,8 +217,8 @@ static void handle_message(private_tnccs_11_t *this, tnccs_msg_t *msg)
|
|
|
|
|
default:
|
|
|
|
|
state = TNC_CONNECTION_STATE_ACCESS_NONE;
|
|
|
|
|
}
|
|
|
|
|
this->imcs->notify_connection_change(this->imcs,
|
|
|
|
|
this->connection_id, state);
|
|
|
|
|
tnc->imcs->notify_connection_change(tnc->imcs, this->connection_id,
|
|
|
|
|
state);
|
|
|
|
|
this->delete_state = TRUE;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
@@ -287,17 +279,17 @@ METHOD(tls_t, process, status_t,
|
|
|
|
|
|
|
|
|
|
if (this->is_server && !this->connection_id)
|
|
|
|
|
{
|
|
|
|
|
this->connection_id = charon->tnccs->create_connection(charon->tnccs,
|
|
|
|
|
this->connection_id = tnc->tnccs->create_connection(tnc->tnccs,
|
|
|
|
|
(tnccs_t*)this, _send_msg,
|
|
|
|
|
&this->request_handshake_retry, &this->recs);
|
|
|
|
|
if (!this->connection_id)
|
|
|
|
|
{
|
|
|
|
|
return FAILED;
|
|
|
|
|
}
|
|
|
|
|
charon->imvs->notify_connection_change(charon->imvs,
|
|
|
|
|
this->connection_id, TNC_CONNECTION_STATE_CREATE);
|
|
|
|
|
charon->imvs->notify_connection_change(charon->imvs,
|
|
|
|
|
this->connection_id, TNC_CONNECTION_STATE_HANDSHAKE);
|
|
|
|
|
tnc->imvs->notify_connection_change(tnc->imvs, this->connection_id,
|
|
|
|
|
TNC_CONNECTION_STATE_CREATE);
|
|
|
|
|
tnc->imvs->notify_connection_change(tnc->imvs, this->connection_id,
|
|
|
|
|
TNC_CONNECTION_STATE_HANDSHAKE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
data = chunk_create(buf, buflen);
|
|
|
|
@@ -348,11 +340,11 @@ METHOD(tls_t, process, status_t,
|
|
|
|
|
this->send_msg = TRUE;
|
|
|
|
|
if (this->is_server)
|
|
|
|
|
{
|
|
|
|
|
this->imvs->batch_ending(this->imvs, this->connection_id);
|
|
|
|
|
tnc->imvs->batch_ending(tnc->imvs, this->connection_id);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
this->imcs->batch_ending(this->imcs, this->connection_id);
|
|
|
|
|
tnc->imcs->batch_ending(tnc->imcs, this->connection_id);
|
|
|
|
|
}
|
|
|
|
|
this->send_msg = FALSE;
|
|
|
|
|
}
|
|
|
|
@@ -375,7 +367,7 @@ static void check_and_build_recommendation(private_tnccs_11_t *this)
|
|
|
|
|
|
|
|
|
|
if (!this->recs->have_recommendation(this->recs, &rec, &eval))
|
|
|
|
|
{
|
|
|
|
|
charon->imvs->solicit_recommendation(charon->imvs, this->connection_id);
|
|
|
|
|
tnc->imvs->solicit_recommendation(tnc->imvs, this->connection_id);
|
|
|
|
|
}
|
|
|
|
|
if (this->recs->have_recommendation(this->recs, &rec, &eval))
|
|
|
|
|
{
|
|
|
|
@@ -413,7 +405,7 @@ METHOD(tls_t, build, status_t,
|
|
|
|
|
tnccs_msg_t *msg;
|
|
|
|
|
char *pref_lang;
|
|
|
|
|
|
|
|
|
|
this->connection_id = charon->tnccs->create_connection(charon->tnccs,
|
|
|
|
|
this->connection_id = tnc->tnccs->create_connection(tnc->tnccs,
|
|
|
|
|
(tnccs_t*)this, _send_msg,
|
|
|
|
|
&this->request_handshake_retry, NULL);
|
|
|
|
|
if (!this->connection_id)
|
|
|
|
@@ -422,19 +414,19 @@ METHOD(tls_t, build, status_t,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Create TNCCS-PreferredLanguage message */
|
|
|
|
|
pref_lang = this->imcs->get_preferred_language(this->imcs);
|
|
|
|
|
pref_lang = tnc->imcs->get_preferred_language(tnc->imcs);
|
|
|
|
|
msg = tnccs_preferred_language_msg_create(pref_lang);
|
|
|
|
|
this->mutex->lock(this->mutex);
|
|
|
|
|
this->batch = tnccs_batch_create(this->is_server, ++this->batch_id);
|
|
|
|
|
this->batch->add_msg(this->batch, msg);
|
|
|
|
|
this->mutex->unlock(this->mutex);
|
|
|
|
|
|
|
|
|
|
this->imcs->notify_connection_change(this->imcs,
|
|
|
|
|
this->connection_id, TNC_CONNECTION_STATE_CREATE);
|
|
|
|
|
this->imcs->notify_connection_change(this->imcs,
|
|
|
|
|
this->connection_id, TNC_CONNECTION_STATE_HANDSHAKE);
|
|
|
|
|
tnc->imcs->notify_connection_change(tnc->imcs, this->connection_id,
|
|
|
|
|
TNC_CONNECTION_STATE_CREATE);
|
|
|
|
|
tnc->imcs->notify_connection_change(tnc->imcs, this->connection_id,
|
|
|
|
|
TNC_CONNECTION_STATE_HANDSHAKE);
|
|
|
|
|
this->send_msg = TRUE;
|
|
|
|
|
this->imcs->begin_handshake(this->imcs, this->connection_id);
|
|
|
|
|
tnc->imcs->begin_handshake(tnc->imcs, this->connection_id);
|
|
|
|
|
this->send_msg = FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -501,7 +493,7 @@ METHOD(tls_t, is_complete, bool,
|
|
|
|
|
|
|
|
|
|
if (this->recs && this->recs->have_recommendation(this->recs, &rec, &eval))
|
|
|
|
|
{
|
|
|
|
|
return charon->imvs->enforce_recommendation(charon->imvs, rec, eval);
|
|
|
|
|
return tnc->imvs->enforce_recommendation(tnc->imvs, rec, eval);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
@@ -518,8 +510,8 @@ METHOD(tls_t, get_eap_msk, chunk_t,
|
|
|
|
|
METHOD(tls_t, destroy, void,
|
|
|
|
|
private_tnccs_11_t *this)
|
|
|
|
|
{
|
|
|
|
|
charon->tnccs->remove_connection(charon->tnccs, this->connection_id,
|
|
|
|
|
this->is_server);
|
|
|
|
|
tnc->tnccs->remove_connection(tnc->tnccs, this->connection_id,
|
|
|
|
|
this->is_server);
|
|
|
|
|
this->mutex->destroy(this->mutex);
|
|
|
|
|
DESTROY_IF(this->batch);
|
|
|
|
|
free(this);
|
|
|
|
@@ -544,8 +536,6 @@ tls_t *tnccs_11_create(bool is_server)
|
|
|
|
|
},
|
|
|
|
|
.is_server = is_server,
|
|
|
|
|
.mutex = mutex_create(MUTEX_TYPE_DEFAULT),
|
|
|
|
|
.imcs = lib->get(lib, "imc-manager"),
|
|
|
|
|
.imvs = lib->get(lib, "imv-manager"),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
return &this->public;
|
|
|
|
|