Implemented key derivation, output record signing and encryption
[strongswan.git] / src / charon / plugins / eap_tls / tls / tls.c
index 9181eac..8c94e42 100644 (file)
@@ -116,6 +116,12 @@ METHOD(tls_t, build, status_t,
        return this->protection->build(this->protection, type, data);
 }
 
+METHOD(tls_t, is_server, bool,
+       private_tls_t *this)
+{
+       return this->is_server;
+}
+
 METHOD(tls_t, get_version, tls_version_t,
        private_tls_t *this)
 {
@@ -128,6 +134,13 @@ METHOD(tls_t, set_version, void,
        this->version = version;
 }
 
+METHOD(tls_t, change_cipher, void,
+       private_tls_t *this, bool inbound, signer_t *signer,
+       crypter_t *crypter, chunk_t iv)
+{
+       this->protection->set_cipher(this->protection, inbound, signer, crypter, iv);
+}
+
 METHOD(tls_t, destroy, void,
        private_tls_t *this)
 {
@@ -152,8 +165,10 @@ tls_t *tls_create(bool is_server, identification_t *server,
                .public = {
                        .process = _process,
                        .build = _build,
+                       .is_server = _is_server,
                        .get_version = _get_version,
                        .set_version = _set_version,
+                       .change_cipher = _change_cipher,
                        .destroy = _destroy,
                },
                .is_server = is_server,
@@ -173,7 +188,7 @@ tls_t *tls_create(bool is_server, identification_t *server,
        }
        this->fragmentation = tls_fragmentation_create(this->handshake);
        this->compression = tls_compression_create(this->fragmentation);
-       this->protection = tls_protection_create(this->compression);
+       this->protection = tls_protection_create(&this->public, this->compression);
 
        return &this->public;
 }