strongswan/src/charon/plugins/eap_tls/tls/tls_server.c

108 lines
2.1 KiB
C
Raw Normal View History

/*
* Copyright (C) 2010 Martin Willi
* Copyright (C) 2010 revosec AG
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
#include "tls_server.h"
#include <daemon.h>
typedef struct private_tls_server_t private_tls_server_t;
/**
* Private data of an tls_server_t object.
*/
struct private_tls_server_t {
/**
* Public tls_server_t interface.
*/
tls_server_t public;
/**
* TLS stack
*/
tls_t *tls;
/**
* TLS crypto context
*/
tls_crypto_t *crypto;
/**
* Server identity
*/
identification_t *server;
/**
* Peer identity
*/
identification_t *peer;
};
METHOD(tls_handshake_t, process, status_t,
private_tls_server_t *this, tls_handshake_type_t type, tls_reader_t *reader)
{
return NEED_MORE;
}
METHOD(tls_handshake_t, build, status_t,
private_tls_server_t *this, tls_handshake_type_t *type, tls_writer_t *writer)
{
return INVALID_STATE;
}
METHOD(tls_handshake_t, cipherspec_changed, bool,
private_tls_server_t *this)
{
return FALSE;
}
METHOD(tls_handshake_t, change_cipherspec, bool,
private_tls_server_t *this)
{
return FALSE;
}
METHOD(tls_handshake_t, destroy, void,
private_tls_server_t *this)
{
free(this);
}
/**
* See header
*/
tls_server_t *tls_server_create(tls_t *tls, tls_crypto_t *crypto,
identification_t *server, identification_t *peer)
{
private_tls_server_t *this;
INIT(this,
.public.handshake = {
.process = _process,
.build = _build,
.cipherspec_changed = _cipherspec_changed,
.change_cipherspec = _change_cipherspec,
.destroy = _destroy,
},
.tls = tls,
.crypto = crypto,
.server = server,
.peer = peer,
);
return &this->public;
}