2010-01-25 09:44:35 +00:00
|
|
|
/*
|
|
|
|
* 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;
|
2010-01-25 11:21:57 +00:00
|
|
|
|
2010-01-25 16:31:55 +00:00
|
|
|
/**
|
|
|
|
* TLS stack
|
|
|
|
*/
|
|
|
|
tls_t *tls;
|
|
|
|
|
2010-01-25 11:21:57 +00:00
|
|
|
/**
|
|
|
|
* TLS crypto context
|
|
|
|
*/
|
|
|
|
tls_crypto_t *crypto;
|
2010-02-03 18:53:40 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Server identity
|
|
|
|
*/
|
|
|
|
identification_t *server;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Peer identity
|
|
|
|
*/
|
|
|
|
identification_t *peer;
|
2010-01-25 09:44:35 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
METHOD(tls_handshake_t, process, status_t,
|
2010-02-01 10:25:44 +00:00
|
|
|
private_tls_server_t *this, tls_handshake_type_t type, tls_reader_t *reader)
|
2010-01-25 09:44:35 +00:00
|
|
|
{
|
|
|
|
return NEED_MORE;
|
|
|
|
}
|
|
|
|
|
|
|
|
METHOD(tls_handshake_t, build, status_t,
|
2010-02-01 14:12:18 +00:00
|
|
|
private_tls_server_t *this, tls_handshake_type_t *type, tls_writer_t *writer)
|
2010-01-25 09:44:35 +00:00
|
|
|
{
|
|
|
|
return INVALID_STATE;
|
|
|
|
}
|
|
|
|
|
2010-02-03 18:53:40 +00:00
|
|
|
METHOD(tls_handshake_t, cipherspec_changed, bool,
|
|
|
|
private_tls_server_t *this)
|
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2010-02-05 10:50:29 +00:00
|
|
|
METHOD(tls_handshake_t, change_cipherspec, bool,
|
2010-02-03 18:53:40 +00:00
|
|
|
private_tls_server_t *this)
|
|
|
|
{
|
2010-02-05 10:50:29 +00:00
|
|
|
return FALSE;
|
2010-02-03 18:53:40 +00:00
|
|
|
}
|
|
|
|
|
2010-01-25 09:44:35 +00:00
|
|
|
METHOD(tls_handshake_t, destroy, void,
|
|
|
|
private_tls_server_t *this)
|
|
|
|
{
|
|
|
|
free(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* See header
|
|
|
|
*/
|
2010-02-03 18:53:40 +00:00
|
|
|
tls_server_t *tls_server_create(tls_t *tls, tls_crypto_t *crypto,
|
|
|
|
identification_t *server, identification_t *peer)
|
2010-01-25 09:44:35 +00:00
|
|
|
{
|
|
|
|
private_tls_server_t *this;
|
|
|
|
|
|
|
|
INIT(this,
|
|
|
|
.public.handshake = {
|
|
|
|
.process = _process,
|
|
|
|
.build = _build,
|
2010-02-03 18:53:40 +00:00
|
|
|
.cipherspec_changed = _cipherspec_changed,
|
|
|
|
.change_cipherspec = _change_cipherspec,
|
2010-01-25 09:44:35 +00:00
|
|
|
.destroy = _destroy,
|
|
|
|
},
|
2010-01-25 16:31:55 +00:00
|
|
|
.tls = tls,
|
2010-01-25 11:21:57 +00:00
|
|
|
.crypto = crypto,
|
2010-02-03 18:53:40 +00:00
|
|
|
.server = server,
|
|
|
|
.peer = peer,
|
2010-01-25 09:44:35 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
return &this->public;
|
|
|
|
}
|