Lines Matching refs:dnstls_data
47 … r = gnutls_credentials_set(gs, GNUTLS_CRD_CERTIFICATE, stream->manager->dnstls_data.cert_cred); in dnstls_stream_connect_tls()
51 if (server->dnstls_data.session_data.size > 0) { in dnstls_stream_connect_tls()
52 …gnutls_session_set_data(gs, server->dnstls_data.session_data.data, server->dnstls_data.session_dat… in dnstls_stream_connect_tls()
55 gnutls_free(server->dnstls_data.session_data.data); in dnstls_stream_connect_tls()
56 server->dnstls_data.session_data.data = NULL; in dnstls_stream_connect_tls()
57 server->dnstls_data.session_data.size = 0; in dnstls_stream_connect_tls()
64 stream->dnstls_data.validation.type = GNUTLS_DT_IP_ADDRESS; in dnstls_stream_connect_tls()
66 … stream->dnstls_data.validation.data = (unsigned char*) &server->address.in.s_addr; in dnstls_stream_connect_tls()
67 stream->dnstls_data.validation.size = 4; in dnstls_stream_connect_tls()
69 stream->dnstls_data.validation.data = server->address.in6.s6_addr; in dnstls_stream_connect_tls()
70 stream->dnstls_data.validation.size = 16; in dnstls_stream_connect_tls()
72 gnutls_session_set_verify_cert2(gs, &stream->dnstls_data.validation, 1, 0); in dnstls_stream_connect_tls()
88 stream->dnstls_data.handshake = gnutls_handshake(gs); in dnstls_stream_connect_tls()
89 … if (stream->dnstls_data.handshake < 0 && gnutls_error_is_fatal(stream->dnstls_data.handshake)) in dnstls_stream_connect_tls()
92 stream->dnstls_data.session = TAKE_PTR(gs); in dnstls_stream_connect_tls()
101 if (stream->dnstls_data.session) in dnstls_stream_free()
102 gnutls_deinit(stream->dnstls_data.session); in dnstls_stream_free()
110 assert(stream->dnstls_data.session); in dnstls_stream_on_io()
112 if (stream->dnstls_data.shutdown) { in dnstls_stream_on_io()
113 r = gnutls_bye(stream->dnstls_data.session, GNUTLS_SHUT_RDWR); in dnstls_stream_on_io()
115 …stream->dnstls_events = gnutls_record_get_direction(stream->dnstls_data.session) == 1 ? EPOLLOUT :… in dnstls_stream_on_io()
121 stream->dnstls_data.shutdown = false; in dnstls_stream_on_io()
124 } else if (stream->dnstls_data.handshake < 0) { in dnstls_stream_on_io()
125 stream->dnstls_data.handshake = gnutls_handshake(stream->dnstls_data.session); in dnstls_stream_on_io()
126 if (stream->dnstls_data.handshake == GNUTLS_E_AGAIN) { in dnstls_stream_on_io()
127 …stream->dnstls_events = gnutls_record_get_direction(stream->dnstls_data.session) == 1 ? EPOLLOUT :… in dnstls_stream_on_io()
129 } else if (stream->dnstls_data.handshake < 0) { in dnstls_stream_on_io()
130 …log_debug("Failed to invoke gnutls_handshake: %s", gnutls_strerror(stream->dnstls_data.handshake)); in dnstls_stream_on_io()
131 if (gnutls_error_is_fatal(stream->dnstls_data.handshake)) in dnstls_stream_on_io()
146 assert(stream->dnstls_data.session); in dnstls_stream_shutdown()
149 …if (stream->server && stream->server->dnstls_data.session_data.size == 0 && stream->dnstls_data.ha… in dnstls_stream_shutdown()
150 … gnutls_session_get_data2(stream->dnstls_data.session, &stream->server->dnstls_data.session_data); in dnstls_stream_shutdown()
153 r = gnutls_bye(stream->dnstls_data.session, GNUTLS_SHUT_RDWR); in dnstls_stream_shutdown()
155 if (!stream->dnstls_data.shutdown) { in dnstls_stream_shutdown()
156 stream->dnstls_data.shutdown = true; in dnstls_stream_shutdown()
172 assert(stream->dnstls_data.session); in dnstls_stream_writev()
176 gnutls_record_cork(stream->dnstls_data.session); in dnstls_stream_writev()
180 stream->dnstls_data.session, in dnstls_stream_writev()
186 ss = gnutls_record_uncork(stream->dnstls_data.session, 0); in dnstls_stream_writev()
207 assert(stream->dnstls_data.session); in dnstls_stream_read()
210 ss = gnutls_record_recv(stream->dnstls_data.session, buf, count); in dnstls_stream_read()
229 if (server->dnstls_data.session_data.data) in dnstls_server_free()
230 gnutls_free(server->dnstls_data.session_data.data); in dnstls_server_free()
237 r = gnutls_certificate_allocate_credentials(&manager->dnstls_data.cert_cred); in dnstls_manager_init()
241 r = gnutls_certificate_set_x509_system_trust(manager->dnstls_data.cert_cred); in dnstls_manager_init()
251 if (manager->dnstls_data.cert_cred) in dnstls_manager_free()
252 gnutls_certificate_free_credentials(manager->dnstls_data.cert_cred); in dnstls_manager_free()