diff options
author | Martin Willi <martin@revosec.ch> | 2014-04-01 14:53:28 +0200 |
---|---|---|
committer | Martin Willi <martin@revosec.ch> | 2014-04-01 14:53:28 +0200 |
commit | b87f7840bc090de5b76328c4c12dfb7e27e73f7e (patch) | |
tree | e50a2bad6ed7edbd0151516ff7220de44c25d6eb /src/libtls/tls_socket.c | |
parent | 96e3142c39a69cfc99fc808f2df3f9d409b05357 (diff) | |
parent | 5ba9f734577321f0445ee38625cdea075d1bb9cf (diff) | |
download | strongswan-b87f7840bc090de5b76328c4c12dfb7e27e73f7e.tar.bz2 strongswan-b87f7840bc090de5b76328c4c12dfb7e27e73f7e.tar.xz |
Merge branch 'tls-unit-tests'
Add some initial unit-tests to libtls, testing all supported cipher suites
against self, both with and without client authentication, for all supported
TLS versions.
Diffstat (limited to 'src/libtls/tls_socket.c')
-rw-r--r-- | src/libtls/tls_socket.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/libtls/tls_socket.c b/src/libtls/tls_socket.c index 19232750b..648771e75 100644 --- a/src/libtls/tls_socket.c +++ b/src/libtls/tls_socket.c @@ -406,9 +406,11 @@ METHOD(tls_socket_t, destroy, void, * See header */ tls_socket_t *tls_socket_create(bool is_server, identification_t *server, - identification_t *peer, int fd, tls_cache_t *cache) + identification_t *peer, int fd, tls_cache_t *cache, + tls_version_t max_version, bool nullok) { private_tls_socket_t *this; + tls_purpose_t purpose; INIT(this, .public = { @@ -430,13 +432,23 @@ tls_socket_t *tls_socket_create(bool is_server, identification_t *server, .fd = fd, ); - this->tls = tls_create(is_server, server, peer, TLS_PURPOSE_GENERIC, + if (nullok) + { + purpose = TLS_PURPOSE_GENERIC_NULLOK; + } + else + { + purpose = TLS_PURPOSE_GENERIC; + } + + this->tls = tls_create(is_server, server, peer, purpose, &this->app.application, cache); if (!this->tls) { free(this); return NULL; } + this->tls->set_version(this->tls, max_version); return &this->public; } |