static int start_auth_vencrypt_subauth(VncState *vs)

{

    switch (vs->vd->subauth) {

    case VNC_AUTH_VENCRYPT_TLSNONE:

    case VNC_AUTH_VENCRYPT_X509NONE:

       VNC_DEBUG("Accept TLS auth none\n");

       vnc_write_u32(vs, 0); /* Accept auth completion */

       vnc_read_when(vs, protocol_client_init, 1);

       break;



    case VNC_AUTH_VENCRYPT_TLSVNC:

    case VNC_AUTH_VENCRYPT_X509VNC:

       VNC_DEBUG("Start TLS auth VNC\n");

       return start_auth_vnc(vs);



    default: /* Should not be possible, but just in case */

       VNC_DEBUG("Reject auth %d\n", vs->vd->auth);

       vnc_write_u8(vs, 1);

       if (vs->minor >= 8) {

           static const char err[] = "Unsupported authentication type";

           vnc_write_u32(vs, sizeof(err));

           vnc_write(vs, err, sizeof(err));

       }

       vnc_client_error(vs);

    }



    return 0;

}

static int start_auth_vencrypt_subauth(VncState *vs)

{

    switch (vs->vd->subauth) {

    case VNC_AUTH_VENCRYPT_TLSNONE:

    case VNC_AUTH_VENCRYPT_X509NONE:

       VNC_DEBUG("Accept TLS auth none\n");

       vnc_write_u32(vs, 0); 

       vnc_read_when(vs, protocol_client_init, 1);

       break;



    case VNC_AUTH_VENCRYPT_TLSVNC:

    case VNC_AUTH_VENCRYPT_X509VNC:

       VNC_DEBUG("Start TLS auth VNC\n");

       return start_auth_vnc(vs);



    default: 

       VNC_DEBUG("Reject auth %d\n", vs->vd->auth);

       vnc_write_u8(vs, 1);

       if (vs->minor >= 8) {

           static const char err[] = "Unsupported authentication type";

           vnc_write_u32(vs, sizeof(err));

           vnc_write(vs, err, sizeof(err));

       }

       vnc_client_error(vs);

    }



    return 0;

}

static int FUNC_0(VncState *VAR_0)

{

    switch (VAR_0->vd->subauth) {

    case VNC_AUTH_VENCRYPT_TLSNONE:

    case VNC_AUTH_VENCRYPT_X509NONE:

       VNC_DEBUG("Accept TLS auth none\n");

       vnc_write_u32(VAR_0, 0); 

       vnc_read_when(VAR_0, protocol_client_init, 1);

       break;



    case VNC_AUTH_VENCRYPT_TLSVNC:

    case VNC_AUTH_VENCRYPT_X509VNC:

       VNC_DEBUG("Start TLS auth VNC\n");

       return start_auth_vnc(VAR_0);



    default: 

       VNC_DEBUG("Reject auth %d\n", VAR_0->vd->auth);

       vnc_write_u8(VAR_0, 1);

       if (VAR_0->minor >= 8) {

           static const char VAR_1[] = "Unsupported authentication type";

           vnc_write_u32(VAR_0, sizeof(VAR_1));

           vnc_write(VAR_0, VAR_1, sizeof(VAR_1));

       }

       vnc_client_error(VAR_0);

    }



    return 0;

}

static int FUNC_0(VncState *VAR_0)
{ switch (VAR_0->vd->subauth) { case VNC_AUTH_VENCRYPT_TLSNONE:
case VNC_AUTH_VENCRYPT_X509NONE:
VNC_DEBUG("Accept TLS auth none\n"); vnc_write_u32(VAR_0, 0); vnc_read_when(VAR_0, protocol_client_init, 1); break; case VNC_AUTH_VENCRYPT_TLSVNC:
case VNC_AUTH_VENCRYPT_X509VNC:
VNC_DEBUG("Start TLS auth VNC\n"); return start_auth_vnc(VAR_0); default:
VNC_DEBUG("Reject auth %d\n", VAR_0->vd->auth); vnc_write_u8(VAR_0, 1); if (VAR_0->minor >= 8) { static const char VAR_1[] = "Unsupported authentication type"; vnc_write_u32(VAR_0, sizeof(VAR_1)); vnc_write(VAR_0, VAR_1, sizeof(VAR_1)); } vnc_client_error(VAR_0); } return 0; }