Fixed building with newer GNUTLS versions.
PATCH 1/1 Fixed building with newer GNUTLS versions.
--- vnc.c | 71 +++++++++++++++++++++++++++++++++++++++++++++---------------------- 1 file changed, 48 insertions(+), 23 deletions(-)
vnc.c +48 -23
@@ -1925,9 +1925,9 @@ static int vnc_tls_initialize(void)return 1 ; } -static gnutls_anon_server_credentials vnc_tls_initialize_anon_cred (void ) +static gnutls_anon_server_credentials_t vnc_tls_initialize_anon_cred (void ) { -gnutls_anon_server_credentials anon_cred; +gnutls_anon_server_credentials_t anon_cred;int ret;if ((ret =gnutls_anon_allocate_server_credentials (&anon_cred)) <0 ) {
@@ -2151,13 +2151,52 @@ static void vnc_handshake_io(void *opaque) { (vs)->subauth == VNC_AUTH_VENCRYPT_X509VNC || \ (vs)->subauth == VNC_AUTH_VENCRYPT_X509PLAIN) +#if defined(GNUTLS_VERSION_NUMBER ) && \ +GNUTLS_VERSION_NUMBER >=0x020200 /* 2.2.0 */ +static int vnc_set_gnutls_priority (gnutls_session_t s,int x509) +{ +const char *priority = x509 ?"NORMAL" :"NORMAL:+ANON-DH" ; +int rc; -static int vnc_start_tls (struct VncState *vs) { -static const int cert_type_priority[] = {GNUTLS_CRT_X509 ,0 }; -static const int protocol_priority[]= {GNUTLS_TLS1_1 ,GNUTLS_TLS1_0 ,GNUTLS_SSL3 ,0 }; -static const int kx_anon[] = {GNUTLS_KX_ANON_DH ,0 }; -static const int kx_x509[] = {GNUTLS_KX_DHE_DSS ,GNUTLS_KX_RSA ,GNUTLS_KX_DHE_RSA ,GNUTLS_KX_SRP ,0 }; + rc =gnutls_priority_set_direct (s, priority,NULL ); +if (rc !=GNUTLS_E_SUCCESS ) { +return -1 ; + } +return 0 ; +} +#else +static int vnc_set_gnutls_priority (gnutls_session_t s,int x509) +{ +static const int cert_types[] = {GNUTLS_CRT_X509 ,0 }; +static const int protocols[] = { +GNUTLS_TLS1_1 ,GNUTLS_TLS1_0 ,GNUTLS_SSL3 ,0 + }; +static const int kx_anon[] = {GNUTLS_KX_ANON_DH ,0 }; +static const int kx_x509[] = { +GNUTLS_KX_DHE_DSS ,GNUTLS_KX_RSA , +GNUTLS_KX_DHE_RSA ,GNUTLS_KX_SRP ,0 + }; +int rc; + + rc =gnutls_kx_set_priority (s, x509 ? kx_x509 : kx_anon); +if (rc !=GNUTLS_E_SUCCESS ) { +return -1 ; + } + + rc =gnutls_certificate_type_set_priority (s, cert_types); +if (rc !=GNUTLS_E_SUCCESS ) { +return -1 ; + } + rc =gnutls_protocol_set_priority (s, protocols); +if (rc !=GNUTLS_E_SUCCESS ) { +return -1 ; + } +return 0 ; +} +#endif + +static int vnc_start_tls (struct VncState *vs) {VNC_DEBUG ("Do TLS setup\n" );if (vnc_tls_initialize () <0 ) {VNC_DEBUG ("Failed to init TLS\n" );
@@ -2177,21 +2216,7 @@ static int vnc_start_tls(struct VncState *vs) {return -1 ; } -if (gnutls_kx_set_priority (vs->tls_session,NEED_X509_AUTH (vs) ? kx_x509 : kx_anon) <0 ) { -gnutls_deinit (vs->tls_session); - vs->tls_session =NULL ; -vnc_client_error (vs); -return -1 ; - } - -if (gnutls_certificate_type_set_priority (vs->tls_session, cert_type_priority) <0 ) { -gnutls_deinit (vs->tls_session); - vs->tls_session =NULL ; -vnc_client_error (vs); -return -1 ; - } - -if (gnutls_protocol_set_priority (vs->tls_session, protocol_priority) <0 ) { +if (vnc_set_gnutls_priority (vs->tls_session, !!NEED_X509_AUTH (vs)) <0 ) {gnutls_deinit (vs->tls_session); vs->tls_session =NULL ;vnc_client_error (vs);
@@ -2219,7 +2244,7 @@ static int vnc_start_tls(struct VncState *vs) { } }else { -gnutls_anon_server_credentials anon_cred =vnc_tls_initialize_anon_cred (); +gnutls_anon_server_credentials_t anon_cred =vnc_tls_initialize_anon_cred ();if (!anon_cred) {gnutls_deinit (vs->tls_session); vs->tls_session =NULL ;
Signature · 7 lines
2.8.0.rc3 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
QEMU-TRAD Re: [PATCH] Fixed building with newer GNUTLS versions.
On Thu, Mar 31, 2016 at 10:58:19PM +0200, Sjoer van der Ploeg wrote:
Heya!
Thank you for posting this and also adding the #ifdef for older versions!
Was wondering thought - had you double-checked that the new code path works with the certs?
Thanks!
P.S.
CC-ing Ian who is the QEMU-traditional maintainer.
Quoted 119 lines
Signed-off-by Sjoer van der Ploeg <[email protected]>--- vnc.c | 71 +++++++++++++++++++++++++++++++++++++++++++++---------------------- 1 file changed, 48 insertions(+), 23 deletions(-)vnc.c +48
-23@@ -1925,9 +1925,9 @@ static int vnc_tls_initialize(void)return 1 ; } -static gnutls_anon_server_credentials vnc_tls_initialize_anon_cred (void ) +static gnutls_anon_server_credentials_t vnc_tls_initialize_anon_cred (void ) { -gnutls_anon_server_credentials anon_cred; +gnutls_anon_server_credentials_t anon_cred;int ret;if ((ret =gnutls_anon_allocate_server_credentials (&anon_cred)) <0 ) {@@ -2151,13 +2151,52 @@ static void vnc_handshake_io(void *opaque) { (vs)->subauth == VNC_AUTH_VENCRYPT_X509VNC || \ (vs)->subauth == VNC_AUTH_VENCRYPT_X509PLAIN) +#if defined(GNUTLS_VERSION_NUMBER ) && \ +GNUTLS_VERSION_NUMBER >=0x020200 /* 2.2.0 */ +static int vnc_set_gnutls_priority (gnutls_session_t s,int x509) +{ +const char *priority = x509 ?"NORMAL" :"NORMAL:+ANON-DH" ; +int rc; -static int vnc_start_tls (struct VncState *vs) { -static const int cert_type_priority[] = {GNUTLS_CRT_X509 ,0 }; -static const int protocol_priority[]= {GNUTLS_TLS1_1 ,GNUTLS_TLS1_0 ,GNUTLS_SSL3 ,0 }; -static const int kx_anon[] = {GNUTLS_KX_ANON_DH ,0 }; -static const int kx_x509[] = {GNUTLS_KX_DHE_DSS ,GNUTLS_KX_RSA ,GNUTLS_KX_DHE_RSA ,GNUTLS_KX_SRP ,0 }; + rc =gnutls_priority_set_direct (s, priority,NULL ); +if (rc !=GNUTLS_E_SUCCESS ) { +return -1 ; + } +return 0 ; +} +#else +static int vnc_set_gnutls_priority (gnutls_session_t s,int x509) +{ +static const int cert_types[] = {GNUTLS_CRT_X509 ,0 }; +static const int protocols[] = { +GNUTLS_TLS1_1 ,GNUTLS_TLS1_0 ,GNUTLS_SSL3 ,0 + }; +static const int kx_anon[] = {GNUTLS_KX_ANON_DH ,0 }; +static const int kx_x509[] = { +GNUTLS_KX_DHE_DSS ,GNUTLS_KX_RSA , +GNUTLS_KX_DHE_RSA ,GNUTLS_KX_SRP ,0 + }; +int rc; + + rc =gnutls_kx_set_priority (s, x509 ? kx_x509 : kx_anon); +if (rc !=GNUTLS_E_SUCCESS ) { +return -1 ; + } + + rc =gnutls_certificate_type_set_priority (s, cert_types); +if (rc !=GNUTLS_E_SUCCESS ) { +return -1 ; + } + rc =gnutls_protocol_set_priority (s, protocols); +if (rc !=GNUTLS_E_SUCCESS ) { +return -1 ; + } +return 0 ; +} +#endif + +static int vnc_start_tls (struct VncState *vs) {VNC_DEBUG ("Do TLS setup\n" );if (vnc_tls_initialize () <0 ) {VNC_DEBUG ("Failed to init TLS\n" );@@ -2177,21 +2216,7 @@ static int vnc_start_tls(struct VncState *vs) {return -1 ; } -if (gnutls_kx_set_priority (vs->tls_session,NEED_X509_AUTH (vs) ? kx_x509 : kx_anon) <0 ) { -gnutls_deinit (vs->tls_session); - vs->tls_session =NULL ; -vnc_client_error (vs); -return -1 ; - } - -if (gnutls_certificate_type_set_priority (vs->tls_session, cert_type_priority) <0 ) { -gnutls_deinit (vs->tls_session); - vs->tls_session =NULL ; -vnc_client_error (vs); -return -1 ; - } - -if (gnutls_protocol_set_priority (vs->tls_session, protocol_priority) <0 ) { +if (vnc_set_gnutls_priority (vs->tls_session, !!NEED_X509_AUTH (vs)) <0 ) {gnutls_deinit (vs->tls_session); vs->tls_session =NULL ;vnc_client_error (vs);@@ -2219,7 +2244,7 @@ static int vnc_start_tls(struct VncState *vs) { } }else { -gnutls_anon_server_credentials anon_cred =vnc_tls_initialize_anon_cred (); +gnutls_anon_server_credentials_t anon_cred =vnc_tls_initialize_anon_cred ();if (!anon_cred) {gnutls_deinit (vs->tls_session); vs->tls_session =NULL ;Signature · 7 lines
2.8.0.rc3 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
A message that is not in the archive (sent off-list or not yet received): CAGj-wbF_R7dgRyNyY6ydnvW-P1aV7-rVLfvkH3B_oyf0w0Fy5A@mail.gmail.com
Re: QEMU-TRAD Re: [PATCH] Fixed building with newer GNUTLS versions.
Quoted 11 lines · Sjoer van der Ploeg
Dear Konrad,
The patch was tested on my testbed, after discovering that the build failed. I had no need for qemu-traditional and forgot to disable it, but I hate build errors ;)
I do not think there should be any issues with the certs, as the used functions were deprecated as explained here:
https://www.gnutls.org/manual/html_node/Upgrading-from-previous-versions.html
Thank you for the explanation.
Re-adding xen-devel and Ian as that information is most helkpul in the commit description!
Thank you.
Quoted 154 lines
Yours,
Sjoer van der Ploeg
Quoted 145 lines · Konrad Rzeszutek Wilk
On Thu, Mar 31, 2016 at 10:58:19PM +0200, Sjoer van der Ploeg wrote:
Heya!
Thank you for posting this and also adding the #ifdef for older versions!
Was wondering thought - had you double-checked that the new code path works with the certs?
Thanks!
P.S.
CC-ing Ian who is the QEMU-traditional maintainer.Quoted 3 lines
Signed-off-by Sjoer van der Ploeg <[email protected]>--- vnc.c | 71+++++++++++++++++++++++++++++++++++++++++++++----------------------
vnc.c static int vnc_tls_initialize(void) · line 1928
Quoted 12 lines
1 file changed, 48 insertions(+), 23 deletions(-)vnc.c +1
-1@@ -1925,9 +1925,9 @@ static int vnc_tls_initialize(void)return 1 ; } -static gnutls_anon_server_credentials vnc_tls_initialize_anon_cred (void ) +static gnutls_anon_server_credentials_t
vnc_tls_initialize_anon_cred(void)vnc.c static int vnc_tls_initialize(void)
Quoted 6 lines
vnc.c +1
-1{ -gnutls_anon_server_credentials anon_cred; +gnutls_anon_server_credentials_t anon_cred;int ret; if ((ret = gnutls_anon_allocate_server_credentials(&anon_cred)) <0) {
Quoted 4 lines
vnc.c +0
-0@@ -2151,13 +2151,52 @@ static void vnc_handshake_io(void *opaque) { (vs)->subauth ==VNC_AUTH_VENCRYPT_X509VNC || \ (vs)->subauth == VNC_AUTH_VENCRYPT_X509PLAIN)vnc.c static void vnc_handshake_io(void *opaque) { · line 2157
Quoted 10 lines
vnc.c +6
-3+#if defined(GNUTLS_VERSION_NUMBER ) && \ +GNUTLS_VERSION_NUMBER >=0x020200 /* 2.2.0 */ +static int vnc_set_gnutls_priority (gnutls_session_t s,int x509) +{ +const char *priority = x509 ?"NORMAL" :"NORMAL:+ANON-DH" ; +int rc; -static int vnc_start_tls (struct VncState *vs) { -static const int cert_type_priority[] = {GNUTLS_CRT_X509 ,0 }; -static const int protocol_priority[]= {GNUTLS_TLS1_1 ,
GNUTLS_TLS1_0,GNUTLS_SSL3, 0 };vnc.c static void vnc_handshake_io(void *opaque) { · line 2159
Quoted 2 lines
vnc.c +0
-2-static const int kx_anon[] = {GNUTLS_KX_ANON_DH ,0 }; -static const int kx_x509[] = {GNUTLS_KX_DHE_DSS ,GNUTLS_KX_RSA ,
GNUTLS_KX_DHE_RSA,GNUTLS_KX_SRP, 0};Quoted 43 lines
vnc.c +38
-0+ rc =gnutls_priority_set_direct (s, priority,NULL ); +if (rc !=GNUTLS_E_SUCCESS ) { +return -1 ; + } +return 0 ; +} +#else +static int vnc_set_gnutls_priority (gnutls_session_t s,int x509) +{ +static const int cert_types[] = {GNUTLS_CRT_X509 ,0 }; +static const int protocols[] = { +GNUTLS_TLS1_1 ,GNUTLS_TLS1_0 ,GNUTLS_SSL3 ,0 + }; +static const int kx_anon[] = {GNUTLS_KX_ANON_DH ,0 }; +static const int kx_x509[] = { +GNUTLS_KX_DHE_DSS ,GNUTLS_KX_RSA , +GNUTLS_KX_DHE_RSA ,GNUTLS_KX_SRP ,0 + }; +int rc; + + rc =gnutls_kx_set_priority (s, x509 ? kx_x509 : kx_anon); +if (rc !=GNUTLS_E_SUCCESS ) { +return -1 ; + } + + rc =gnutls_certificate_type_set_priority (s, cert_types); +if (rc !=GNUTLS_E_SUCCESS ) { +return -1 ; + } + rc =gnutls_protocol_set_priority (s, protocols); +if (rc !=GNUTLS_E_SUCCESS ) { +return -1 ; + } +return 0 ; +} +#endif + +static int vnc_start_tls (struct VncState *vs) {VNC_DEBUG ("Do TLS setup\n" );if (vnc_tls_initialize () <0 ) {VNC_DEBUG ("Failed to init TLS\n" );vnc.c static int vnc_start_tls(struct VncState *vs) { · line 2180
Quoted 4 lines
vnc.c +0
-1@@ -2177,21 +2216,7 @@ static int vnc_start_tls(struct VncState *vs) {return -1 ; } - if (gnutls_kx_set_priority(vs->tls_session, NEED_X509_AUTH(vs) ?
kx_x509:kx_anon) < 0) {vnc.c static int vnc_start_tls(struct VncState *vs) {
Quoted 7 lines
vnc.c +0
-7-gnutls_deinit (vs->tls_session); - vs->tls_session =NULL ; -vnc_client_error (vs); -return -1 ; - } - - if (gnutls_certificate_type_set_priority(vs->tls_session,
cert_type_priority) < 0) {vnc.c static int vnc_start_tls(struct VncState *vs) {
Quoted 7 lines
vnc.c +0
-7-gnutls_deinit (vs->tls_session); - vs->tls_session =NULL ; -vnc_client_error (vs); -return -1 ; - } - - if (gnutls_protocol_set_priority(vs->tls_session,
protocol_priority) < 0) {vnc.c static int vnc_start_tls(struct VncState *vs) { · line 2219
Quoted 1 line
vnc.c +1
-0+ if (vnc_set_gnutls_priority(vs->tls_session, !!NEED_X509_AUTH(vs))< 0) {
vnc.c static int vnc_start_tls(struct VncState *vs) { · line 2222
Quoted 8 lines
vnc.c +0
-1gnutls_deinit (vs->tls_session); vs->tls_session =NULL ;vnc_client_error (vs);@@ -2219,7 +2244,7 @@ static int vnc_start_tls(struct VncState *vs) { } }else { - gnutls_anon_server_credentials anon_cred =
vnc_tls_initialize_anon_cred();vnc.c static int vnc_start_tls(struct VncState *vs) { · line 2247
Quoted 1 line
vnc.c +1
-0+ gnutls_anon_server_credentials_t anon_cred =
vnc_tls_initialize_anon_cred();Quoted 11 lines
vnc.c +0
-1if (!anon_cred) {gnutls_deinit (vs->tls_session); vs->tls_session =NULL ; --2.8.0.rc3
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: QEMU-TRAD Re: [PATCH] Fixed building with newer GNUTLS versions.
On Fri, Apr 01, 2016 at 12:45:26PM -0400, Konrad Rzeszutek Wilk wrote:
Hey Wei, Ian,
We really need this for Xen 4.7 - otherwise you cannot build qemu-trad under Fedora Core 23:
home/konrad/ssd/konrad/xen/tools/qemu-xen-traditional-dir/hw/usb-net.c: In function ‘usbnet_receive’:/home/konrad/ssd/konrad/xen/tools/qemu-xen-traditional-dir/hw/usb-net.c:1379:29: warning: comparison of constant ‘2’ with boolean expression is always false [-Wbool-compare]
if (!s->rndis_state == RNDIS_DATA_INITIALIZED)
^
/home/konrad/ssd/konrad/xen/tools/qemu-xen-traditional-dir/hw/usb-net.c:1379:29: warning: logical not is only applied to the left hand side of comparison [-Wlogical-not-parentheses]
/home/konrad/ssd/konrad/xen/tools/qemu-xen-traditional-dir/hw/usb-net.c: In function ‘usbnet_can_receive’:
/home/konrad/ssd/konrad/xen/tools/qemu-xen-traditional-dir/hw/usb-net.c:1412:37: warning: comparison of constant ‘2’ with boolean expression is always false [-Wbool-compare]
if (s->rndis && !s->rndis_state == RNDIS_DATA_INITIALIZED)
^
/home/konrad/ssd/konrad/xen/tools/qemu-xen-traditional-dir/hw/usb-net.c:1412:37: warning: logical not is only applied to the left hand side of comparison [-Wlogical-not-parentheses]
audio/sdlaudio.c: In function ‘sdl_init_out’:
audio/sdlaudio.c:337:11: warning: ‘shift’ is used uninitialized in this function [-Wuninitialized]
shift <<= as->nchannels == 2;
^vnc.c:1929:1: warning: ‘gnutls_anon_server_credentials’ is deprecated [-Wdeprecated-declarations]
{
^vnc.c: In function ‘vnc_tls_initialize_anon_cred’:
vnc.c:1930:5: warning: ‘gnutls_anon_server_credentials’ is deprecated [-Wdeprecated-declarations]
gnutls_anon_server_credentials anon_cred;
^
vnc.c: In function ‘vnc_start_tls’:
vnc.c:2180:6: warning: implicit declaration of function ‘gnutls_kx_set_priority’ [-Wimplicit-function-declaration]
if (gnutls_kx_set_priority(vs->tls_session, NEED_X509_AUTH(vs) ? kx_x509 : kx_anon) < 0) {
^vnc.c:2187:6: warning: implicit declaration of function ‘gnutls_certificate_type_set_priority’ [-Wimplicit-function-declaration]
if (gnutls_certificate_type_set_priority(vs->tls_session, cert_type_priority) < 0) {
Thanks.
Quoted 11 lines · Sjoer van der Ploeg
Quoted 10 lines
Dear Konrad,
The patch was tested on my testbed, after discovering that the build failed. I had no need for qemu-traditional and forgot to disable it, but I hate build errors ;)
I do not think there should be any issues with the certs, as the used functions were deprecated as explained here:
Quoted 162 lines
Thank you for the explanation.
Re-adding xen-devel and Ian as that information is most helkpul in the commit description!
Thank you.
Quoted 154 lines
Yours,
Sjoer van der Ploeg
Quoted 145 lines · Konrad Rzeszutek Wilk
On Thu, Mar 31, 2016 at 10:58:19PM +0200, Sjoer van der Ploeg wrote:
Heya!
Thank you for posting this and also adding the #ifdef for older versions!
Was wondering thought - had you double-checked that the new code path works with the certs?
Thanks!
P.S.
CC-ing Ian who is the QEMU-traditional maintainer.Quoted 3 lines
Signed-off-by Sjoer van der Ploeg <[email protected]>--- vnc.c | 71+++++++++++++++++++++++++++++++++++++++++++++----------------------
vnc.c static int vnc_tls_initialize(void) · line 1928
Quoted 12 lines
1 file changed, 48 insertions(+), 23 deletions(-)vnc.c +1
-1@@ -1925,9 +1925,9 @@ static int vnc_tls_initialize(void)return 1 ; } -static gnutls_anon_server_credentials vnc_tls_initialize_anon_cred (void ) +static gnutls_anon_server_credentials_t
vnc_tls_initialize_anon_cred(void)vnc.c static int vnc_tls_initialize(void)
Quoted 6 lines
vnc.c +1
-1{ -gnutls_anon_server_credentials anon_cred; +gnutls_anon_server_credentials_t anon_cred;int ret; if ((ret = gnutls_anon_allocate_server_credentials(&anon_cred)) <0) {
Quoted 4 lines
vnc.c +0
-0@@ -2151,13 +2151,52 @@ static void vnc_handshake_io(void *opaque) { (vs)->subauth ==VNC_AUTH_VENCRYPT_X509VNC || \ (vs)->subauth == VNC_AUTH_VENCRYPT_X509PLAIN)vnc.c static void vnc_handshake_io(void *opaque) { · line 2157
Quoted 10 lines
vnc.c +6
-3+#if defined(GNUTLS_VERSION_NUMBER ) && \ +GNUTLS_VERSION_NUMBER >=0x020200 /* 2.2.0 */ +static int vnc_set_gnutls_priority (gnutls_session_t s,int x509) +{ +const char *priority = x509 ?"NORMAL" :"NORMAL:+ANON-DH" ; +int rc; -static int vnc_start_tls (struct VncState *vs) { -static const int cert_type_priority[] = {GNUTLS_CRT_X509 ,0 }; -static const int protocol_priority[]= {GNUTLS_TLS1_1 ,
GNUTLS_TLS1_0,GNUTLS_SSL3, 0 };vnc.c static void vnc_handshake_io(void *opaque) { · line 2159
Quoted 2 lines
vnc.c +0
-2-static const int kx_anon[] = {GNUTLS_KX_ANON_DH ,0 }; -static const int kx_x509[] = {GNUTLS_KX_DHE_DSS ,GNUTLS_KX_RSA ,
GNUTLS_KX_DHE_RSA,GNUTLS_KX_SRP, 0};Quoted 43 lines
vnc.c +38
-0+ rc =gnutls_priority_set_direct (s, priority,NULL ); +if (rc !=GNUTLS_E_SUCCESS ) { +return -1 ; + } +return 0 ; +} +#else +static int vnc_set_gnutls_priority (gnutls_session_t s,int x509) +{ +static const int cert_types[] = {GNUTLS_CRT_X509 ,0 }; +static const int protocols[] = { +GNUTLS_TLS1_1 ,GNUTLS_TLS1_0 ,GNUTLS_SSL3 ,0 + }; +static const int kx_anon[] = {GNUTLS_KX_ANON_DH ,0 }; +static const int kx_x509[] = { +GNUTLS_KX_DHE_DSS ,GNUTLS_KX_RSA , +GNUTLS_KX_DHE_RSA ,GNUTLS_KX_SRP ,0 + }; +int rc; + + rc =gnutls_kx_set_priority (s, x509 ? kx_x509 : kx_anon); +if (rc !=GNUTLS_E_SUCCESS ) { +return -1 ; + } + + rc =gnutls_certificate_type_set_priority (s, cert_types); +if (rc !=GNUTLS_E_SUCCESS ) { +return -1 ; + } + rc =gnutls_protocol_set_priority (s, protocols); +if (rc !=GNUTLS_E_SUCCESS ) { +return -1 ; + } +return 0 ; +} +#endif + +static int vnc_start_tls (struct VncState *vs) {VNC_DEBUG ("Do TLS setup\n" );if (vnc_tls_initialize () <0 ) {VNC_DEBUG ("Failed to init TLS\n" );vnc.c static int vnc_start_tls(struct VncState *vs) { · line 2180
Quoted 4 lines
vnc.c +0
-1@@ -2177,21 +2216,7 @@ static int vnc_start_tls(struct VncState *vs) {return -1 ; } - if (gnutls_kx_set_priority(vs->tls_session, NEED_X509_AUTH(vs) ?
kx_x509:kx_anon) < 0) {vnc.c static int vnc_start_tls(struct VncState *vs) {
Quoted 7 lines
vnc.c +0
-7-gnutls_deinit (vs->tls_session); - vs->tls_session =NULL ; -vnc_client_error (vs); -return -1 ; - } - - if (gnutls_certificate_type_set_priority(vs->tls_session,
cert_type_priority) < 0) {vnc.c static int vnc_start_tls(struct VncState *vs) {
Quoted 7 lines
vnc.c +0
-7-gnutls_deinit (vs->tls_session); - vs->tls_session =NULL ; -vnc_client_error (vs); -return -1 ; - } - - if (gnutls_protocol_set_priority(vs->tls_session,
protocol_priority) < 0) {vnc.c static int vnc_start_tls(struct VncState *vs) { · line 2219
Quoted 1 line
vnc.c +1
-0+ if (vnc_set_gnutls_priority(vs->tls_session, !!NEED_X509_AUTH(vs))< 0) {
vnc.c static int vnc_start_tls(struct VncState *vs) { · line 2222
Quoted 8 lines
vnc.c +0
-1gnutls_deinit (vs->tls_session); vs->tls_session =NULL ;vnc_client_error (vs);@@ -2219,7 +2244,7 @@ static int vnc_start_tls(struct VncState *vs) { } }else { - gnutls_anon_server_credentials anon_cred =
vnc_tls_initialize_anon_cred();vnc.c static int vnc_start_tls(struct VncState *vs) { · line 2247
Quoted 1 line
vnc.c +1
-0+ gnutls_anon_server_credentials_t anon_cred =
vnc_tls_initialize_anon_cred();Quoted 11 lines
vnc.c +0
-1if (!anon_cred) {gnutls_deinit (vs->tls_session); vs->tls_session =NULL ; --2.8.0.rc3
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: QEMU-TRAD Re: [PATCH] Fixed building with newer GNUTLS versions.
The original patch seems to malformed.
I skim the code, the refactoring parts look correct to me. What I'm not sure is whether the replacement is correct or not.
The reference to gnutls_priority_set_direct in [0] is from a section called "Upgrading to 3.4.x from 3.3.x", while the version check in the proposed patch checks for 2.2.0.
Do I miss anything here? What version does Fedora have?
Thanks
Wei.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: QEMU-TRAD Re: [PATCH] Fixed building with newer GNUTLS versions.
Quoted 10 lines · Wei Liu
The original patch seems to malformed.
I skim the code, the refactoring parts look correct to me. What I'm not sure is whether the replacement is correct or not.
The reference to
gnutls_priority_set_directin [0] is from a section called "Upgrading to 3.4.x from 3.3.x", while the version check in the proposed patch checks for 2.2.0.Do I miss anything here? What version does Fedora have?
gnutls-3.4.9-1.fc23.x86_64
qemu-trad builds fine under
gnutls-2.8.5-4.fc13.x86_64
Quoted 3 lines
Thanks
Wei.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: QEMU-TRAD Re: [PATCH] Fixed building with newer GNUTLS versions.
Quoted 10 lines · Konrad Rzeszutek Wilk
Quoted 9 lines · Wei Liu
The original patch seems to malformed.
I skim the code, the refactoring parts look correct to me. What I'm not sure is whether the replacement is correct or not.
The reference to
gnutls_priority_set_directin [0] is from a section called "Upgrading to 3.4.x from 3.3.x", while the version check in the proposed patch checks for 2.2.0.
Quoted 6 lines
Quoted 1 line
Do I miss anything here? What version does Fedora have?
gnutls-3.4.9-1.fc23.x86_64
qemu-trad builds fine under
gnutls-2.8.5-4.fc13.x86_64
So I guess we should fix the version checking in this patch. We should go with 3.4 because that's what is in the canonical source.
Wei.
Quoted 4 lines
Quoted 4 lines
Thanks
Wei.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: QEMU-TRAD Re: [PATCH] Fixed building with newer GNUTLS versions.
In reply to Konrad Rzeszutek WilkQuoted 10 lines · Konrad Rzeszutek Wilk
Quoted 9 lines · Wei Liu
The original patch seems to malformed.
I skim the code, the refactoring parts look correct to me. What I'm not sure is whether the replacement is correct or not.
The reference to
gnutls_priority_set_directin [0] is from a section called "Upgrading to 3.4.x from 3.3.x", while the version check in the proposed patch checks for 2.2.0.
Quoted 7 lines
Quoted 1 line
Do I miss anything here? What version does Fedora have?
gnutls-3.4.9-1.fc23.x86_64
qemu-trad builds fine under
gnutls-2.8.5-4.fc13.x86_64
Can you try the attached patch?
A higher level question to ask is whether the priority list in the patch is really correct. Specifically:
+ const char *priority = x509 ? "NORMAL" : "NORMAL:+ANON-DH";
---8<---
From c6d6259ee09620f46e3630b01949f62d6d3777fd Mon Sep 17 00:00:00 2001
From: Wei Liu <[email protected]>
Date: Thu, 31 Mar 2016 22:58:19 +0200
Subject: [PATCH] Fix build with GNUTLS > 3.4
gnutls_kx_set_priority, gnutls_certificate_type_set_priority and gnutls_protocol_set_priority are removed in 3.4. Application should use gnutls_priority_set_direct instead.
Provide compatibility layer for QEMU traditional.
[0] https://www.gnutls.org/manual/html_node/Upgrading-from-previous-versions.html
--- vnc.c | 71 +++++++++++++++++++++++++++++++++++++++++++++---------------------- 1 file changed, 48 insertions(+), 23 deletions(-)
vnc.c +48 -23
@@ -1925,9 +1925,9 @@ static int vnc_tls_initialize(void)return 1 ; } -static gnutls_anon_server_credentials vnc_tls_initialize_anon_cred (void ) +static gnutls_anon_server_credentials_t vnc_tls_initialize_anon_cred (void ) { -gnutls_anon_server_credentials anon_cred; +gnutls_anon_server_credentials_t anon_cred;int ret;if ((ret =gnutls_anon_allocate_server_credentials (&anon_cred)) <0 ) {
@@ -2151,13 +2151,52 @@ static void vnc_handshake_io(void *opaque) { (vs)->subauth == VNC_AUTH_VENCRYPT_X509VNC || \ (vs)->subauth == VNC_AUTH_VENCRYPT_X509PLAIN) +#if defined(GNUTLS_VERSION_NUMBER ) && \ +GNUTLS_VERSION_NUMBER >=0x030400 /* 3.4.0 */ +static int vnc_set_gnutls_priority (gnutls_session_t s,int x509) +{ +const char *priority = x509 ?"NORMAL" :"NORMAL:+ANON-DH" ; +int rc; -static int vnc_start_tls (struct VncState *vs) { -static const int cert_type_priority[] = {GNUTLS_CRT_X509 ,0 }; -static const int protocol_priority[]= {GNUTLS_TLS1_1 ,GNUTLS_TLS1_0 ,GNUTLS_SSL3 ,0 }; -static const int kx_anon[] = {GNUTLS_KX_ANON_DH ,0 }; -static const int kx_x509[] = {GNUTLS_KX_DHE_DSS ,GNUTLS_KX_RSA ,GNUTLS_KX_DHE_RSA ,GNUTLS_KX_SRP ,0 }; + rc =gnutls_priority_set_direct (s, priority,NULL ); +if (rc !=GNUTLS_E_SUCCESS ) { +return -1 ; + } +return 0 ; +} +#else +static int vnc_set_gnutls_priority (gnutls_session_t s,int x509) +{ +static const int cert_types[] = {GNUTLS_CRT_X509 ,0 }; +static const int protocols[] = { +GNUTLS_TLS1_1 ,GNUTLS_TLS1_0 ,GNUTLS_SSL3 ,0 + }; +static const int kx_anon[] = {GNUTLS_KX_ANON_DH ,0 }; +static const int kx_x509[] = { +GNUTLS_KX_DHE_DSS ,GNUTLS_KX_RSA , +GNUTLS_KX_DHE_RSA ,GNUTLS_KX_SRP ,0 + }; +int rc; + + rc =gnutls_kx_set_priority (s, x509 ? kx_x509 : kx_anon); +if (rc !=GNUTLS_E_SUCCESS ) { +return -1 ; + } + + rc =gnutls_certificate_type_set_priority (s, cert_types); +if (rc !=GNUTLS_E_SUCCESS ) { +return -1 ; + } + rc =gnutls_protocol_set_priority (s, protocols); +if (rc !=GNUTLS_E_SUCCESS ) { +return -1 ; + } +return 0 ; +} +#endif + +static int vnc_start_tls (struct VncState *vs) {VNC_DEBUG ("Do TLS setup\n" );if (vnc_tls_initialize () <0 ) {VNC_DEBUG ("Failed to init TLS\n" );
@@ -2177,21 +2216,7 @@ static int vnc_start_tls(struct VncState *vs) {return -1 ; } -if (gnutls_kx_set_priority (vs->tls_session,NEED_X509_AUTH (vs) ? kx_x509 : kx_anon) <0 ) { -gnutls_deinit (vs->tls_session); - vs->tls_session =NULL ; -vnc_client_error (vs); -return -1 ; - } - -if (gnutls_certificate_type_set_priority (vs->tls_session, cert_type_priority) <0 ) { -gnutls_deinit (vs->tls_session); - vs->tls_session =NULL ; -vnc_client_error (vs); -return -1 ; - } - -if (gnutls_protocol_set_priority (vs->tls_session, protocol_priority) <0 ) { +if (vnc_set_gnutls_priority (vs->tls_session, !!NEED_X509_AUTH (vs)) <0 ) {gnutls_deinit (vs->tls_session); vs->tls_session =NULL ;vnc_client_error (vs);
@@ -2219,7 +2244,7 @@ static int vnc_start_tls(struct VncState *vs) { } }else { -gnutls_anon_server_credentials anon_cred =vnc_tls_initialize_anon_cred (); +gnutls_anon_server_credentials_t anon_cred =vnc_tls_initialize_anon_cred ();if (!anon_cred) {gnutls_deinit (vs->tls_session); vs->tls_session =NULL ;
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
Re: QEMU-TRAD Re: [PATCH] Fixed building with newer GNUTLS versions.
vnc.c static void vnc_handshake_io(void *opaque) { · line 2155
Quoted 6 lines · Wei Liu
gnutls_kx_set_priority,gnutls_certificate_type_set_priorityandgnutls_protocol_set_priorityare removed in 3.4. Application should usegnutls_priority_set_directinstead.vnc.c +2
-0+#if defined(GNUTLS_VERSION_NUMBER ) && \ +GNUTLS_VERSION_NUMBER >=0x030400 /* 3.4.0 */
Quoting their NEWS file:
...
* Version 2.1.7 (released 2007-11-29)
...
** The gnutls_*_convert_priority() functions were deprecated by the gnutls_priority_set() and gnutls_priority_set_direct().
...
The initial variant of that patch looks more correct. It would cover each and every distribution Xen runs on.
Olaf
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: QEMU-TRAD Re: [PATCH] Fixed building with newer GNUTLS versions.
Quoted 9 lines · Olaf Hering
vnc.c static void vnc_handshake_io(void *opaque) { · line 2155
Quoted 6 lines · Wei Liu
gnutls_kx_set_priority,gnutls_certificate_type_set_priorityandgnutls_protocol_set_priorityare removed in 3.4. Application should usegnutls_priority_set_directinstead.vnc.c +2
-0+#if defined(GNUTLS_VERSION_NUMBER ) && \ +GNUTLS_VERSION_NUMBER >=0x030400 /* 3.4.0 */
Quoted 7 lines
Quoting their NEWS file:
...
* Version 2.1.7 (released 2007-11-29)
...
** The gnutls_*_convert_priority() functions were deprecated by thegnutls_priority_set()andgnutls_priority_set_direct().
These seem to be a different set of functions.
Do you have a link to the NEWS file so that I can read and put it into the commit message? https://www.gnutls.org/news.html doesn't seem to cover release that old.
Wei.
Quoted 6 lines
...
The initial variant of that patch looks more correct. It would cover each and every distribution Xen runs on.
Olaf
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: QEMU-TRAD Re: [PATCH] Fixed building with newer GNUTLS versions.
Quoted 3 lines · Wei Liu
Do you have a link to the NEWS file so that I can read and put it into the commit message? https://www.gnutls.org/news.html doesn't seem to cover release that old.
I cloned their git tree.
git clone https://gitlab.com/gnutls/gnutls.git
Thanks anyway for making progress on this error.
Olaf
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: QEMU-TRAD Re: [PATCH] Fixed building with newer GNUTLS versions.
Quoted 10 lines · Olaf Hering
Quoted 3 lines · Wei Liu
Do you have a link to the NEWS file so that I can read and put it into the commit message? https://www.gnutls.org/news.html doesn't seem to cover release that old.
I cloned their git tree.
git clone https://gitlab.com/gnutls/gnutls.git
OK. That works for me.
I will go check the gnutls repo and update this patch accordingly. In the meantime I will wait for comment on the priority list. If you know any documents please let me know.
Quoted 2 lines
Thanks anyway for making progress on this error.
Yeah, trying to tie up some loose ends for the release.
Wei.
Quoted 1 line
Olaf
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: QEMU-TRAD Re: [PATCH] Fixed building with newer GNUTLS versions.
Quoted 3 lines · Wei Liu
I will go check the gnutls repo and update this patch accordingly. In the meantime I will wait for comment on the priority list. If you know any documents please let me know.
I cant help with that.
My xen.rpm carries upstream commits f40d55081667a716312b9a8b6e13835c4074f56b and 7d2a929feba319c18603e324b1750830d6c8b7a1 since some time.
Olaf
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: QEMU-TRAD Re: [PATCH] Fixed building with newer GNUTLS versions.
Quoted 6 lines · Olaf Hering
Quoted 3 lines · Wei Liu
I will go check the gnutls repo and update this patch accordingly. In the meantime I will wait for comment on the priority list. If you know any documents please let me know.
Quoted 6 lines
I cant help with that.
My xen.rpm carries upstream commits
f40d55081667a716312b9a8b6e13835c4074f56band7d2a929feba319c18603e324b1750830d6c8b7a1since some time.
Are these gnutls.git commits?
$ cd gnutls $ git show f40d55081667a716312b9a8b6e13835c4074f56b fatal: bad object f40d55081667a716312b9a8b6e13835c4074f56b
Same for the other commit.
Wei.
Quoted 1 line
Olaf
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: QEMU-TRAD Re: [PATCH] Fixed building with newer GNUTLS versions.
Quoted 1 line · Wei Liu
Are these gnutls.git commits?
Its from qemu.git, after all its a bug in qemu.
Olaf
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: QEMU-TRAD Re: [PATCH] Fixed building with newer GNUTLS versions.
Quoted 6 lines · Olaf Hering
Quoted 1 line · Wei Liu
Are these gnutls.git commits?
Its from qemu.git, after all its a bug in qemu.
Oh, right. That makes sense!
In that case I can just use those commits. This is very useful information. Thank you very much!
Wei.
Quoted 1 line
Olaf
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel