diff options
author | Andreas Kotes <count@flatline.de> | 2014-04-15 13:05:21 +0200 |
---|---|---|
committer | Andreas Kotes <count@flatline.de> | 2014-04-15 13:05:21 +0200 |
commit | 19375e6c61bfe3bf643786b0e7318c528e4b22a0 (patch) | |
tree | 6a7335d5fea6b36c75d922959b1404ff36fbbc97 | |
parent | 41ffa33b09d9bcf0902c3ef9384011c95f72ccbe (diff) |
show cipher being used
-rwxr-xr-x | vchat-ssl.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/vchat-ssl.c b/vchat-ssl.c index 7f0395b..2b41432 100755 --- a/vchat-ssl.c +++ b/vchat-ssl.c | |||
@@ -136,8 +136,24 @@ int vc_connect_ssl( BIO **conn, vc_x509store_t *vc_store ) | |||
136 | BIO_push( ssl_conn, *conn ); | 136 | BIO_push( ssl_conn, *conn ); |
137 | *conn = ssl_conn; | 137 | *conn = ssl_conn; |
138 | fflush(stdout); | 138 | fflush(stdout); |
139 | if( BIO_do_handshake( *conn ) > 0 ) | 139 | if( BIO_do_handshake( *conn ) > 0 ) { |
140 | /* Show information about cipher used */ | ||
141 | const SSL *sslp = NULL; | ||
142 | const SSL_CIPHER * cipher = NULL; | ||
143 | |||
144 | /* Get cipher object */ | ||
145 | BIO_get_ssl(ssl_conn, &sslp); | ||
146 | cipher = SSL_get_current_cipher(sslp); | ||
147 | if (cipher) { | ||
148 | char cipher_desc[TMPSTRSIZE]; | ||
149 | snprintf(tmpstr, TMPSTRSIZE, "[SSL CIPHER] %s", SSL_CIPHER_description(cipher, cipher_desc, TMPSTRSIZE)); | ||
150 | writecf(FS_SERV, tmpstr); | ||
151 | } else { | ||
152 | snprintf(tmpstr, TMPSTRSIZE, "[SSL ERROR] Cipher not known / SSL object can't be queried!"); | ||
153 | writecf(FS_ERR, tmpstr); | ||
154 | } | ||
140 | return 0; | 155 | return 0; |
156 | } | ||
141 | } | 157 | } |
142 | 158 | ||
143 | snprintf(tmpstr, TMPSTRSIZE, "[SSL ERROR] %s", ERR_error_string (ERR_get_error (), NULL)); | 159 | snprintf(tmpstr, TMPSTRSIZE, "[SSL ERROR] %s", ERR_error_string (ERR_get_error (), NULL)); |