summaryrefslogtreecommitdiffstats
path: root/ssl_openssl.c
diff options
context:
space:
mode:
authorAdriaan de Jong <dejong@fox-it.com>2011-06-27 09:44:47 +0200
committerDavid Sommerseth <davids@redhat.com>2011-10-19 22:31:46 +0200
commit397c0a35c5b36c270678c717e931476dc42bfa5c (patch)
treefe7cbe741e6a8ea40e96703f5de85cc07f07d0f3 /ssl_openssl.c
parenteab0cf2df1b1f1f73a657384c0fdb201508c0399 (diff)
downloadopenvpn-397c0a35c5b36c270678c717e931476dc42bfa5c.tar.gz
openvpn-397c0a35c5b36c270678c717e931476dc42bfa5c.tar.xz
openvpn-397c0a35c5b36c270678c717e931476dc42bfa5c.zip
Refactored tls_show_available_ciphers
Signed-off-by: Adriaan de Jong <dejong@fox-it.com> Acked-by: Gert Doering <gert@greenie.muc.de> Acked-by: James Yonan <james@openvpn.net> Signed-off-by: David Sommerseth <davids@redhat.com>
Diffstat (limited to 'ssl_openssl.c')
-rw-r--r--ssl_openssl.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/ssl_openssl.c b/ssl_openssl.c
index eff0bc4..6f6f1b3 100644
--- a/ssl_openssl.c
+++ b/ssl_openssl.c
@@ -74,3 +74,29 @@ tls_clear_error()
{
ERR_clear_error ();
}
+
+void
+show_available_tls_ciphers ()
+{
+ SSL_CTX *ctx;
+ SSL *ssl;
+ const char *cipher_name;
+ int priority = 0;
+
+ ctx = SSL_CTX_new (TLSv1_method ());
+ if (!ctx)
+ msg (M_SSLERR, "Cannot create SSL_CTX object");
+
+ ssl = SSL_new (ctx);
+ if (!ssl)
+ msg (M_SSLERR, "Cannot create SSL object");
+
+ printf ("Available TLS Ciphers,\n");
+ printf ("listed in order of preference:\n\n");
+ while ((cipher_name = SSL_get_cipher_list (ssl, priority++)))
+ printf ("%s\n", cipher_name);
+ printf ("\n");
+
+ SSL_free (ssl);
+ SSL_CTX_free (ctx);
+}