[exim-cvs] OpenSSL: tidy coding of session keys debug

Top Page
Delete this message
Reply to this message
Author: Exim Git Commits Mailing List
Date:  
To: exim-cvs
Subject: [exim-cvs] OpenSSL: tidy coding of session keys debug
Gitweb: https://git.exim.org/exim.git/commitdiff/10ed27e00c45ff6bf5494f74758541d61dd15880
Commit:     10ed27e00c45ff6bf5494f74758541d61dd15880
Parent:     c19ab167ac8809d33720497a973d0c6c7ea3640d
Author:     Jeremy Harris <jgh146exb@???>
AuthorDate: Wed Apr 3 20:13:22 2019 +0100
Committer:  Jeremy Harris <jgh146exb@???>
CommitDate: Wed Apr 3 20:13:22 2019 +0100


    OpenSSL: tidy coding of session keys debug
---
 src/src/tls-openssl.c | 21 ++++-----------------
 1 file changed, 4 insertions(+), 17 deletions(-)


diff --git a/src/src/tls-openssl.c b/src/src/tls-openssl.c
index 5a5e146..8671e11 100644
--- a/src/src/tls-openssl.c
+++ b/src/src/tls-openssl.c
@@ -2345,12 +2345,8 @@ DEBUG(D_tls)

 #ifdef EXIM_HAVE_OPENSSL_KEYLOG
   {
-  BIO * bp = BIO_new(BIO_s_mem());
-  uschar * s;
-  int len;
+  BIO * bp = BIO_new_fp(debug_file, BIO_NOCLOSE);
   SSL_SESSION_print_keylog(bp, SSL_get_session(server_ssl));
-  len = (int) BIO_get_mem_data(bp, CSS &s);
-  debug_printf("%.*s", len, s);
   BIO_free(bp);
   }
 #endif
@@ -2724,18 +2720,9 @@ DEBUG(D_tls)
   debug_printf("SSL_connect succeeded\n");
 #ifdef EXIM_HAVE_OPENSSL_KEYLOG
   {
-  BIO * bp = BIO_new(BIO_s_mem());
-  if (bp)
-    {
-    uschar * s;
-    int len;
-    SSL_SESSION_print_keylog(bp, SSL_get_session(exim_client_ctx->ssl));
-    len = (int) BIO_get_mem_data(bp, CSS &s);
-    debug_printf("%.*s", len, s);
-    BIO_free(bp);
-    }
-  else
-    debug_printf("(alloc failure for keylog)\n");
+  BIO * bp = BIO_new_fp(debug_file, BIO_NOCLOSE);
+  SSL_SESSION_print_keylog(bp, SSL_get_session(exim_client_ctx->ssl));
+  BIO_free(bp);
   }
 #endif
   }