Added TLS crypto helper, currently supports cipher suite selection
[strongswan.git] / src / charon / plugins / eap_tls / tls / tls_peer.c
1 /*
2 * Copyright (C) 2010 Martin Willi
3 * Copyright (C) 2010 revosec AG
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * for more details.
14 */
15
16 #include "tls_peer.h"
17
18 #include <daemon.h>
19
20 #include <time.h>
21
22 typedef struct private_tls_peer_t private_tls_peer_t;
23
24 /**
25 * Private data of an tls_peer_t object.
26 */
27 struct private_tls_peer_t {
28
29 /**
30 * Public tls_peer_t interface.
31 */
32 tls_peer_t public;
33
34 /**
35 * TLS crypto context
36 */
37 tls_crypto_t *crypto;
38 };
39
40 METHOD(tls_handshake_t, process, status_t,
41 private_tls_peer_t *this, tls_handshake_type_t type, chunk_t data)
42 {
43 return NEED_MORE;
44 }
45
46 METHOD(tls_handshake_t, build, status_t,
47 private_tls_peer_t *this, tls_handshake_type_t *type, chunk_t *data)
48 {
49 return INVALID_STATE;
50 }
51
52 METHOD(tls_handshake_t, destroy, void,
53 private_tls_peer_t *this)
54 {
55 free(this);
56 }
57
58 /**
59 * See header
60 */
61 tls_peer_t *tls_peer_create(tls_crypto_t *crypto)
62 {
63 private_tls_peer_t *this;
64
65 INIT(this,
66 .public.handshake = {
67 .process = _process,
68 .build = _build,
69 .destroy = _destroy,
70 },
71 .crypto = crypto,
72 );
73
74 return &this->public;
75 }