tls: Support a null encryption flag on TLS socket abstraction

This commit is contained in:
Martin Willi
2014-04-01 14:28:55 +02:00
parent ddf5222096
commit 5313880261
5 changed files with 21 additions and 7 deletions
+13 -2
View File
@@ -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,
bool nullok)
{
private_tls_socket_t *this;
tls_purpose_t purpose;
INIT(this,
.public = {
@@ -430,7 +432,16 @@ 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)
{