Lines Matching defs:tls_ctx
149 void report_tls(struct tls *tls_ctx, char * host, char *tlsexpectname);
171 struct tls *tls_ctx = NULL;
565 if ((tls_ctx = tls_server()) == NULL)
567 if (tls_configure(tls_ctx, tls_cfg) == -1)
569 tls_error(tls_ctx));
622 (tls_cctx = tls_setup_server(tls_ctx, connfd, host)))
677 if ((tls_ctx = tls_client()) == NULL)
679 if (tls_configure(tls_ctx, tls_cfg) == -1)
681 tls_error(tls_ctx));
724 tls_setup_client(tls_ctx, s, host);
726 readwrite(s, tls_ctx);
727 if (tls_ctx) {
731 j = tls_close(tls_ctx);
734 tls_free(tls_ctx);
735 tls_ctx = NULL;
791 tls_setup_client(struct tls *tls_ctx, int s, char *host)
795 if (tls_connect_socket(tls_ctx, s,
798 tls_error(tls_ctx));
801 if ((i = tls_handshake(tls_ctx)) == -1)
803 tls_error(tls_ctx));
806 report_tls(tls_ctx, host, tls_expectname);
807 if (tls_expecthash && tls_peer_cert_hash(tls_ctx) &&
808 strcmp(tls_expecthash, tls_peer_cert_hash(tls_ctx)) != 0)
813 tls_setup_server(struct tls *tls_ctx, int connfd, char *host)
817 if (tls_accept_socket(tls_ctx, &tls_cctx,
820 tls_error(tls_ctx));
838 else if (gotcert && tls_peer_cert_hash(tls_ctx) && tls_expecthash &&
839 strcmp(tls_expecthash, tls_peer_cert_hash(tls_ctx)) != 0)
1060 readwrite(int net_fd, struct tls *tls_ctx)
1185 &stdinbufpos, tls_ctx);
1202 &netinbufpos, tls_ctx);
1620 report_tls(struct tls * tls_ctx, char * host, char *tlsexpectname)
1626 tls_conn_version(tls_ctx), tls_conn_cipher(tls_ctx), host);
1629 if (tls_peer_cert_subject(tls_ctx))
1631 tls_peer_cert_subject(tls_ctx));
1632 if (tls_peer_cert_issuer(tls_ctx))
1634 tls_peer_cert_issuer(tls_ctx));
1635 if ((t = tls_peer_cert_notbefore(tls_ctx)) != -1)
1637 if ((t = tls_peer_cert_notafter(tls_ctx)) != -1)
1639 if (tls_peer_cert_hash(tls_ctx))
1641 tls_peer_cert_hash(tls_ctx));
1642 ocsp_url = tls_peer_ocsp_url(tls_ctx);
1645 switch (tls_peer_ocsp_response_status(tls_ctx)) {
1648 tls_peer_ocsp_result(tls_ctx) == NULL ? "" :
1649 tls_peer_ocsp_result(tls_ctx));
1652 tls_peer_ocsp_response_status(tls_ctx),
1653 tls_peer_ocsp_cert_status(tls_ctx),
1654 tls_peer_ocsp_crl_reason(tls_ctx));
1655 t = tls_peer_ocsp_this_update(tls_ctx);
1658 t = tls_peer_ocsp_next_update(tls_ctx);
1661 t = tls_peer_ocsp_revocation_time(tls_ctx);
1669 tls_peer_ocsp_response_status(tls_ctx),
1670 tls_peer_ocsp_result(tls_ctx) == NULL ? "" :
1671 tls_peer_ocsp_result(tls_ctx));