TLS stack keeps a copy of server/peer identities

This commit is contained in:
Martin Willi
2010-08-03 15:39:25 +02:00
parent c8a2fca58c
commit 97abf95412
2 changed files with 17 additions and 18 deletions
+1 -16
View File
@@ -32,16 +32,6 @@ struct private_eap_tls_t {
*/ */
eap_tls_t public; eap_tls_t public;
/**
* ID of the server
*/
identification_t *server;
/**
* ID of the peer
*/
identification_t *peer;
/** /**
* Number of EAP-TLS messages processed so far * Number of EAP-TLS messages processed so far
*/ */
@@ -399,9 +389,6 @@ METHOD(eap_method_t, is_mutual, bool,
METHOD(eap_method_t, destroy, void, METHOD(eap_method_t, destroy, void,
private_eap_tls_t *this) private_eap_tls_t *this)
{ {
this->peer->destroy(this->peer);
this->server->destroy(this->server);
free(this->input.ptr); free(this->input.ptr);
free(this->output.ptr); free(this->output.ptr);
@@ -427,11 +414,9 @@ static eap_tls_t *eap_tls_create(identification_t *server,
.get_msk = _get_msk, .get_msk = _get_msk,
.destroy = _destroy, .destroy = _destroy,
}, },
.peer = peer->clone(peer),
.server = server->clone(server),
.is_server = is_server, .is_server = is_server,
.tls = tls_create(is_server, server, peer),
); );
this->tls = tls_create(is_server, server, peer);
return &this->public; return &this->public;
} }
+16 -2
View File
@@ -73,6 +73,16 @@ struct private_tls_t {
*/ */
bool is_server; bool is_server;
/**
* Server identity
*/
identification_t *server;
/**
* Peer identity
*/
identification_t *peer;
/** /**
* Negotiated TLS version * Negotiated TLS version
*/ */
@@ -148,6 +158,8 @@ METHOD(tls_t, destroy, void,
this->fragmentation->destroy(this->fragmentation); this->fragmentation->destroy(this->fragmentation);
this->crypto->destroy(this->crypto); this->crypto->destroy(this->crypto);
this->handshake->destroy(this->handshake); this->handshake->destroy(this->handshake);
this->peer->destroy(this->peer);
this->server->destroy(this->server);
free(this); free(this);
} }
@@ -172,18 +184,20 @@ tls_t *tls_create(bool is_server, identification_t *server,
}, },
.is_server = is_server, .is_server = is_server,
.version = TLS_1_2, .version = TLS_1_2,
.server = server->clone(server),
.peer = peer->clone(peer),
); );
this->crypto = tls_crypto_create(&this->public); this->crypto = tls_crypto_create(&this->public);
if (is_server) if (is_server)
{ {
this->handshake = &tls_server_create(&this->public, this->crypto, this->handshake = &tls_server_create(&this->public, this->crypto,
server, peer)->handshake; this->server, this->peer)->handshake;
} }
else else
{ {
this->handshake = &tls_peer_create(&this->public, this->crypto, this->handshake = &tls_peer_create(&this->public, this->crypto,
peer, server)->handshake; this->peer, this->server)->handshake;
} }
this->fragmentation = tls_fragmentation_create(this->handshake); this->fragmentation = tls_fragmentation_create(this->handshake);
this->compression = tls_compression_create(this->fragmentation); this->compression = tls_compression_create(this->fragmentation);