static void vncws_tls_handshake_io(void *opaque) { struct VncState *vs = (struct VncState *)opaque; VNC_DEBUG("Handshake IO continue\n"); vncws_start_tls_handshake(vs); }
void vncws_tls_handshake_io(void *opaque) { VncState *vs = (VncState *)opaque; Error *err = NULL; vs->tls = qcrypto_tls_session_new(vs->vd->tlscreds, NULL, vs->vd->tlsaclname, QCRYPTO_TLS_CREDS_ENDPOINT_SERVER, &err); if (!vs->tls) { VNC_DEBUG("Failed to setup TLS %s\n", error_get_pretty(err)); error_free(err); vnc_client_error(vs); return; } qcrypto_tls_session_set_callbacks(vs->tls, vnc_tls_push, vnc_tls_pull, vs); VNC_DEBUG("Start TLS WS handshake process\n"); vncws_start_tls_handshake(vs); }
void vncws_tls_handshake_io(void *opaque) { struct VncState *vs = (struct VncState *)opaque; if (!vs->tls.session) { VNC_DEBUG("TLS Websocket setup\n"); if (vnc_tls_client_setup(vs, vs->vd->tls.x509cert != NULL) < 0) { return; } } VNC_DEBUG("Handshake IO continue\n"); vncws_start_tls_handshake(vs); }
void vncws_tls_handshake_peek(void *opaque) { VncState *vs = opaque; long ret; if (!vs->ws_tls.session) { char peek[4]; ret = qemu_recv(vs->csock, peek, sizeof(peek), MSG_PEEK); if (ret && (strncmp(peek, "\x16", 1) == 0 || strncmp(peek, "\x80", 1) == 0)) { VNC_DEBUG("TLS Websocket connection recognized"); vnc_tls_client_setup(vs, 1); vncws_start_tls_handshake(vs); } else { vncws_handshake_read(vs); } } else { qemu_set_fd_handler2(vs->csock, NULL, vncws_handshake_read, NULL, vs); } }