]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
Refactored get_highest_preference_tls_cipher
authorAdriaan de Jong <dejong@fox-it.com>
Mon, 27 Jun 2011 07:52:59 +0000 (09:52 +0200)
committerDavid Sommerseth <davids@redhat.com>
Wed, 19 Oct 2011 20:31:46 +0000 (22:31 +0200)
Signed-off-by: Adriaan de Jong <dejong@fox-it.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Signed-off-by: David Sommerseth <davids@redhat.com>
ssl.c
ssl.h
ssl_backend.h
ssl_openssl.c

diff --git a/ssl.c b/ssl.c
index 2935088aa0ab88e1b499e01442657e462e17a7b8..e94342f97dd9cfd6e4627cff30948781053a8cce 100644 (file)
--- a/ssl.c
+++ b/ssl.c
@@ -2449,32 +2449,6 @@ print_details (SSL * c_ssl, const char *prefix)
   msg (D_HANDSHAKE, "%s%s", s1, s2);
 }
 
-/*
- * The OpenSSL library has a notion of preference in TLS
- * ciphers.  Higher preference == more secure.
- * Return the highest preference cipher.
- */
-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);
-}
-
 /*
  * Map internal constants to ascii names.
  */
diff --git a/ssl.h b/ssl.h
index 2ff4c4d8b23403377c102a587eccc4287e501180..c23a94600a5e794040132b6702026151cbfcd055 100644 (file)
--- a/ssl.h
+++ b/ssl.h
@@ -824,8 +824,6 @@ void tls_post_encrypt (struct tls_multi *multi, struct buffer *buf);
 
 /** @} name Functions for managing security parameter state for data channel packets */
 
-void get_highest_preference_tls_cipher (char *buf, int size);
-
 void pem_password_setup (const char *auth_file);
 int pem_password_callback (char *buf, int size, int rwflag, void *u);
 void auth_user_pass_setup (const char *auth_file, const struct static_challenge_info *sc_info);
index 336e9238a7dd0d0dd409be50466552b388b11914..103eea44caec46c3cc2e929935662a9ac2751ee2 100644 (file)
@@ -70,4 +70,10 @@ void tls_clear_error();
  */
 void show_available_tls_ciphers ();
 
+/*
+ * The OpenSSL library has a notion of preference in TLS ciphers.  Higher
+ * preference == more secure. Return the highest preference cipher.
+ */
+void get_highest_preference_tls_cipher (char *buf, int size);
+
 #endif /* SSL_BACKEND_H_ */
index 6f6f1b3f7a741f713eabdf2573178ee946d15dc8..c80dfb13ea0c557341688b125818c8d8cc7ad202 100644 (file)
@@ -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);
+}