summaryrefslogtreecommitdiffstats
path: root/ssl_openssl.c
diff options
context:
space:
mode:
Diffstat (limited to 'ssl_openssl.c')
-rw-r--r--ssl_openssl.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/ssl_openssl.c b/ssl_openssl.c
index 6f6f1b3..c80dfb1 100644
--- a/ssl_openssl.c
+++ b/ssl_openssl.c
@@ -100,3 +100,24 @@ show_available_tls_ciphers ()
SSL_free (ssl);
SSL_CTX_free (ctx);
}
+
+void
+get_highest_preference_tls_cipher (char *buf, int size)
+{
+ SSL_CTX *ctx;
+ SSL *ssl;
+ const char *cipher_name;
+
+ 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");
+
+ cipher_name = SSL_get_cipher_list (ssl, 0);
+ strncpynt (buf, cipher_name, size);
+
+ SSL_free (ssl);
+ SSL_CTX_free (ctx);
+}