summaryrefslogtreecommitdiff
path: root/lib/tls.c
diff options
context:
space:
mode:
authorLinus Nordberg <linus@nordu.net>2012-04-23 14:44:49 +0200
committerLinus Nordberg <linus@nordu.net>2012-04-23 14:44:49 +0200
commitdcce5a04612c307453519d72f28caceb73fdab2a (patch)
treebb872e0fa9fe87556558b1dbfaf528fb10bc485b /lib/tls.c
parent4d61fddb4f7e895b8814e7d18e0276498dca9bdb (diff)
Conditionally compile TLS-PSK code (--enable-tls-psk).
Also, allow for PSK-only configuration, i.e. don't barf on missing cert stuff.
Diffstat (limited to 'lib/tls.c')
-rw-r--r--lib/tls.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/tls.c b/lib/tls.c
index 12af489..0f07e46 100644
--- a/lib/tls.c
+++ b/lib/tls.c
@@ -42,6 +42,7 @@ _get_tlsconf (struct rs_connection *conn, const struct rs_realm *realm)
return c;
}
+#if defined RS_ENABLE_TLS_PSK
static unsigned int
psk_client_cb (SSL *ssl,
const char *hint,
@@ -107,6 +108,7 @@ psk_client_cb (SSL *ssl,
return cred->secret_len;
}
+#endif /* RS_ENABLE_TLS_PSK */
int
rs_tls_init (struct rs_connection *conn)
@@ -140,11 +142,14 @@ rs_tls_init (struct rs_connection *conn)
return -1;
}
+#if defined RS_ENABLE_TLS_PSK
if (conn->active_peer->realm->transport_cred != NULL)
{
SSL_set_psk_client_callback (ssl, psk_client_cb);
SSL_set_ex_data (ssl, 0, conn);
}
+#endif /* RS_ENABLE_TLS_PSK */
+
conn->tls_ctx = ssl_ctx;
conn->tls_ssl = ssl;
rs_free (ctx, tlsconf);