diff options
author | inoguchi <> | 2020-07-09 14:09:19 +0000 |
---|---|---|
committer | inoguchi <> | 2020-07-09 14:09:19 +0000 |
commit | 9f62c01603de59e89100980038e33c8d1d5d427d (patch) | |
tree | 11ece8d004e6a81e78378a83a98bab76cb29b0a8 | |
parent | db4079b0b7d40177248cf368364f8478d4f76b95 (diff) | |
download | openbsd-9f62c01603de59e89100980038e33c8d1d5d427d.tar.gz openbsd-9f62c01603de59e89100980038e33c8d1d5d427d.tar.bz2 openbsd-9f62c01603de59e89100980038e33c8d1d5d427d.zip |
Wrap long lines and put space in front of label in s_client.c
-rw-r--r-- | src/usr.bin/openssl/s_client.c | 126 |
1 files changed, 80 insertions, 46 deletions
diff --git a/src/usr.bin/openssl/s_client.c b/src/usr.bin/openssl/s_client.c index 98cab18489..c32c3c3987 100644 --- a/src/usr.bin/openssl/s_client.c +++ b/src/usr.bin/openssl/s_client.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: s_client.c,v 1.48 2020/07/09 13:07:46 inoguchi Exp $ */ | 1 | /* $OpenBSD: s_client.c,v 1.49 2020/07/09 14:09:19 inoguchi Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -840,14 +840,12 @@ sc_usage(void) | |||
840 | fprintf(stderr, "\n"); | 840 | fprintf(stderr, "\n"); |
841 | } | 841 | } |
842 | 842 | ||
843 | |||
844 | /* This is a context that we pass to callbacks */ | 843 | /* This is a context that we pass to callbacks */ |
845 | typedef struct tlsextctx_st { | 844 | typedef struct tlsextctx_st { |
846 | BIO *biodebug; | 845 | BIO *biodebug; |
847 | int ack; | 846 | int ack; |
848 | } tlsextctx; | 847 | } tlsextctx; |
849 | 848 | ||
850 | |||
851 | static int | 849 | static int |
852 | ssl_servername_cb(SSL * s, int *ad, void *arg) | 850 | ssl_servername_cb(SSL * s, int *ad, void *arg) |
853 | { | 851 | { |
@@ -918,12 +916,14 @@ s_client_main(int argc, char **argv) | |||
918 | goto bad; | 916 | goto bad; |
919 | } | 917 | } |
920 | if (s_client_config.proxy != NULL) { | 918 | if (s_client_config.proxy != NULL) { |
921 | if (!extract_host_port(s_client_config.proxy, &s_client_config.host, NULL, &s_client_config.port)) | 919 | if (!extract_host_port(s_client_config.proxy, |
920 | &s_client_config.host, NULL, &s_client_config.port)) | ||
922 | goto bad; | 921 | goto bad; |
923 | if (s_client_config.connect == NULL) | 922 | if (s_client_config.connect == NULL) |
924 | s_client_config.connect = SSL_HOST_NAME; | 923 | s_client_config.connect = SSL_HOST_NAME; |
925 | } else if (s_client_config.connect != NULL) { | 924 | } else if (s_client_config.connect != NULL) { |
926 | if (!extract_host_port(s_client_config.connect, &s_client_config.host, NULL, &s_client_config.port)) | 925 | if (!extract_host_port(s_client_config.connect, |
926 | &s_client_config.host, NULL, &s_client_config.port)) | ||
927 | goto bad; | 927 | goto bad; |
928 | } | 928 | } |
929 | if (badop) { | 929 | if (badop) { |
@@ -943,7 +943,8 @@ s_client_main(int argc, char **argv) | |||
943 | 943 | ||
944 | if (s_client_config.key_file) { | 944 | if (s_client_config.key_file) { |
945 | 945 | ||
946 | key = load_key(bio_err, s_client_config.key_file, s_client_config.key_format, 0, pass, | 946 | key = load_key(bio_err, s_client_config.key_file, |
947 | s_client_config.key_format, 0, pass, | ||
947 | "client certificate private key file"); | 948 | "client certificate private key file"); |
948 | if (!key) { | 949 | if (!key) { |
949 | ERR_print_errors(bio_err); | 950 | ERR_print_errors(bio_err); |
@@ -951,7 +952,8 @@ s_client_main(int argc, char **argv) | |||
951 | } | 952 | } |
952 | } | 953 | } |
953 | if (s_client_config.cert_file) { | 954 | if (s_client_config.cert_file) { |
954 | cert = load_cert(bio_err, s_client_config.cert_file, s_client_config.cert_format, | 955 | cert = load_cert(bio_err, s_client_config.cert_file, |
956 | s_client_config.cert_format, | ||
955 | NULL, "client certificate file"); | 957 | NULL, "client certificate file"); |
956 | 958 | ||
957 | if (!cert) { | 959 | if (!cert) { |
@@ -960,7 +962,8 @@ s_client_main(int argc, char **argv) | |||
960 | } | 962 | } |
961 | } | 963 | } |
962 | if (bio_c_out == NULL) { | 964 | if (bio_c_out == NULL) { |
963 | if (s_client_config.quiet && !s_client_config.debug && !s_client_config.msg) { | 965 | if (s_client_config.quiet && !s_client_config.debug && |
966 | !s_client_config.msg) { | ||
964 | bio_c_out = BIO_new(BIO_s_null()); | 967 | bio_c_out = BIO_new(BIO_s_null()); |
965 | } else { | 968 | } else { |
966 | if (bio_c_out == NULL) | 969 | if (bio_c_out == NULL) |
@@ -1004,8 +1007,9 @@ s_client_main(int argc, char **argv) | |||
1004 | 1007 | ||
1005 | if (s_client_config.alpn_in) { | 1008 | if (s_client_config.alpn_in) { |
1006 | unsigned short alpn_len; | 1009 | unsigned short alpn_len; |
1007 | unsigned char *alpn = next_protos_parse(&alpn_len, s_client_config.alpn_in); | 1010 | unsigned char *alpn; |
1008 | 1011 | ||
1012 | alpn = next_protos_parse(&alpn_len, s_client_config.alpn_in); | ||
1009 | if (alpn == NULL) { | 1013 | if (alpn == NULL) { |
1010 | BIO_printf(bio_err, "Error parsing -alpn argument\n"); | 1014 | BIO_printf(bio_err, "Error parsing -alpn argument\n"); |
1011 | goto end; | 1015 | goto end; |
@@ -1035,7 +1039,8 @@ s_client_main(int argc, char **argv) | |||
1035 | goto end; | 1039 | goto end; |
1036 | 1040 | ||
1037 | if ((s_client_config.CAfile || s_client_config.CApath) | 1041 | if ((s_client_config.CAfile || s_client_config.CApath) |
1038 | && !SSL_CTX_load_verify_locations(ctx, s_client_config.CAfile, s_client_config.CApath)) | 1042 | && !SSL_CTX_load_verify_locations(ctx, s_client_config.CAfile, |
1043 | s_client_config.CApath)) | ||
1039 | ERR_print_errors(bio_err); | 1044 | ERR_print_errors(bio_err); |
1040 | 1045 | ||
1041 | if (!SSL_CTX_set_default_verify_paths(ctx)) | 1046 | if (!SSL_CTX_set_default_verify_paths(ctx)) |
@@ -1070,16 +1075,18 @@ s_client_main(int argc, char **argv) | |||
1070 | } | 1075 | } |
1071 | if (s_client_config.servername != NULL) { | 1076 | if (s_client_config.servername != NULL) { |
1072 | if (!SSL_set_tlsext_host_name(con, s_client_config.servername)) { | 1077 | if (!SSL_set_tlsext_host_name(con, s_client_config.servername)) { |
1073 | BIO_printf(bio_err, "Unable to set TLS servername extension.\n"); | 1078 | BIO_printf(bio_err, |
1079 | "Unable to set TLS servername extension.\n"); | ||
1074 | ERR_print_errors(bio_err); | 1080 | ERR_print_errors(bio_err); |
1075 | goto end; | 1081 | goto end; |
1076 | } | 1082 | } |
1077 | } | 1083 | } |
1078 | /* SSL_set_cipher_list(con,"RC4-MD5"); */ | 1084 | /* SSL_set_cipher_list(con,"RC4-MD5"); */ |
1079 | 1085 | ||
1080 | re_start: | 1086 | re_start: |
1081 | 1087 | ||
1082 | if (init_client(&s, s_client_config.host, s_client_config.port, s_client_config.socket_type, s_client_config.af) == 0) { | 1088 | if (init_client(&s, s_client_config.host, s_client_config.port, |
1089 | s_client_config.socket_type, s_client_config.af) == 0) { | ||
1083 | BIO_printf(bio_err, "connect:errno=%d\n", errno); | 1090 | BIO_printf(bio_err, "connect:errno=%d\n", errno); |
1084 | goto end; | 1091 | goto end; |
1085 | } | 1092 | } |
@@ -1112,11 +1119,13 @@ re_start: | |||
1112 | if (s_client_config.enable_timeouts) { | 1119 | if (s_client_config.enable_timeouts) { |
1113 | timeout.tv_sec = 0; | 1120 | timeout.tv_sec = 0; |
1114 | timeout.tv_usec = DGRAM_RCV_TIMEOUT; | 1121 | timeout.tv_usec = DGRAM_RCV_TIMEOUT; |
1115 | BIO_ctrl(sbio, BIO_CTRL_DGRAM_SET_RECV_TIMEOUT, 0, &timeout); | 1122 | BIO_ctrl(sbio, BIO_CTRL_DGRAM_SET_RECV_TIMEOUT, 0, |
1123 | &timeout); | ||
1116 | 1124 | ||
1117 | timeout.tv_sec = 0; | 1125 | timeout.tv_sec = 0; |
1118 | timeout.tv_usec = DGRAM_SND_TIMEOUT; | 1126 | timeout.tv_usec = DGRAM_SND_TIMEOUT; |
1119 | BIO_ctrl(sbio, BIO_CTRL_DGRAM_SET_SEND_TIMEOUT, 0, &timeout); | 1127 | BIO_ctrl(sbio, BIO_CTRL_DGRAM_SET_SEND_TIMEOUT, 0, |
1128 | &timeout); | ||
1120 | } | 1129 | } |
1121 | if (s_client_config.socket_mtu > 28) { | 1130 | if (s_client_config.socket_mtu > 28) { |
1122 | SSL_set_options(con, SSL_OP_NO_QUERY_MTU); | 1131 | SSL_set_options(con, SSL_OP_NO_QUERY_MTU); |
@@ -1177,7 +1186,8 @@ re_start: | |||
1177 | * push a buffering BIO into the chain that is removed again later on | 1186 | * push a buffering BIO into the chain that is removed again later on |
1178 | * to not disturb the rest of the s_client operation. | 1187 | * to not disturb the rest of the s_client operation. |
1179 | */ | 1188 | */ |
1180 | if (s_client_config.starttls_proto == PROTO_SMTP || s_client_config.starttls_proto == PROTO_LMTP) { | 1189 | if (s_client_config.starttls_proto == PROTO_SMTP || |
1190 | s_client_config.starttls_proto == PROTO_LMTP) { | ||
1181 | int foundit = 0; | 1191 | int foundit = 0; |
1182 | BIO *fbio = BIO_new(BIO_f_buffer()); | 1192 | BIO *fbio = BIO_new(BIO_f_buffer()); |
1183 | BIO_push(fbio, sbio); | 1193 | BIO_push(fbio, sbio); |
@@ -1188,7 +1198,7 @@ re_start: | |||
1188 | while (mbuf_len > 3 && mbuf[3] == '-'); | 1198 | while (mbuf_len > 3 && mbuf[3] == '-'); |
1189 | /* STARTTLS command requires EHLO... */ | 1199 | /* STARTTLS command requires EHLO... */ |
1190 | BIO_printf(fbio, "%cHLO openssl.client.net\r\n", | 1200 | BIO_printf(fbio, "%cHLO openssl.client.net\r\n", |
1191 | s_client_config.starttls_proto == PROTO_SMTP ? 'E' : 'L'); | 1201 | s_client_config.starttls_proto == PROTO_SMTP ? 'E' : 'L'); |
1192 | (void) BIO_flush(fbio); | 1202 | (void) BIO_flush(fbio); |
1193 | /* wait for multi-line response to end EHLO SMTP response */ | 1203 | /* wait for multi-line response to end EHLO SMTP response */ |
1194 | do { | 1204 | do { |
@@ -1255,7 +1265,9 @@ re_start: | |||
1255 | int seen = 0; | 1265 | int seen = 0; |
1256 | BIO_printf(sbio, "<stream:stream " | 1266 | BIO_printf(sbio, "<stream:stream " |
1257 | "xmlns:stream='http://etherx.jabber.org/streams' " | 1267 | "xmlns:stream='http://etherx.jabber.org/streams' " |
1258 | "xmlns='jabber:client' to='%s' version='1.0'>", s_client_config.xmpphost ? s_client_config.xmpphost : s_client_config.host); | 1268 | "xmlns='jabber:client' to='%s' version='1.0'>", |
1269 | s_client_config.xmpphost ? | ||
1270 | s_client_config.xmpphost : s_client_config.host); | ||
1259 | seen = BIO_read(sbio, mbuf, BUFSIZZ); | 1271 | seen = BIO_read(sbio, mbuf, BUFSIZZ); |
1260 | 1272 | ||
1261 | if (seen <= 0) | 1273 | if (seen <= 0) |
@@ -1271,14 +1283,16 @@ re_start: | |||
1271 | 1283 | ||
1272 | mbuf[seen] = 0; | 1284 | mbuf[seen] = 0; |
1273 | } | 1285 | } |
1274 | BIO_printf(sbio, "<starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>"); | 1286 | BIO_printf(sbio, |
1287 | "<starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>"); | ||
1275 | seen = BIO_read(sbio, sbuf, BUFSIZZ); | 1288 | seen = BIO_read(sbio, sbuf, BUFSIZZ); |
1276 | sbuf[seen] = 0; | 1289 | sbuf[seen] = 0; |
1277 | if (!strstr(sbuf, "<proceed")) | 1290 | if (!strstr(sbuf, "<proceed")) |
1278 | goto shut; | 1291 | goto shut; |
1279 | mbuf[0] = 0; | 1292 | mbuf[0] = 0; |
1280 | } else if (s_client_config.proxy != NULL) { | 1293 | } else if (s_client_config.proxy != NULL) { |
1281 | BIO_printf(sbio, "CONNECT %s HTTP/1.0\r\n\r\n", s_client_config.connect); | 1294 | BIO_printf(sbio, "CONNECT %s HTTP/1.0\r\n\r\n", |
1295 | s_client_config.connect); | ||
1282 | mbuf_len = BIO_read(sbio, mbuf, BUFSIZZ); | 1296 | mbuf_len = BIO_read(sbio, mbuf, BUFSIZZ); |
1283 | if (mbuf_len == -1) { | 1297 | if (mbuf_len == -1) { |
1284 | BIO_printf(bio_err, "BIO_read failed\n"); | 1298 | BIO_printf(bio_err, "BIO_read failed\n"); |
@@ -1291,7 +1305,8 @@ re_start: | |||
1291 | 1305 | ||
1292 | if ((SSL_version(con) == DTLS1_VERSION) && | 1306 | if ((SSL_version(con) == DTLS1_VERSION) && |
1293 | DTLSv1_get_timeout(con, &timeout)) | 1307 | DTLSv1_get_timeout(con, &timeout)) |
1294 | ptimeout = timeout.tv_sec * 1000 + timeout.tv_usec / 1000; | 1308 | ptimeout = timeout.tv_sec * 1000 + |
1309 | timeout.tv_usec / 1000; | ||
1295 | 1310 | ||
1296 | if (SSL_in_init(con) && !SSL_total_renegotiations(con)) { | 1311 | if (SSL_in_init(con) && !SSL_total_renegotiations(con)) { |
1297 | in_init = 1; | 1312 | in_init = 1; |
@@ -1301,12 +1316,16 @@ re_start: | |||
1301 | if (in_init) { | 1316 | if (in_init) { |
1302 | in_init = 0; | 1317 | in_init = 0; |
1303 | if (s_client_config.sess_out) { | 1318 | if (s_client_config.sess_out) { |
1304 | BIO *stmp = BIO_new_file(s_client_config.sess_out, "w"); | 1319 | BIO *stmp = BIO_new_file( |
1320 | s_client_config.sess_out, "w"); | ||
1305 | if (stmp) { | 1321 | if (stmp) { |
1306 | PEM_write_bio_SSL_SESSION(stmp, SSL_get_session(con)); | 1322 | PEM_write_bio_SSL_SESSION(stmp, |
1323 | SSL_get_session(con)); | ||
1307 | BIO_free(stmp); | 1324 | BIO_free(stmp); |
1308 | } else | 1325 | } else |
1309 | BIO_printf(bio_err, "Error writing session file %s\n", s_client_config.sess_out); | 1326 | BIO_printf(bio_err, |
1327 | "Error writing session file %s\n", | ||
1328 | s_client_config.sess_out); | ||
1310 | } | 1329 | } |
1311 | print_stuff(bio_c_out, con, full_log); | 1330 | print_stuff(bio_c_out, con, full_log); |
1312 | if (full_log > 0) | 1331 | if (full_log > 0) |
@@ -1319,7 +1338,8 @@ re_start: | |||
1319 | } | 1338 | } |
1320 | if (s_client_config.reconnect) { | 1339 | if (s_client_config.reconnect) { |
1321 | s_client_config.reconnect--; | 1340 | s_client_config.reconnect--; |
1322 | BIO_printf(bio_c_out, "drop connection and then reconnect\n"); | 1341 | BIO_printf(bio_c_out, |
1342 | "drop connection and then reconnect\n"); | ||
1323 | SSL_shutdown(con); | 1343 | SSL_shutdown(con); |
1324 | SSL_set_connect_state(con); | 1344 | SSL_set_connect_state(con); |
1325 | shutdown(SSL_get_fd(con), SHUT_RD); | 1345 | shutdown(SSL_get_fd(con), SHUT_RD); |
@@ -1363,10 +1383,12 @@ re_start: | |||
1363 | /* goto end; */ | 1383 | /* goto end; */ |
1364 | } | 1384 | } |
1365 | } | 1385 | } |
1366 | if ((SSL_version(con) == DTLS1_VERSION) && DTLSv1_handle_timeout(con) > 0) { | 1386 | if ((SSL_version(con) == DTLS1_VERSION) && |
1387 | DTLSv1_handle_timeout(con) > 0) { | ||
1367 | BIO_printf(bio_err, "TIMEOUT occured\n"); | 1388 | BIO_printf(bio_err, "TIMEOUT occured\n"); |
1368 | } | 1389 | } |
1369 | if (!ssl_pending && (pfd[2].revents & (POLLOUT|POLLERR|POLLNVAL))) { | 1390 | if (!ssl_pending && |
1391 | (pfd[2].revents & (POLLOUT|POLLERR|POLLNVAL))) { | ||
1370 | if (pfd[2].revents & (POLLERR|POLLNVAL)) { | 1392 | if (pfd[2].revents & (POLLERR|POLLNVAL)) { |
1371 | BIO_printf(bio_err, "poll error"); | 1393 | BIO_printf(bio_err, "poll error"); |
1372 | goto shut; | 1394 | goto shut; |
@@ -1482,7 +1504,8 @@ re_start: | |||
1482 | if (p != pending) { | 1504 | if (p != pending) { |
1483 | ret = -1; | 1505 | ret = -1; |
1484 | BIO_printf(bio_err, | 1506 | BIO_printf(bio_err, |
1485 | "peeked %d but pending %d!\n", p, pending); | 1507 | "peeked %d but pending %d!\n", |
1508 | p, pending); | ||
1486 | goto shut; | 1509 | goto shut; |
1487 | } | 1510 | } |
1488 | if (k < p) { | 1511 | if (k < p) { |
@@ -1491,7 +1514,8 @@ re_start: | |||
1491 | "read less than peek!\n"); | 1514 | "read less than peek!\n"); |
1492 | goto shut; | 1515 | goto shut; |
1493 | } | 1516 | } |
1494 | if (p > 0 && (memcmp(sbuf, pbuf, p) != 0)) { | 1517 | if (p > 0 && |
1518 | (memcmp(sbuf, pbuf, p) != 0)) { | ||
1495 | ret = -1; | 1519 | ret = -1; |
1496 | BIO_printf(bio_err, | 1520 | BIO_printf(bio_err, |
1497 | "peek of %d different from read of %d!\n", | 1521 | "peek of %d different from read of %d!\n", |
@@ -1556,7 +1580,8 @@ re_start: | |||
1556 | } else | 1580 | } else |
1557 | i = read(fileno(stdin), cbuf, BUFSIZZ); | 1581 | i = read(fileno(stdin), cbuf, BUFSIZZ); |
1558 | 1582 | ||
1559 | if ((!s_client_config.ign_eof) && ((i <= 0) || (cbuf[0] == 'Q'))) { | 1583 | if ((!s_client_config.ign_eof) && |
1584 | ((i <= 0) || (cbuf[0] == 'Q'))) { | ||
1560 | BIO_printf(bio_err, "DONE\n"); | 1585 | BIO_printf(bio_err, "DONE\n"); |
1561 | ret = 0; | 1586 | ret = 0; |
1562 | goto shut; | 1587 | goto shut; |
@@ -1604,7 +1629,6 @@ re_start: | |||
1604 | return (ret); | 1629 | return (ret); |
1605 | } | 1630 | } |
1606 | 1631 | ||
1607 | |||
1608 | static void | 1632 | static void |
1609 | print_stuff(BIO * bio, SSL * s, int full) | 1633 | print_stuff(BIO * bio, SSL * s, int full) |
1610 | { | 1634 | { |
@@ -1636,17 +1660,18 @@ print_stuff(BIO * bio, SSL * s, int full) | |||
1636 | sk_X509_value(sk, i)), buf, sizeof buf); | 1660 | sk_X509_value(sk, i)), buf, sizeof buf); |
1637 | BIO_printf(bio, " i:%s\n", buf); | 1661 | BIO_printf(bio, " i:%s\n", buf); |
1638 | if (s_client_config.showcerts) | 1662 | if (s_client_config.showcerts) |
1639 | PEM_write_bio_X509(bio, sk_X509_value(sk, i)); | 1663 | PEM_write_bio_X509(bio, |
1664 | sk_X509_value(sk, i)); | ||
1640 | } | 1665 | } |
1641 | } | 1666 | } |
1642 | BIO_printf(bio, "---\n"); | 1667 | BIO_printf(bio, "---\n"); |
1643 | peer = SSL_get_peer_certificate(s); | 1668 | peer = SSL_get_peer_certificate(s); |
1644 | if (peer != NULL) { | 1669 | if (peer != NULL) { |
1645 | BIO_printf(bio, "Server certificate\n"); | 1670 | BIO_printf(bio, "Server certificate\n"); |
1646 | if (!(s_client_config.showcerts && got_a_chain)) /* Redundant if we | 1671 | if (!(s_client_config.showcerts && got_a_chain)) { |
1647 | * showed the whole | 1672 | /* Redundant if we showed the whole chain */ |
1648 | * chain */ | ||
1649 | PEM_write_bio_X509(bio, peer); | 1673 | PEM_write_bio_X509(bio, peer); |
1674 | } | ||
1650 | X509_NAME_oneline(X509_get_subject_name(peer), | 1675 | X509_NAME_oneline(X509_get_subject_name(peer), |
1651 | buf, sizeof buf); | 1676 | buf, sizeof buf); |
1652 | BIO_printf(bio, "subject=%s\n", buf); | 1677 | BIO_printf(bio, "subject=%s\n", buf); |
@@ -1658,7 +1683,8 @@ print_stuff(BIO * bio, SSL * s, int full) | |||
1658 | 1683 | ||
1659 | sk2 = SSL_get_client_CA_list(s); | 1684 | sk2 = SSL_get_client_CA_list(s); |
1660 | if ((sk2 != NULL) && (sk_X509_NAME_num(sk2) > 0)) { | 1685 | if ((sk2 != NULL) && (sk_X509_NAME_num(sk2) > 0)) { |
1661 | BIO_printf(bio, "---\nAcceptable client certificate CA names\n"); | 1686 | BIO_printf(bio, |
1687 | "---\nAcceptable client certificate CA names\n"); | ||
1662 | for (i = 0; i < sk_X509_NAME_num(sk2); i++) { | 1688 | for (i = 0; i < sk_X509_NAME_num(sk2); i++) { |
1663 | xn = sk_X509_NAME_value(sk2, i); | 1689 | xn = sk_X509_NAME_value(sk2, i); |
1664 | X509_NAME_oneline(xn, buf, sizeof(buf)); | 1690 | X509_NAME_oneline(xn, buf, sizeof(buf)); |
@@ -1666,7 +1692,8 @@ print_stuff(BIO * bio, SSL * s, int full) | |||
1666 | BIO_write(bio, "\n", 1); | 1692 | BIO_write(bio, "\n", 1); |
1667 | } | 1693 | } |
1668 | } else { | 1694 | } else { |
1669 | BIO_printf(bio, "---\nNo client certificate CA names sent\n"); | 1695 | BIO_printf(bio, |
1696 | "---\nNo client certificate CA names sent\n"); | ||
1670 | } | 1697 | } |
1671 | p = SSL_get_shared_ciphers(s, buf, sizeof buf); | 1698 | p = SSL_get_shared_ciphers(s, buf, sizeof buf); |
1672 | if (p != NULL) { | 1699 | if (p != NULL) { |
@@ -1677,14 +1704,16 @@ print_stuff(BIO * bio, SSL * s, int full) | |||
1677 | * current connection) the server supports. | 1704 | * current connection) the server supports. |
1678 | */ | 1705 | */ |
1679 | 1706 | ||
1680 | BIO_printf(bio, "---\nCiphers common between both SSL endpoints:\n"); | 1707 | BIO_printf(bio, |
1708 | "---\nCiphers common between both SSL endpoints:\n"); | ||
1681 | j = i = 0; | 1709 | j = i = 0; |
1682 | while (*p) { | 1710 | while (*p) { |
1683 | if (*p == ':') { | 1711 | if (*p == ':') { |
1684 | BIO_write(bio, space, 15 - j % 25); | 1712 | BIO_write(bio, space, 15 - j % 25); |
1685 | i++; | 1713 | i++; |
1686 | j = 0; | 1714 | j = 0; |
1687 | BIO_write(bio, ((i % 3) ? " " : "\n"), 1); | 1715 | BIO_write(bio, |
1716 | ((i % 3) ? " " : "\n"), 1); | ||
1688 | } else { | 1717 | } else { |
1689 | BIO_write(bio, p, 1); | 1718 | BIO_write(bio, p, 1); |
1690 | j++; | 1719 | j++; |
@@ -1696,7 +1725,8 @@ print_stuff(BIO * bio, SSL * s, int full) | |||
1696 | 1725 | ||
1697 | ssl_print_tmp_key(bio, s); | 1726 | ssl_print_tmp_key(bio, s); |
1698 | 1727 | ||
1699 | BIO_printf(bio, "---\nSSL handshake has read %ld bytes and written %ld bytes\n", | 1728 | BIO_printf(bio, |
1729 | "---\nSSL handshake has read %ld bytes and written %ld bytes\n", | ||
1700 | BIO_number_read(SSL_get_rbio(s)), | 1730 | BIO_number_read(SSL_get_rbio(s)), |
1701 | BIO_number_written(SSL_get_wbio(s))); | 1731 | BIO_number_written(SSL_get_wbio(s))); |
1702 | } | 1732 | } |
@@ -1727,7 +1757,8 @@ print_stuff(BIO * bio, SSL * s, int full) | |||
1727 | socklen_t ladd_size = sizeof(ladd); | 1757 | socklen_t ladd_size = sizeof(ladd); |
1728 | sock = SSL_get_fd(s); | 1758 | sock = SSL_get_fd(s); |
1729 | getsockname(sock, (struct sockaddr *) & ladd, &ladd_size); | 1759 | getsockname(sock, (struct sockaddr *) & ladd, &ladd_size); |
1730 | BIO_printf(bio_c_out, "LOCAL PORT is %u\n", ntohs(ladd.sin_port)); | 1760 | BIO_printf(bio_c_out, "LOCAL PORT is %u\n", |
1761 | ntohs(ladd.sin_port)); | ||
1731 | } | 1762 | } |
1732 | #endif | 1763 | #endif |
1733 | 1764 | ||
@@ -1745,10 +1776,12 @@ print_stuff(BIO * bio, SSL * s, int full) | |||
1745 | 1776 | ||
1746 | #ifndef OPENSSL_NO_SRTP | 1777 | #ifndef OPENSSL_NO_SRTP |
1747 | { | 1778 | { |
1748 | SRTP_PROTECTION_PROFILE *srtp_profile = SSL_get_selected_srtp_profile(s); | 1779 | SRTP_PROTECTION_PROFILE *srtp_profile; |
1749 | 1780 | ||
1781 | srtp_profile = SSL_get_selected_srtp_profile(s); | ||
1750 | if (srtp_profile) | 1782 | if (srtp_profile) |
1751 | BIO_printf(bio, "SRTP Extension negotiated, profile=%s\n", | 1783 | BIO_printf(bio, |
1784 | "SRTP Extension negotiated, profile=%s\n", | ||
1752 | srtp_profile->name); | 1785 | srtp_profile->name); |
1753 | } | 1786 | } |
1754 | #endif | 1787 | #endif |
@@ -1756,8 +1789,10 @@ print_stuff(BIO * bio, SSL * s, int full) | |||
1756 | SSL_SESSION_print(bio, SSL_get_session(s)); | 1789 | SSL_SESSION_print(bio, SSL_get_session(s)); |
1757 | if (s_client_config.keymatexportlabel != NULL) { | 1790 | if (s_client_config.keymatexportlabel != NULL) { |
1758 | BIO_printf(bio, "Keying material exporter:\n"); | 1791 | BIO_printf(bio, "Keying material exporter:\n"); |
1759 | BIO_printf(bio, " Label: '%s'\n", s_client_config.keymatexportlabel); | 1792 | BIO_printf(bio, " Label: '%s'\n", |
1760 | BIO_printf(bio, " Length: %i bytes\n", s_client_config.keymatexportlen); | 1793 | s_client_config.keymatexportlabel); |
1794 | BIO_printf(bio, " Length: %i bytes\n", | ||
1795 | s_client_config.keymatexportlen); | ||
1761 | exportedkeymat = malloc(s_client_config.keymatexportlen); | 1796 | exportedkeymat = malloc(s_client_config.keymatexportlen); |
1762 | if (exportedkeymat != NULL) { | 1797 | if (exportedkeymat != NULL) { |
1763 | if (!SSL_export_keying_material(s, exportedkeymat, | 1798 | if (!SSL_export_keying_material(s, exportedkeymat, |
@@ -1782,7 +1817,6 @@ print_stuff(BIO * bio, SSL * s, int full) | |||
1782 | (void) BIO_flush(bio); | 1817 | (void) BIO_flush(bio); |
1783 | } | 1818 | } |
1784 | 1819 | ||
1785 | |||
1786 | static int | 1820 | static int |
1787 | ocsp_resp_cb(SSL * s, void *arg) | 1821 | ocsp_resp_cb(SSL * s, void *arg) |
1788 | { | 1822 | { |