about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--irc.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/irc.c b/irc.c
index dc40201..5f14c9e 100644
--- a/irc.c
+++ b/irc.c
@@ -166,6 +166,12 @@ int ircConnect(const char *bindHost, const char *host, const char *port) {
 }
 
 void ircPrintCert(void) {
+	int error;
+	do {
+		error = tls_handshake(client);
+	} while (error == TLS_WANT_POLLIN || error == TLS_WANT_POLLOUT);
+	if (error) errx(EX_PROTOCOL, "tls_handshake: %s", tls_error(client));
+
 	size_t len;
 	const byte *pem = tls_peer_cert_chain_pem(client, &len);
 	printf("subject= %s\n", tls_peer_cert_subject(client));