Skip to contentSkip to conversation

package/libvncserver: fix build with libressl >= 3.5.0

PATCH Applied Fabrice Fontaine 2 participants 2 messages May 12, 2022 – May 14, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/libvncserver: fix build with libressl >= 3.5.0

Fix the following build failure with libressl raised since bump to version 3.5.2 in commit 8b216927db080b38fdbf1f8b025b6f90a89d4bc2:

/nvmedata/autobuild/instance-26/output-1/build/libvncserver-0.9.13/common/crypto_openssl.c: In function 'dh_generate_keypair':
/nvmedata/autobuild/instance-26/output-1/build/libvncserver-0.9.13/common/crypto_openssl.c:149:7: error: dereferencing pointer to incomplete type 'DH' {aka 'struct dh_st'}

  149 |     dh->p = BN_bin2bn(prime, keylen, NULL);
      |       ^~

Fixes:
- http://autobuild.buildroot.org/results/49b3940b9d0432cb5fb0c5d22dfa017b18c6e233

---
 ...enssl.c-fix-build-with-libressl-3.5..patch | 66 +++++++++++++++++++
 1 file changed, 66 insertions(+)
 create mode 100644 package/libvncserver/0001-common-crypto_openssl.c-fix-build-with-libressl-3.5..patch
package/libvncserver/0001-common-crypto_openssl.c-fix-build-with-libressl-3.5..patch new file +66 -0
new file mode 100644
index 0000000000..110976c4bb
@@ -0,0 +1,66 @@
+From 97fbbd678b2012e64acddd523677bc55a177bc58 Mon Sep 17 00:00:00 2001
+From: Fabrice Fontaine <[email protected]>
+Date: Thu, 12 May 2022 20:41:50 +0200
+Subject: [PATCH] common/crypto_openssl.c: fix build with libressl >= 3.5.0
+ (#522)
+
+Fix the following build failure with libressl >= 3.5.0:
+
+/nvmedata/autobuild/instance-26/output-1/build/libvncserver-0.9.13/common/crypto_openssl.c: In function 'dh_generate_keypair':
+/nvmedata/autobuild/instance-26/output-1/build/libvncserver-0.9.13/common/crypto_openssl.c:149:7: error: dereferencing pointer to incomplete type 'DH' {aka 'struct dh_st'}
+  149 |     dh->p = BN_bin2bn(prime, keylen, NULL);
+      |       ^~
+
+Fixes:
+ - http://autobuild.buildroot.org/results/49b3940b9d0432cb5fb0c5d22dfa017b18c6e233
+
+Signed-off-by: Fabrice Fontaine <[email protected]>
+[Retrieved from:
+https://github.com/LibVNC/libvncserver/commit/97fbbd678b2012e64acddd523677bc55a177bc58]
+---
+ common/crypto_openssl.c | 12 ++++++++----
+ 1 file changed, 8 insertions(+), 4 deletions(-)
+
+diff --git a/common/crypto_openssl.c b/common/crypto_openssl.c
+index 60d4bd4df..51d7ec2d9 100644
+--- a/common/crypto_openssl.c
++++ b/common/crypto_openssl.c
+@@ -138,14 +138,16 @@ int dh_generate_keypair(uint8_t *priv_out, uint8_t *pub_out, const uint8_t *gen,
+ {
+     int result = 0;
+     DH *dh;
+-#if OPENSSL_VERSION_NUMBER >= 0x10100000L
++#if OPENSSL_VERSION_NUMBER >= 0x10100000L || \
++	(defined (LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER >= 0x30500000)
+     const BIGNUM *pub_key = NULL;
+     const BIGNUM *priv_key = NULL;
+ #endif
+ 
+     if(!(dh = DH_new()))
+ 	goto out;
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined LIBRESSL_VERSION_NUMBER
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || \
++	(defined (LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x30500000)
+     dh->p = BN_bin2bn(prime, keylen, NULL);
+     dh->g = BN_bin2bn(gen, gen_len, NULL);
+ #else
+@@ -154,7 +156,8 @@ int dh_generate_keypair(uint8_t *priv_out, uint8_t *pub_out, const uint8_t *gen,
+ #endif
+     if(!DH_generate_key(dh))
+ 	goto out;
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined LIBRESSL_VERSION_NUMBER
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || \
++	(defined (LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x30500000)
+     if(BN_bn2bin(dh->priv_key, priv_out) == 0)
+ 	goto out;
+     if(BN_bn2bin(dh->pub_key, pub_out) == 0)
+@@ -181,7 +184,8 @@ int dh_compute_shared_key(uint8_t *shared_out, const uint8_t *priv, const uint8_
+ 
+     if(!(dh = DH_new()))
+ 	goto out;
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined LIBRESSL_VERSION_NUMBER
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || \
++	(defined LIBRESSL_VERSION_NUMBER && LIBRESSL_VERSION_NUMBER < 0x30500000)
+     dh->p = BN_bin2bn(prime, keylen, NULL);
+     dh->priv_key = BN_bin2bn(priv, keylen, NULL);
+ #else
Signature · 6 lines
2.35.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw
Quoted 5 lines · Fabrice Fontaine

Fix the following build failure with libressl raised since bump to version 3.5.2 in commit 8b216927db080b38fdbf1f8b025b6f90a89d4bc2:

/nvmedata/autobuild/instance-26/output-1/build/libvncserver-0.9.13/common/crypto_openssl.c: In function 'dh_generate_keypair':
/nvmedata/autobuild/instance-26/output-1/build/libvncserver-0.9.13/common/crypto_openssl.c:149:7: error: dereferencing pointer to incomplete type 'DH' {aka 'struct dh_st'}

Quoted 7 lines
   149 |     dh->p = BN_bin2bn(prime, keylen, NULL);
       |       ^~

Fixes:
- http://autobuild.buildroot.org/results/49b3940b9d0432cb5fb0c5d22dfa017b18c6e233

Applied to master, thanks.

Regards,
Arnout

Quoted 67 lines
---
  ...enssl.c-fix-build-with-libressl-3.5..patch | 66 +++++++++++++++++++
  1 file changed, 66 insertions(+)

create mode 100644 package/libvncserver/0001-common-crypto_openssl.c-fix-build-with-libressl-3.5..patch

package/libvncserver/0001-common-crypto_openssl.c-fix-build-with-libressl-3.5..patch new file +56 -0
new file mode 100644
index 0000000000..110976c4bb
@@ -0,0 +1,66 @@
+From 97fbbd678b2012e64acddd523677bc55a177bc58 Mon Sep 17 00:00:00 2001
+From: Fabrice Fontaine <[email protected]>
+Date: Thu, 12 May 2022 20:41:50 +0200
+Subject: [PATCH] common/crypto_openssl.c: fix build with libressl >= 3.5.0
+ (#522)
+
+Fix the following build failure with libressl >= 3.5.0:
+
+/nvmedata/autobuild/instance-26/output-1/build/libvncserver-0.9.13/common/crypto_openssl.c: In function 'dh_generate_keypair':
+/nvmedata/autobuild/instance-26/output-1/build/libvncserver-0.9.13/common/crypto_openssl.c:149:7: error: dereferencing pointer to incomplete type 'DH' {aka 'struct dh_st'}
+  149 |     dh->p = BN_bin2bn(prime, keylen, NULL);
+      |       ^~
+
+Fixes:
+ - http://autobuild.buildroot.org/results/49b3940b9d0432cb5fb0c5d22dfa017b18c6e233
+
+Signed-off-by: Fabrice Fontaine <[email protected]>
+[Retrieved from:
+https://github.com/LibVNC/libvncserver/commit/97fbbd678b2012e64acddd523677bc55a177bc58]
+---
+ common/crypto_openssl.c | 12 ++++++++----
+ 1 file changed, 8 insertions(+), 4 deletions(-)
+
+diff --git a/common/crypto_openssl.c b/common/crypto_openssl.c
+index 60d4bd4df..51d7ec2d9 100644
+--- a/common/crypto_openssl.c
++++ b/common/crypto_openssl.c
+@@ -138,14 +138,16 @@ int dh_generate_keypair(uint8_t *priv_out, uint8_t *pub_out, const uint8_t *gen,
+ {
+     int result = 0;
+     DH *dh;
+-#if OPENSSL_VERSION_NUMBER >= 0x10100000L
++#if OPENSSL_VERSION_NUMBER >= 0x10100000L || \
++	(defined (LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER >= 0x30500000)
+     const BIGNUM *pub_key = NULL;
+     const BIGNUM *priv_key = NULL;
+ #endif
+
+     if(!(dh = DH_new()))
+ 	goto out;
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined LIBRESSL_VERSION_NUMBER
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || \
++	(defined (LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x30500000)
+     dh->p = BN_bin2bn(prime, keylen, NULL);
+     dh->g = BN_bin2bn(gen, gen_len, NULL);
+ #else
+@@ -154,7 +156,8 @@ int dh_generate_keypair(uint8_t *priv_out, uint8_t *pub_out, const uint8_t *gen,
+ #endif
+     if(!DH_generate_key(dh))
+ 	goto out;
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined LIBRESSL_VERSION_NUMBER
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || \
++	(defined (LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x30500000)
+     if(BN_bn2bin(dh->priv_key, priv_out) == 0)
+ 	goto out;
+     if(BN_bn2bin(dh->pub_key, pub_out) == 0)

package/libvncserver/0001-common-crypto_openssl.c-fix-build-with-libressl-3.5..patch line 66

Quoted 10 lines
package/libvncserver/0001-common-crypto_openssl.c-fix-build-with-libressl-3.5..patch new file +10 -0
+@@ -181,7 +184,8 @@ int dh_compute_shared_key(uint8_t *shared_out, const uint8_t *priv, const uint8_
+
+     if(!(dh = DH_new()))
+ 	goto out;
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined LIBRESSL_VERSION_NUMBER
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || \
++	(defined LIBRESSL_VERSION_NUMBER && LIBRESSL_VERSION_NUMBER < 0x30500000)
+     dh->p = BN_bin2bn(prime, keylen, NULL);
+     dh->priv_key = BN_bin2bn(priv, keylen, NULL);
+ #else

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot