144 #ifdef OPENSSL_NO_STDIO
152 #if defined(OPENSSL_SYS_VMS_DECC) && !defined(__U_INT)
154 typedef unsigned int u_int;
166 #ifndef OPENSSL_NO_SRP
172 #if (defined(OPENSSL_SYS_VMS) && __VMS_VER < 70000000)
177 #if defined(OPENSSL_SYS_BEOS_R5)
182 #define PROG s_client_main
186 #define SSL_HOST_NAME "localhost"
191 #define BUFSIZZ 1024*8
200 static int c_Pause=0;
201 static int c_debug=0;
202 #ifndef OPENSSL_NO_TLSEXT
203 static int c_tlsextdebug=0;
204 static int c_status_req=0;
207 static int c_showcerts=0;
209 static char *keymatexportlabel=NULL;
210 static int keymatexportlen=20;
212 static void sc_usage(
void);
213 static void print_stuff(
BIO *berr,
SSL *con,
int full);
214 #ifndef OPENSSL_NO_TLSEXT
215 static int ocsp_resp_cb(
SSL *s,
void *
arg);
217 static BIO *bio_c_out=NULL;
218 static int c_quiet=0;
219 static int c_ign_eof=0;
221 #ifndef OPENSSL_NO_PSK
223 static char *psk_identity=
"Client_identity";
226 static unsigned int psk_client_cb(
SSL *ssl,
const char *hint,
char *identity,
227 unsigned int max_identity_len,
unsigned char *psk,
228 unsigned int max_psk_len)
230 unsigned int psk_len = 0;
240 BIO_printf(bio_c_out,
"NULL received PSK identity hint, continuing anyway\n");
243 BIO_printf(bio_c_out,
"Received PSK identity hint '%s'\n", hint);
246 ret =
BIO_snprintf(identity, max_identity_len,
"%s", psk_identity);
247 if (ret < 0 || (
unsigned int)ret > max_identity_len)
250 BIO_printf(bio_c_out,
"created identity '%s' len=%d\n", identity, ret);
274 BIO_printf(bio_c_out,
"created PSK len=%d\n", psk_len);
284 static void sc_usage(
void)
293 BIO_printf(
bio_err,
" -cert arg - certificate file to use, PEM format assumed\n");
294 BIO_printf(
bio_err,
" -certform arg - certificate format (PEM or DER) PEM default\n");
301 BIO_printf(
bio_err,
" -reconnect - Drop and re-make the connection with the same Session-ID\n");
302 BIO_printf(
bio_err,
" -pause - sleep(1) after each read(2) and write(2) system call\n");
318 #ifndef OPENSSL_NO_PSK
321 # ifndef OPENSSL_NO_JPAKE
325 #ifndef OPENSSL_NO_SRP
328 BIO_printf(
bio_err,
" -srp_lateuser - SRP username into second ClientHello message\n");
329 BIO_printf(
bio_err,
" -srp_moregroups - Tolerate other than the known g N values.\n");
339 BIO_printf(
bio_err,
" -no_tls1_2/-no_tls1_1/-no_tls1/-no_ssl3/-no_ssl2 - turn off that protocol\n");
340 BIO_printf(
bio_err,
" -bugs - Switch on all SSL implementation bug workarounds\n");
341 BIO_printf(
bio_err,
" -serverpref - Use server's cipher preferences (only SSLv2)\n");
342 BIO_printf(
bio_err,
" -cipher - preferred cipher to use, use the 'openssl ciphers'\n");
344 BIO_printf(
bio_err,
" -starttls prot - use the STARTTLS command before starting TLS\n");
347 BIO_printf(
bio_err,
" only \"smtp\", \"pop3\", \"imap\", \"ftp\" and \"xmpp\"\n");
349 #ifndef OPENSSL_NO_ENGINE
355 #ifndef OPENSSL_NO_TLSEXT
356 BIO_printf(
bio_err,
" -servername host - Set TLS extension servername in ClientHello\n");
360 # if !defined(OPENSSL_NO_NEXTPROTONEG)
361 BIO_printf(
bio_err,
" -nextprotoneg arg - enable NPN extension, considering named protocols supported (comma-separated list)\n");
364 BIO_printf(
bio_err,
" -legacy_renegotiation - enable use of legacy renegotiation (dangerous)\n");
365 BIO_printf(
bio_err,
" -use_srtp profiles - Offer SRTP key management with a colon-separated profile list\n");
366 BIO_printf(
bio_err,
" -keymatexport label - Export keying material using label\n");
367 BIO_printf(
bio_err,
" -keymatexportlen len - Export len bytes of keying material (default 20)\n");
370 #ifndef OPENSSL_NO_TLSEXT
391 #ifndef OPENSSL_NO_SRP
404 #define SRP_NUMBER_ITERATIONS_FOR_PRIME 64
412 g != NULL && N != NULL && bn_ctx != NULL &&
BN_is_odd(N) &&
455 if (srp_arg->
debug || srp_arg->
msg || srp_arg->
amp == 1)
466 if (srp_arg->
amp == 1)
469 BIO_printf(
bio_err,
"SRP param N and g are not known params, going to check deeper.\n");
475 if (
BN_num_bits(g) <= BN_BITS && srp_Verify_N_and_g(N,g))
482 #define PWD_STRLEN 1024
484 static char *
MS_CALLBACK ssl_give_srp_client_pwd_cb(
SSL *s,
void *arg)
507 # ifndef OPENSSL_NO_NEXTPROTONEG
517 static int next_proto_cb(
SSL *s,
unsigned char **out,
unsigned char *outlen,
const unsigned char *in,
unsigned int inlen,
void *arg)
525 BIO_printf(bio_c_out,
"Protocols advertised by server: ");
526 for (i = 0; i < inlen; )
552 int MAIN(
int,
char **);
554 int MAIN(
int argc,
char **argv)
556 unsigned int off=0, clr=0;
558 #ifndef OPENSSL_NO_KRB5
561 int s,
k,width,state=0;
562 char *cbuf=NULL,*sbuf=NULL,*mbuf=NULL;
563 int cbuf_len,cbuf_off;
564 int sbuf_len,sbuf_off;
565 fd_set readfds,writefds;
569 char *cert_file=NULL,*key_file=NULL;
571 char *passarg = NULL, *
pass = NULL;
574 char *CApath=NULL,*CAfile=NULL,*cipher=NULL;
577 int write_tty,read_tty,write_ssl,read_ssl,tty_on,ssl_pending;
579 int ret=1,in_init=1,i,nbio_test=0;
585 int socket_type=SOCK_STREAM;
589 struct timeval timeout, *timeoutp;
590 #ifndef OPENSSL_NO_ENGINE
591 char *engine_id=NULL;
592 char *ssl_client_engine_id=NULL;
593 ENGINE *ssl_client_engine=NULL;
596 #if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_NETWARE) || defined(OPENSSL_SYS_BEOS_R5)
598 #if defined(OPENSSL_SYS_BEOS_R5)
602 #ifndef OPENSSL_NO_TLSEXT
603 char *servername = NULL;
606 # ifndef OPENSSL_NO_NEXTPROTONEG
607 const char *next_proto_neg_in = NULL;
610 char *sess_in = NULL;
611 char *sess_out = NULL;
612 struct sockaddr peer;
613 int peerlen =
sizeof(peer);
614 int enable_timeouts = 0 ;
616 #ifndef OPENSSL_NO_JPAKE
617 char *jpake_secret = NULL;
619 #ifndef OPENSSL_NO_SRP
620 char * srppass = NULL;
621 int srp_lateuser = 0;
622 SRP_ARG srp_arg = {NULL,NULL,0,0,0,1024};
659 if (strcmp(*argv,
"-host") == 0)
661 if (--argc < 1)
goto bad;
664 else if (strcmp(*argv,
"-port") == 0)
666 if (--argc < 1)
goto bad;
667 port=atoi(*(++argv));
668 if (port == 0)
goto bad;
670 else if (strcmp(*argv,
"-connect") == 0)
672 if (--argc < 1)
goto bad;
676 else if (strcmp(*argv,
"-verify") == 0)
679 if (--argc < 1)
goto bad;
683 else if (strcmp(*argv,
"-cert") == 0)
685 if (--argc < 1)
goto bad;
686 cert_file= *(++argv);
688 else if (strcmp(*argv,
"-sess_out") == 0)
690 if (--argc < 1)
goto bad;
691 sess_out = *(++argv);
693 else if (strcmp(*argv,
"-sess_in") == 0)
695 if (--argc < 1)
goto bad;
698 else if (strcmp(*argv,
"-certform") == 0)
700 if (--argc < 1)
goto bad;
701 cert_format =
str2fmt(*(++argv));
709 else if (strcmp(*argv,
"-verify_return_error") == 0)
711 else if (strcmp(*argv,
"-prexit") == 0)
713 else if (strcmp(*argv,
"-crlf") == 0)
715 else if (strcmp(*argv,
"-quiet") == 0)
720 else if (strcmp(*argv,
"-ign_eof") == 0)
722 else if (strcmp(*argv,
"-no_ign_eof") == 0)
724 else if (strcmp(*argv,
"-pause") == 0)
726 else if (strcmp(*argv,
"-debug") == 0)
728 #ifndef OPENSSL_NO_TLSEXT
729 else if (strcmp(*argv,
"-tlsextdebug") == 0)
731 else if (strcmp(*argv,
"-status") == 0)
735 else if (strcmp(*argv,
"-wdebug") == 0)
738 else if (strcmp(*argv,
"-msg") == 0)
740 else if (strcmp(*argv,
"-showcerts") == 0)
742 else if (strcmp(*argv,
"-nbio_test") == 0)
744 else if (strcmp(*argv,
"-state") == 0)
746 #ifndef OPENSSL_NO_PSK
747 else if (strcmp(*argv,
"-psk_identity") == 0)
749 if (--argc < 1)
goto bad;
750 psk_identity=*(++argv);
752 else if (strcmp(*argv,
"-psk") == 0)
756 if (--argc < 1)
goto bad;
758 for (j = 0; j < strlen(
psk_key); j++)
760 if (isxdigit((
unsigned char)
psk_key[j]))
767 #ifndef OPENSSL_NO_SRP
768 else if (strcmp(*argv,
"-srpuser") == 0)
770 if (--argc < 1)
goto bad;
774 else if (strcmp(*argv,
"-srppass") == 0)
776 if (--argc < 1)
goto bad;
780 else if (strcmp(*argv,
"-srp_strength") == 0)
782 if (--argc < 1)
goto bad;
787 else if (strcmp(*argv,
"-srp_lateuser") == 0)
792 else if (strcmp(*argv,
"-srp_moregroups") == 0)
798 #ifndef OPENSSL_NO_SSL2
799 else if (strcmp(*argv,
"-ssl2") == 0)
802 #ifndef OPENSSL_NO_SSL3
803 else if (strcmp(*argv,
"-ssl3") == 0)
806 #ifndef OPENSSL_NO_TLS1
807 else if (strcmp(*argv,
"-tls1_2") == 0)
809 else if (strcmp(*argv,
"-tls1_1") == 0)
811 else if (strcmp(*argv,
"-tls1") == 0)
814 #ifndef OPENSSL_NO_DTLS1
815 else if (strcmp(*argv,
"-dtls1") == 0)
818 socket_type=SOCK_DGRAM;
820 else if (strcmp(*argv,
"-timeout") == 0)
822 else if (strcmp(*argv,
"-mtu") == 0)
824 if (--argc < 1)
goto bad;
825 socket_mtu = atol(*(++argv));
828 else if (strcmp(*argv,
"-bugs") == 0)
830 else if (strcmp(*argv,
"-keyform") == 0)
832 if (--argc < 1)
goto bad;
833 key_format =
str2fmt(*(++argv));
835 else if (strcmp(*argv,
"-pass") == 0)
837 if (--argc < 1)
goto bad;
840 else if (strcmp(*argv,
"-key") == 0)
842 if (--argc < 1)
goto bad;
845 else if (strcmp(*argv,
"-reconnect") == 0)
849 else if (strcmp(*argv,
"-CApath") == 0)
851 if (--argc < 1)
goto bad;
854 else if (strcmp(*argv,
"-CAfile") == 0)
856 if (--argc < 1)
goto bad;
859 else if (strcmp(*argv,
"-no_tls1_2") == 0)
861 else if (strcmp(*argv,
"-no_tls1_1") == 0)
863 else if (strcmp(*argv,
"-no_tls1") == 0)
865 else if (strcmp(*argv,
"-no_ssl3") == 0)
867 else if (strcmp(*argv,
"-no_ssl2") == 0)
869 else if (strcmp(*argv,
"-no_comp") == 0)
871 #ifndef OPENSSL_NO_TLSEXT
872 else if (strcmp(*argv,
"-no_ticket") == 0)
874 # ifndef OPENSSL_NO_NEXTPROTONEG
875 else if (strcmp(*argv,
"-nextprotoneg") == 0)
877 if (--argc < 1)
goto bad;
878 next_proto_neg_in = *(++argv);
882 else if (strcmp(*argv,
"-serverpref") == 0)
884 else if (strcmp(*argv,
"-legacy_renegotiation") == 0)
886 else if (strcmp(*argv,
"-legacy_server_connect") == 0)
888 else if (strcmp(*argv,
"-no_legacy_server_connect") == 0)
890 else if (strcmp(*argv,
"-cipher") == 0)
892 if (--argc < 1)
goto bad;
896 else if (strcmp(*argv,
"-nbio") == 0)
899 else if (strcmp(*argv,
"-starttls") == 0)
901 if (--argc < 1)
goto bad;
903 if (strcmp(*argv,
"smtp") == 0)
905 else if (strcmp(*argv,
"pop3") == 0)
907 else if (strcmp(*argv,
"imap") == 0)
909 else if (strcmp(*argv,
"ftp") == 0)
911 else if (strcmp(*argv,
"xmpp") == 0)
916 #ifndef OPENSSL_NO_ENGINE
917 else if (strcmp(*argv,
"-engine") == 0)
919 if (--argc < 1)
goto bad;
920 engine_id = *(++argv);
922 else if (strcmp(*argv,
"-ssl_client_engine") == 0)
924 if (--argc < 1)
goto bad;
925 ssl_client_engine_id = *(++argv);
928 else if (strcmp(*argv,
"-rand") == 0)
930 if (--argc < 1)
goto bad;
933 #ifndef OPENSSL_NO_TLSEXT
934 else if (strcmp(*argv,
"-servername") == 0)
936 if (--argc < 1)
goto bad;
937 servername= *(++argv);
941 #ifndef OPENSSL_NO_JPAKE
942 else if (strcmp(*argv,
"-jpake") == 0)
944 if (--argc < 1)
goto bad;
945 jpake_secret = *++argv;
948 else if (strcmp(*argv,
"-use_srtp") == 0)
950 if (--argc < 1)
goto bad;
951 srtp_profiles = *(++argv);
953 else if (strcmp(*argv,
"-keymatexport") == 0)
955 if (--argc < 1)
goto bad;
956 keymatexportlabel= *(++argv);
958 else if (strcmp(*argv,
"-keymatexportlen") == 0)
960 if (--argc < 1)
goto bad;
961 keymatexportlen=atoi(*(++argv));
962 if (keymatexportlen == 0)
goto bad;
980 #if !defined(OPENSSL_NO_JPAKE) && !defined(OPENSSL_NO_PSK)
986 "Can't use JPAKE and PSK together\n");
989 psk_identity =
"JPAKE";
1002 #if !defined(OPENSSL_NO_TLSEXT) && !defined(OPENSSL_NO_NEXTPROTONEG)
1004 if (next_proto_neg_in)
1007 if (next_proto.
data == NULL)
1014 next_proto.
data = NULL;
1017 #ifndef OPENSSL_NO_ENGINE
1019 if (ssl_client_engine_id)
1021 ssl_client_engine =
ENGINE_by_id(ssl_client_engine_id);
1022 if (!ssl_client_engine)
1025 "Error getting client auth engine\n");
1037 if (key_file == NULL)
1038 key_file = cert_file;
1046 "client certificate private key file");
1059 NULL, e,
"client certificate file");
1071 BIO_printf(
bio_err,
"warning, not much extra random data, consider using the -rand option\n");
1077 if (bio_c_out == NULL)
1079 if (c_quiet && !c_debug && !c_msg)
1085 if (bio_c_out == NULL)
1090 #ifndef OPENSSL_NO_SRP
1108 #ifndef OPENSSL_NO_ENGINE
1109 if (ssl_client_engine)
1122 #ifndef OPENSSL_NO_PSK
1123 #ifdef OPENSSL_NO_JPAKE
1126 if (
psk_key != NULL || jpake_secret)
1130 BIO_printf(bio_c_out,
"PSK key given or JPAKE in use, setting client callback\n");
1133 if (srtp_profiles != NULL)
1148 #if !defined(OPENSSL_NO_TLSEXT) && !defined(OPENSSL_NO_NEXTPROTONEG)
1149 if (next_proto.
data)
1177 #ifndef OPENSSL_NO_TLSEXT
1178 if (servername != NULL)
1184 #ifndef OPENSSL_NO_SRP
1192 srp_arg.
msg = c_msg;
1193 srp_arg.
debug = c_debug ;
1197 if (c_msg || c_debug || srp_arg.
amp == 0)
1216 sess = PEM_read_bio_SSL_SESSION(stmp, NULL, 0, NULL);
1228 #ifndef OPENSSL_NO_TLSEXT
1229 if (servername != NULL)
1239 #ifndef OPENSSL_NO_KRB5
1248 #ifdef TLSEXT_TYPE_opaque_prf_input
1267 BIO_printf(bio_c_out,
"turning on non blocking io\n");
1281 if (getsockname(s, &peer, (
void *)&peerlen) < 0)
1291 if (enable_timeouts)
1302 if (socket_mtu > 28)
1333 #ifndef OPENSSL_NO_TLSEXT
1348 id->value.byKey = ASN1_OCTET_STRING_new();
1357 #ifndef OPENSSL_NO_JPAKE
1396 while (mbuf_len>3 && mbuf[3]==
'-');
1398 BIO_printf(fbio,
"EHLO openssl.client.net\r\n");
1404 if (strstr(mbuf,
"STARTTLS"))
1407 while (mbuf_len>3 && mbuf[3]==
'-');
1413 "didn't found starttls in server response,"
1414 " try anyway...\n");
1437 if (strstr(mbuf,
"STARTTLS"))
1440 while (mbuf_len>3 && mbuf[0]!=
'.');
1446 "didn't found STARTTLS in server response,"
1447 " try anyway...\n");
1460 while (mbuf_len>3 && mbuf[3]==
'-');
1471 "xmlns:stream='http://etherx.jabber.org/streams' "
1472 "xmlns='jabber:client' to='%s' version='1.0'>", host);
1475 while (!strstr(mbuf,
"<starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'"))
1477 if (strstr(mbuf,
"/stream:features>"))
1482 BIO_printf(sbio,
"<starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>");
1485 if (!strstr(sbuf,
"<proceed"))
1497 timeoutp = &timeout;
1513 #ifndef OPENSSL_NO_TLSEXT
1516 BIO_printf(bio_c_out,
"Server did %sacknowledge servername extension.\n",tlsextcbp.
ack?
"":
"not ");
1531 print_stuff(bio_c_out,con,full_log);
1532 if (full_log > 0) full_log--;
1544 BIO_printf(bio_c_out,
"drop connection and then reconnect\n");
1557 #if !defined(OPENSSL_SYS_WINDOWS) && !defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_NETWARE) && !defined (OPENSSL_SYS_BEOS_R5)
1568 if(!tty_on || !write_tty) {
1584 #if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_MSDOS)
1597 i=select(width,(
void *)&readfds,(
void *)&writefds,
1599 #if defined(OPENSSL_SYS_WINCE) || defined(OPENSSL_SYS_MSDOS)
1600 if(!i && (!_kbhit() || !read_tty) )
continue;
1602 if(!i && (!((_kbhit()) || (WAIT_OBJECT_0 == WaitForSingleObject(GetStdHandle(STD_INPUT_HANDLE), 0))) || !read_tty) )
continue;
1604 }
else i=select(width,(
void *)&readfds,(
void *)&writefds,
1607 #elif defined(OPENSSL_SYS_NETWARE)
1612 i=select(width,(
void *)&readfds,(
void *)&writefds,
1614 }
else i=select(width,(
void *)&readfds,(
void *)&writefds,
1617 #elif defined(OPENSSL_SYS_BEOS_R5)
1621 (
void)fcntl(fileno(stdin), F_SETFL, O_NONBLOCK);
1626 i=select(width,(
void *)&readfds,(
void *)&writefds,
1628 if (
read(fileno(stdin), sbuf, 0) >= 0)
1630 if (!i && (stdin_set != 1 || !read_tty))
1632 }
else i=select(width,(
void *)&readfds,(
void *)&writefds,
1635 (
void)fcntl(fileno(stdin), F_SETFL, 0);
1637 i=select(width,(
void *)&readfds,(
void *)&writefds,
1654 if (!ssl_pending && FD_ISSET(
SSL_get_fd(con),&writefds))
1657 (
unsigned int)cbuf_len);
1663 if (k <= 0)
goto end;
1705 if ((k != 0) || (cbuf_len != 0))
1722 #if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_NETWARE) || defined(OPENSSL_SYS_BEOS_R5)
1724 else if (!ssl_pending && write_tty)
1726 else if (!ssl_pending && FD_ISSET(fileno(stdout),&writefds))
1729 #ifdef CHARSET_EBCDIC
1730 ascii2ebcdic(&(sbuf[sbuf_off]),&(sbuf[sbuf_off]),sbuf_len);
1750 else if (ssl_pending || FD_ISSET(
SSL_get_fd(con),&readfds))
1753 {
static int iiii;
if (++iiii == 52) {
SSL_renegotiate(con); iiii=0; } }
1785 if ((read_tty == 0) && (write_ssl == 0))
1806 #if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_MSDOS)
1807 #if defined(OPENSSL_SYS_WINCE) || defined(OPENSSL_SYS_MSDOS)
1810 else if ((_kbhit()) || (WAIT_OBJECT_0 == WaitForSingleObject(GetStdHandle(STD_INPUT_HANDLE), 0)))
1812 #elif defined (OPENSSL_SYS_NETWARE)
1814 #elif defined(OPENSSL_SYS_BEOS_R5)
1817 else if (FD_ISSET(fileno(stdin),&readfds))
1827 for (j = 0; j < i; j++)
1828 if (cbuf[j] ==
'\n')
1830 for (j = i-1; j >= 0; j--)
1832 cbuf[j+lf_num] = cbuf[j];
1833 if (cbuf[j] ==
'\n')
1837 cbuf[j+lf_num] =
'\r';
1840 assert(lf_num == 0);
1845 if ((!c_ign_eof) && ((i <= 0) || (cbuf[0] ==
'Q')))
1852 if ((!c_ign_eof) && (cbuf[0] ==
'R'))
1858 #ifndef OPENSSL_NO_HEARTBEATS
1859 else if ((!c_ign_eof) && (cbuf[0] ==
'B'))
1870 #ifdef CHARSET_EBCDIC
1883 print_stuff(bio_c_out,con,full_log);
1890 print_stuff(bio_c_out,con,1);
1903 if (bio_c_out != NULL)
1913 static void print_stuff(
BIO *bio,
SSL *s,
int full)
1917 static const char *space=
" ";
1924 #ifndef OPENSSL_NO_COMP
1927 unsigned char *exportedkeymat;
1931 int got_a_chain = 0;
1933 sk=SSL_get_peer_cert_chain(s);
1957 if (!(c_showcerts && got_a_chain))
1958 PEM_write_bio_X509(bio,peer);
1967 BIO_printf(bio,
"no peer certificate available\n");
1969 sk2=SSL_get_client_CA_list(s);
1972 BIO_printf(bio,
"---\nAcceptable client certificate CA names\n");
1983 BIO_printf(bio,
"---\nNo client certificate CA names sent\n");
1993 BIO_printf(bio,
"---\nCiphers common between both SSL endpoints:\n");
2014 BIO_printf(bio,
"---\nSSL handshake has read %ld bytes and written %ld bytes\n",
2026 BIO_printf(bio,
"Server public key is %d bit\n",
2030 BIO_printf(bio,
"Secure Renegotiation IS%s supported\n",
2032 #ifndef OPENSSL_NO_COMP
2045 struct sockaddr_in ladd;
2046 socklen_t ladd_size =
sizeof(ladd);
2048 getsockname(sock, (
struct sockaddr *)&ladd, &ladd_size);
2049 BIO_printf(bio_c_out,
"LOCAL PORT is %u\n", ntohs(ladd.sin_port));
2053 #if !defined(OPENSSL_NO_TLSEXT) && !defined(OPENSSL_NO_NEXTPROTONEG)
2054 if (next_proto.
status != -1) {
2055 const unsigned char *proto;
2056 unsigned int proto_len;
2068 BIO_printf(bio,
"SRTP Extension negotiated, profile=%s\n",
2069 srtp_profile->
name);
2073 if (keymatexportlabel != NULL)
2075 BIO_printf(bio,
"Keying material exporter:\n");
2076 BIO_printf(bio,
" Label: '%s'\n", keymatexportlabel);
2077 BIO_printf(bio,
" Length: %i bytes\n", keymatexportlen);
2079 if (exportedkeymat != NULL)
2084 strlen(keymatexportlabel),
2092 for (i=0; i<keymatexportlen; i++)
2107 #ifndef OPENSSL_NO_TLSEXT
2109 static int ocsp_resp_cb(
SSL *s,
void *arg)
2111 const unsigned char *
p;
2118 BIO_puts(arg,
"no response sent\n");
2121 rsp = d2i_OCSP_RESPONSE(NULL, &p, len);
2124 BIO_puts(arg,
"response parse error\n");
2128 BIO_puts(arg,
"\n======================================\n");
2130 BIO_puts(arg,
"======================================\n");
2131 OCSP_RESPONSE_free(rsp);