Lines Matching refs:bio
24 # define ssl_trace_list(bio, indent, msg, msglen, value, table) \
25 do_ssl_trace_list(bio, indent, msg, msglen, value, \
40 static int do_ssl_trace_list(BIO *bio, int indent,
52 BIO_indent(bio, indent, 80);
53 BIO_printf(bio, "%s (%d)\n", do_ssl_trace_str(val, tbl, ntbl), val);
614 static void ssl_print_hex(BIO *bio, int indent, const char *name,
619 BIO_indent(bio, indent, 80);
620 BIO_printf(bio, "%s (len=%d): ", name, (int)msglen);
622 BIO_printf(bio, "%02X", msg[i]);
623 BIO_puts(bio, "\n");
626 static int ssl_print_hexbuf(BIO *bio, int indent, const char *name, size_t nlen,
640 ssl_print_hex(bio, indent, name, p, blen);
646 static int ssl_print_version(BIO *bio, int indent, const char *name,
657 BIO_indent(bio, indent, 80);
658 BIO_printf(bio, "%s=0x%x (%s)\n",
665 static int ssl_print_random(BIO *bio, int indent,
678 BIO_indent(bio, indent, 80);
679 BIO_puts(bio, "Random:\n");
680 BIO_indent(bio, indent + 2, 80);
681 BIO_printf(bio, "gmt_unix_time=0x%08X\n", tm);
682 ssl_print_hex(bio, indent + 2, "random_bytes", p, 28);
688 static int ssl_print_signature(BIO *bio, int indent, const SSL *ssl,
697 BIO_indent(bio, indent, 80);
698 BIO_printf(bio, "Signature Algorithm: %s (0x%04x)\n",
703 return ssl_print_hexbuf(bio, indent, "Signature", 2, pmsg, pmsglen);
706 static int ssl_print_extension(BIO *bio, int indent, int server,
714 BIO_indent(bio, indent, 80);
715 BIO_printf(bio, "extension_type=%s(%d), length=%d\n",
722 return ssl_trace_list(bio, indent + 2, ext, xlen, 1, ssl_mfl_tbl);
730 return ssl_trace_list(bio, indent + 2, ext + 1, xlen, 1, ssl_point_tbl);
738 return ssl_trace_list(bio, indent + 2, ext + 2, xlen, 2, ssl_groups_tbl);
751 BIO_indent(bio, indent + 2, 80);
752 BIO_write(bio, ext, plen);
753 BIO_puts(bio, "\n");
770 BIO_indent(bio, indent + 2, 80);
772 BIO_printf(bio, "%s (0x%04x)\n",
792 ssl_print_hex(bio, indent + 4, "client_verify_data", ext, xlen);
795 ssl_print_hex(bio, indent + 4, "server_verify_data", ext, xlen);
798 BIO_indent(bio, indent + 4, 80);
799 BIO_puts(bio, "<EMPTY>\n");
805 ssl_print_hex(bio, indent + 4, "ticket", ext, extlen);
814 BIO_indent(bio, indent + 4, 80);
815 BIO_printf(bio, "NamedGroup: %s (%d)\n",
840 BIO_indent(bio, indent + 4, 80);
841 BIO_printf(bio, "NamedGroup: %s (%d)\n",
843 ssl_print_hex(bio, indent + 4, "key_exchange: ", ext, share_len);
854 BIO_indent(bio, indent + 4, 80);
855 BIO_printf(bio, "%s (%d)\n",
864 return ssl_trace_list(bio, indent + 2, ext + 1, xlen, 2,
873 return ssl_trace_list(bio, indent + 2, ext + 1, xlen, 1,
885 BIO_indent(bio, indent + 2, 80);
886 BIO_printf(bio, "max_early_data=%u\n", max_early_data);
890 BIO_dump_indent(bio, (const char *)ext, extlen, indent + 2);
895 static int ssl_print_extensions(BIO *bio, int indent, int server,
902 BIO_indent(bio, indent, 80);
904 BIO_puts(bio, "No extensions\n");
913 BIO_puts(bio, "No extensions\n");
920 BIO_printf(bio, "extensions, length = %d\n", (int)extslen);
930 BIO_printf(bio, "extensions, extype = %d, extlen = %d\n", extype,
932 BIO_dump_indent(bio, (const char *)msg, extslen, indent + 2);
936 if (!ssl_print_extension(bio, indent + 2, server, mt, extype, msg,
948 static int ssl_print_client_hello(BIO *bio, const SSL *ssl, int indent,
954 if (!ssl_print_version(bio, indent, "client_version", &msg, &msglen, NULL))
956 if (!ssl_print_random(bio, indent, &msg, &msglen))
958 if (!ssl_print_hexbuf(bio, indent, "session_id", 1, &msg, &msglen))
961 if (!ssl_print_hexbuf(bio, indent, "cookie", 1, &msg, &msglen))
969 BIO_indent(bio, indent, 80);
970 BIO_printf(bio, "cipher_suites (len=%d)\n", (int)len);
975 BIO_indent(bio, indent + 2, 80);
976 BIO_printf(bio, "{0x%02X, 0x%02X} %s\n",
989 BIO_indent(bio, indent, 80);
990 BIO_printf(bio, "compression_methods (len=%d)\n", (int)len);
992 BIO_indent(bio, indent + 2, 80);
993 BIO_printf(bio, "%s (0x%02X)\n",
999 if (!ssl_print_extensions(bio, indent, 0, SSL3_MT_CLIENT_HELLO, &msg,
1005 static int dtls_print_hello_vfyrequest(BIO *bio, int indent,
1008 if (!ssl_print_version(bio, indent, "server_version", &msg, &msglen, NULL))
1010 if (!ssl_print_hexbuf(bio, indent, "cookie", 1, &msg, &msglen))
1015 static int ssl_print_server_hello(BIO *bio, int indent,
1021 if (!ssl_print_version(bio, indent, "server_version", &msg, &msglen, &vers))
1023 if (!ssl_print_random(bio, indent, &msg, &msglen))
1026 && !ssl_print_hexbuf(bio, indent, "session_id", 1, &msg, &msglen))
1031 BIO_indent(bio, indent, 80);
1032 BIO_printf(bio, "cipher_suite {0x%02X, 0x%02X} %s\n",
1039 BIO_indent(bio, indent, 80);
1040 BIO_printf(bio, "compression_method: %s (0x%02X)\n",
1045 if (!ssl_print_extensions(bio, indent, 1, SSL3_MT_SERVER_HELLO, &msg,
1099 static int ssl_print_client_keyex(BIO *bio, int indent, const SSL *ssl,
1105 BIO_indent(bio, indent, 80);
1106 BIO_printf(bio, "KeyExchangeAlgorithm=%s\n", algname);
1108 if (!ssl_print_hexbuf(bio, indent + 2,
1117 ssl_print_hex(bio, indent + 2,
1120 if (!ssl_print_hexbuf(bio, indent + 2,
1128 if (!ssl_print_hexbuf(bio, indent + 2, "dh_Yc", 2, &msg, &msglen))
1134 if (!ssl_print_hexbuf(bio, indent + 2, "ecdh_Yc", 1, &msg, &msglen))
1138 ssl_print_hex(bio, indent + 2, "GostKeyTransportBlob", msg, msglen);
1142 ssl_print_hex(bio, indent + 2,
1151 static int ssl_print_server_keyex(BIO *bio, int indent, const SSL *ssl,
1157 BIO_indent(bio, indent, 80);
1158 BIO_printf(bio, "KeyExchangeAlgorithm=%s\n", algname);
1160 if (!ssl_print_hexbuf(bio, indent + 2,
1167 if (!ssl_print_hexbuf(bio, indent + 2, "rsa_modulus", 2, &msg, &msglen))
1169 if (!ssl_print_hexbuf(bio, indent + 2, "rsa_exponent", 2,
1176 if (!ssl_print_hexbuf(bio, indent + 2, "dh_p", 2, &msg, &msglen))
1178 if (!ssl_print_hexbuf(bio, indent + 2, "dh_g", 2, &msg, &msglen))
1180 if (!ssl_print_hexbuf(bio, indent + 2, "dh_Ys", 2, &msg, &msglen))
1188 BIO_indent(bio, indent + 2, 80);
1190 BIO_puts(bio, "explicit_prime\n");
1192 BIO_puts(bio, "explicit_char2\n");
1198 BIO_printf(bio, "named_curve: %s (%d)\n",
1202 if (!ssl_print_hexbuf(bio, indent + 2, "point", 1, &msg, &msglen))
1205 BIO_printf(bio, "UNKNOWN CURVE PARAMETER TYPE %d\n", msg[0]);
1215 ssl_print_signature(bio, indent, ssl, &msg, &msglen);
1219 static int ssl_print_certificate(BIO *bio, int indent,
1233 BIO_indent(bio, indent, 80);
1234 BIO_printf(bio, "ASN.1Cert, length=%d", (int)clen);
1237 BIO_puts(bio, "<UNPARSEABLE CERTIFICATE>\n");
1239 BIO_puts(bio, "\n------details-----\n");
1240 X509_print_ex(bio, x, XN_FLAG_ONELINE, 0);
1241 PEM_write_bio_X509(bio, x);
1243 BIO_puts(bio, "------------------\n");
1247 BIO_puts(bio, "<TRAILING GARBAGE AFTER CERTIFICATE>\n");
1254 static int ssl_print_certificates(BIO *bio, const SSL *ssl, int server,
1261 && !ssl_print_hexbuf(bio, indent, "context", 1, &msg, &msglen))
1270 BIO_indent(bio, indent, 80);
1271 BIO_printf(bio, "certificate_list, length=%d\n", (int)clen);
1273 if (!ssl_print_certificate(bio, indent + 2, &msg, &clen))
1276 && !ssl_print_extensions(bio, indent + 2, server,
1284 static int ssl_print_cert_request(BIO *bio, int indent, const SSL *ssl,
1291 if (!ssl_print_hexbuf(bio, indent, "request_context", 1, &msg, &msglen))
1293 if (!ssl_print_extensions(bio, indent, 1,
1304 BIO_indent(bio, indent, 80);
1305 BIO_printf(bio, "certificate_types (len=%d)\n", (int)xlen);
1306 if (!ssl_trace_list(bio, indent + 2, msg, xlen, 1, ssl_ctype_tbl))
1319 BIO_indent(bio, indent, 80);
1320 BIO_printf(bio, "signature_algorithms (len=%d)\n", (int)xlen);
1322 BIO_indent(bio, indent + 2, 80);
1324 BIO_printf(bio, "%s (0x%04x)\n",
1335 BIO_indent(bio, indent, 80);
1340 BIO_printf(bio, "certificate_authorities (len=%d)\n", (int)xlen);
1351 BIO_indent(bio, indent + 2, 80);
1352 BIO_printf(bio, "DistinguishedName (len=%d): ", (int)dlen);
1356 BIO_puts(bio, "<UNPARSEABLE DN>\n");
1358 X509_NAME_print_ex(bio, nm, 0, XN_FLAG_ONELINE);
1359 BIO_puts(bio, "\n");
1366 if (!ssl_print_hexbuf(bio, indent, "request_extensions", 2,
1373 static int ssl_print_ticket(BIO *bio, int indent, const SSL *ssl,
1379 BIO_indent(bio, indent + 2, 80);
1380 BIO_puts(bio, "No Ticket\n");
1391 BIO_indent(bio, indent + 2, 80);
1392 BIO_printf(bio, "ticket_lifetime_hint=%u\n", tick_life);
1405 BIO_indent(bio, indent + 2, 80);
1406 BIO_printf(bio, "ticket_age_add=%u\n", ticket_age_add);
1407 if (!ssl_print_hexbuf(bio, indent + 2, "ticket_nonce", 1, &msg,
1411 if (!ssl_print_hexbuf(bio, indent + 2, "ticket", 2, &msg, &msglen))
1414 && !ssl_print_extensions(bio, indent + 2, 0,
1422 static int ssl_print_handshake(BIO *bio, const SSL *ssl, int server,
1433 BIO_indent(bio, indent, 80);
1434 BIO_printf(bio, "%s, Length=%d\n",
1441 BIO_indent(bio, indent, 80);
1442 BIO_printf(bio, "message_seq=%d, fragment_offset=%d, "
1454 if (!ssl_print_client_hello(bio, ssl, indent + 2, msg, msglen))
1459 if (!dtls_print_hello_vfyrequest(bio, indent + 2, msg, msglen))
1464 if (!ssl_print_server_hello(bio, indent + 2, msg, msglen))
1469 if (!ssl_print_server_keyex(bio, indent + 2, ssl, msg, msglen))
1474 if (!ssl_print_client_keyex(bio, indent + 2, ssl, msg, msglen))
1479 if (!ssl_print_certificates(bio, ssl, server, indent + 2, msg, msglen))
1484 if (!ssl_print_signature(bio, indent + 2, ssl, &msg, &msglen))
1489 if (!ssl_print_cert_request(bio, indent + 2, ssl, msg, msglen))
1494 ssl_print_hex(bio, indent + 2, "verify_data", msg, msglen);
1499 ssl_print_hex(bio, indent + 2, "unexpected value", msg, msglen);
1503 if (!ssl_print_ticket(bio, indent + 2, ssl, msg, msglen))
1508 if (!ssl_print_extensions(bio, indent + 2, 1,
1515 ssl_print_hex(bio, indent + 2, "unexpected value", msg, msglen);
1518 if (!ssl_trace_list(bio, indent + 2, msg, msglen, 1,
1524 BIO_indent(bio, indent + 2, 80);
1525 BIO_puts(bio, "Unsupported, hex dump follows:\n");
1526 BIO_dump_indent(bio, (const char *)msg, msglen, indent + 4);
1535 BIO *bio = arg;
1545 BIO_puts(bio, write_p ? "Sent" : "Received");
1546 ssl_print_hex(bio, 0, " too short message", msg, msglen);
1550 BIO_puts(bio, write_p ? "Sent" : "Received");
1551 BIO_printf(bio, " Record\nHeader:\n Version = %s (0x%x)\n",
1554 BIO_printf(bio,
1561 BIO_printf(bio, " Content Type = %s (%d)\n Length = %d",
1568 BIO_printf(bio, " Inner Content Type = %s (%d)",
1573 if (!ssl_print_handshake(bio, ssl, ssl->server ? write_p : !write_p,
1575 BIO_printf(bio, "Message length parse error!\n");
1580 BIO_puts(bio, " change_cipher_spec (1)\n");
1582 ssl_print_hex(bio, 4, "unknown value", msg, msglen);
1587 BIO_puts(bio, " Illegal Alert Length\n");
1589 BIO_printf(bio, " Level=%s(%d), description=%s(%d)\n",
1596 BIO_puts(bio, "\n");