libpurple/plugins/ssl/ssl-nss.c

branch
soc.2013.gobjectification.plugins
changeset 37074
1e7b4b3741a0
parent 36972
dfe5c47d56a9
parent 35372
2426c4660669
child 37127
50a4881a4041
equal deleted inserted replaced
37073:baf45dc13ffd 37074:1e7b4b3741a0
264 CERT_DestroyCertificate(curcert); 264 CERT_DestroyCertificate(curcert);
265 265
266 return peer_certs; 266 return peer_certs;
267 } 267 }
268 268
269 /*
270 * Ideally this information would be exposed to the UI somehow, but for now we
271 * just print it to the debug log
272 */
273 static void
274 printSecurityInfo(PRFileDesc *fd)
275 {
276 SECStatus result;
277 SSLChannelInfo channel;
278 SSLCipherSuiteInfo suite;
279
280 result = SSL_GetChannelInfo(fd, &channel, sizeof channel);
281 if (result == SECSuccess && channel.length == sizeof channel
282 && channel.cipherSuite) {
283 result = SSL_GetCipherSuiteInfo(channel.cipherSuite,
284 &suite, sizeof suite);
285
286 if (result == SECSuccess) {
287 purple_debug_info("nss", "SSL version %d.%d using "
288 "%d-bit %s with %d-bit %s MAC\n"
289 "Server Auth: %d-bit %s, "
290 "Key Exchange: %d-bit %s, "
291 "Compression: %s\n"
292 "Cipher Suite Name: %s\n",
293 channel.protocolVersion >> 8,
294 channel.protocolVersion & 0xff,
295 suite.effectiveKeyBits,
296 suite.symCipherName,
297 suite.macBits,
298 suite.macAlgorithmName,
299 channel.authKeyBits,
300 suite.authAlgorithmName,
301 channel.keaKeyBits, suite.keaTypeName,
302 channel.compressionMethodName,
303 suite.cipherSuiteName);
304 }
305 }
306 }
307
308
269 static void 309 static void
270 ssl_nss_handshake_cb(gpointer data, int fd, PurpleInputCondition cond) 310 ssl_nss_handshake_cb(gpointer data, int fd, PurpleInputCondition cond)
271 { 311 {
272 PurpleSslConnection *gsc = (PurpleSslConnection *)data; 312 PurpleSslConnection *gsc = (PurpleSslConnection *)data;
273 PurpleSslNssData *nss_data = gsc->private_data; 313 PurpleSslNssData *nss_data = gsc->private_data;
290 330
291 purple_ssl_close(gsc); 331 purple_ssl_close(gsc);
292 332
293 return; 333 return;
294 } 334 }
335
336 printSecurityInfo(nss_data->in);
295 337
296 purple_input_remove(nss_data->handshake_handler); 338 purple_input_remove(nss_data->handshake_handler);
297 nss_data->handshake_handler = 0; 339 nss_data->handshake_handler = 0;
298 340
299 /* If a Verifier was given, hand control over to it */ 341 /* If a Verifier was given, hand control over to it */

mercurial