FreeBSD Bugzilla – Attachment 247053 Details for
Bug 266670
lang/rust: fix build with libressl 3.7+
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
v1
0001-lang-rust-Fix-build-with-libressl.patch (text/plain), 16.34 KB, created by
Mikael Urankar
on 2023-12-15 11:57:41 UTC
(
hide
)
Description:
v1
Filename:
MIME Type:
Creator:
Mikael Urankar
Created:
2023-12-15 11:57:41 UTC
Size:
16.34 KB
patch
obsolete
>From b6119a69ba5d8f12dff5ba731b0bbc9fb1f78e3c Mon Sep 17 00:00:00 2001 >From: Mikael Urankar <mikael@FreeBSD.org> >Date: Sat, 9 Dec 2023 16:27:59 +0100 >Subject: [PATCH] lang/rust: Fix build with libressl > >Import the following upstream patch: > https://github.com/sfackler/rust-openssl/commit/fc1ca1f6c7251e79e51284d10bb2310eda7f9355 > https://github.com/sfackler/rust-openssl/commit/35c8e90b76d0f7a0b4064a0299d2fc529f9707a3 > https://github.com/sfackler/rust-openssl/commit/01cc521c7ee12fb2a907b7b83e372974c3f7c2bf > https://github.com/sfackler/rust-openssl/commit/6f6e5c4f02c370c594ccf404a4a67e366d26ad1c > https://github.com/sfackler/rust-openssl/commit/5b4edd8254eb09d657baec151dc570d8157bf81d >--- > lang/rust/files/patch-libressl | 431 +++++++++++++++++++++++++++++++++ > 1 file changed, 431 insertions(+) > create mode 100644 lang/rust/files/patch-libressl > >diff --git a/lang/rust/files/patch-libressl b/lang/rust/files/patch-libressl >new file mode 100644 >index 00000000000..43adc49a875 >--- /dev/null >+++ b/lang/rust/files/patch-libressl >@@ -0,0 +1,431 @@ >+https://github.com/sfackler/rust-openssl/commit/fc1ca1f6c7251e79e51284d10bb2310eda7f9355 >+ >+From fc1ca1f6c7251e79e51284d10bb2310eda7f9355 Mon Sep 17 00:00:00 2001 >+From: Alex Gaynor <alex.gaynor@gmail.com> >+Date: Fri, 1 Sep 2023 08:51:22 -0400 >+Subject: [PATCH] LibreSSL 3.8.1 support >+ >+--- >+ openssl-sys/build/cfgs.rs | 3 +++ >+ openssl-sys/build/main.rs | 5 +++-- >+ openssl-sys/src/crypto.rs | 2 +- >+ 4 files changed, 8 insertions(+), 4 deletions(-) >+ >+diff --git a/openssl-sys/build/cfgs.rs b/openssl-sys/build/cfgs.rs >+index 2f3ff3eafd..34a58f7d68 100644 >+--- vendor/openssl-sys/build/cfgs.rs >++++ vendor/openssl-sys/build/cfgs.rs >+@@ -53,6 +53,9 @@ pub fn get(openssl_version: Option<u64>, libressl_version: Option<u64>) -> Vec<& >+ if libressl_version >= 0x3_07_00_00_0 { >+ cfgs.push("libressl370"); >+ } >++ if libressl_version >= 0x3_08_01_00_0 { >++ cfgs.push("libressl381"); >++ } >+ } else { >+ let openssl_version = openssl_version.unwrap(); >+ >+diff --git a/openssl-sys/build/main.rs b/openssl-sys/build/main.rs >+index 21ccf3d037..82013b6c7d 100644 >+--- vendor/openssl-sys/build/main.rs >++++ vendor/openssl-sys/build/main.rs >+@@ -273,6 +273,7 @@ See rust-openssl documentation for more information: >+ (3, 7, 1) => ('3', '7', '1'), >+ (3, 7, _) => ('3', '7', 'x'), >+ (3, 8, 0) => ('3', '8', '0'), >++ (3, 8, 1) => ('3', '8', '1'), >+ _ => version_error(), >+ }; >+ >+@@ -314,8 +315,8 @@ fn version_error() -> ! { >+ panic!( >+ " >+ >+-This crate is only compatible with OpenSSL (version 1.0.1 through 1.1.1, or 3.0.0), or LibreSSL 2.5 >+-through 3.8.0, but a different version of OpenSSL was found. The build is now aborting >++This crate is only compatible with OpenSSL (version 1.0.1 through 1.1.1, or 3), or LibreSSL 2.5 >++through 3.8.1, but a different version of OpenSSL was found. The build is now aborting >+ due to this version mismatch. >+ >+ " >+diff --git a/openssl-sys/src/crypto.rs b/openssl-sys/src/crypto.rs >+index 35be07eada..bdc0add156 100644 >+--- vendor/openssl-sys/src/crypto.rs >++++ vendor/openssl-sys/src/crypto.rs >+@@ -106,7 +106,7 @@ pub const CRYPTO_LOCK_SSL_CTX: c_int = 12; >+ pub const CRYPTO_LOCK_SSL_SESSION: c_int = 14; >+ >+ cfg_if! { >+- if #[cfg(ossl110)] { >++ if #[cfg(any(ossl110, libressl381))] { >+ pub const CRYPTO_EX_INDEX_SSL: c_int = 0; >+ pub const CRYPTO_EX_INDEX_SSL_CTX: c_int = 1; >+ } else if #[cfg(libressl)] { >+https://github.com/sfackler/rust-openssl/commit/35c8e90b76d0f7a0b4064a0299d2fc529f9707a3 >+ >+From 35c8e90b76d0f7a0b4064a0299d2fc529f9707a3 Mon Sep 17 00:00:00 2001 >+From: Theo Buehler <tb@openbsd.org> >+Date: Fri, 20 Oct 2023 01:33:10 +0200 >+Subject: [PATCH] Make X509_ALGOR opaque for LibreSSL >+ >+The struct is still public because that is also the case in OpenSSL, but >+it should no longer be accessed directly. >+--- >+ openssl-sys/build/cfgs.rs | 3 +++ >+ openssl-sys/src/handwritten/types.rs | 2 +- >+ 2 files changed, 4 insertions(+), 1 deletion(-) >+ >+diff --git a/openssl-sys/build/cfgs.rs b/openssl-sys/build/cfgs.rs >+index 8ee6f62373..ac7fe28596 100644 >+--- vendor/openssl-sys/build/cfgs.rs >++++ vendor/openssl-sys/build/cfgs.rs >+@@ -56,6 +56,9 @@ pub fn get(openssl_version: Option<u64>, libressl_version: Option<u64>) -> Vec<& >+ if libressl_version >= 0x3_08_01_00_0 { >+ cfgs.push("libressl381"); >+ } >++ if libressl_version >= 0x3_08_02_00_0 { >++ cfgs.push("libressl382"); >++ } >+ } else { >+ let openssl_version = openssl_version.unwrap(); >+ >+diff --git a/openssl-sys/src/handwritten/types.rs b/openssl-sys/src/handwritten/types.rs >+index 06354728f2..a03a878305 100644 >+--- vendor/openssl-sys/src/handwritten/types.rs >++++ vendor/openssl-sys/src/handwritten/types.rs >+@@ -329,7 +329,7 @@ cfg_if! { >+ } >+ } >+ cfg_if! { >+- if #[cfg(ossl110)] { >++ if #[cfg(any(ossl110, libressl382))] { >+ pub enum X509_ALGOR {} >+ } else { >+ #[repr(C)] >+https://github.com/sfackler/rust-openssl/commit/01cc521c7ee12fb2a907b7b83e372974c3f7c2bf >+ >+From 01cc521c7ee12fb2a907b7b83e372974c3f7c2bf Mon Sep 17 00:00:00 2001 >+From: Theo Buehler <tb@openbsd.org> >+Date: Sat, 21 Oct 2023 00:24:12 +0200 >+Subject: [PATCH] Enable SHA-3 for LibreSSL 3.8.0 >+ >+--- >+ openssl-sys/build/cfgs.rs | 3 +++ >+ openssl-sys/src/handwritten/evp.rs | 8 ++++---- >+ openssl-sys/src/obj_mac.rs | 8 ++++++++ >+ openssl/build.rs | 3 +++ >+ openssl/src/hash.rs | 16 ++++++++-------- >+ openssl/src/md.rs | 8 ++++---- >+ openssl/src/nid.rs | 8 ++++---- >+ 7 files changed, 34 insertions(+), 20 deletions(-) >+ >+diff --git a/openssl-sys/build/cfgs.rs b/openssl-sys/build/cfgs.rs >+index ac7fe28596..2454ef66a4 100644 >+--- vendor/openssl-sys/build/cfgs.rs >++++ vendor/openssl-sys/build/cfgs.rs >+@@ -53,6 +53,9 @@ pub fn get(openssl_version: Option<u64>, libressl_version: Option<u64>) -> Vec<& >+ if libressl_version >= 0x3_07_00_00_0 { >+ cfgs.push("libressl370"); >+ } >++ if libressl_version >= 0x3_08_00_00_0 { >++ cfgs.push("libressl380"); >++ } >+ if libressl_version >= 0x3_08_01_00_0 { >+ cfgs.push("libressl381"); >+ } >+diff --git a/openssl-sys/src/handwritten/evp.rs b/openssl-sys/src/handwritten/evp.rs >+index 5a112fe8a1..87deae2ac9 100644 >+--- vendor/openssl-sys/src/handwritten/evp.rs >++++ vendor/openssl-sys/src/handwritten/evp.rs >+@@ -294,13 +294,13 @@ extern "C" { >+ pub fn EVP_sha256() -> *const EVP_MD; >+ pub fn EVP_sha384() -> *const EVP_MD; >+ pub fn EVP_sha512() -> *const EVP_MD; >+- #[cfg(ossl111)] >++ #[cfg(any(ossl111, libressl380))] >+ pub fn EVP_sha3_224() -> *const EVP_MD; >+- #[cfg(ossl111)] >++ #[cfg(any(ossl111, libressl380))] >+ pub fn EVP_sha3_256() -> *const EVP_MD; >+- #[cfg(ossl111)] >++ #[cfg(any(ossl111, libressl380))] >+ pub fn EVP_sha3_384() -> *const EVP_MD; >+- #[cfg(ossl111)] >++ #[cfg(any(ossl111, libressl380))] >+ pub fn EVP_sha3_512() -> *const EVP_MD; >+ #[cfg(ossl111)] >+ pub fn EVP_shake128() -> *const EVP_MD; >+diff --git a/openssl-sys/src/obj_mac.rs b/openssl-sys/src/obj_mac.rs >+index 1b24c3cbd8..93aa5cdff9 100644 >+--- vendor/openssl-sys/src/obj_mac.rs >++++ vendor/openssl-sys/src/obj_mac.rs >+@@ -976,12 +976,20 @@ pub const NID_sm4_ctr: c_int = 1139; >+ pub const NID_sm4_ctr: c_int = 979; >+ #[cfg(ossl111)] >+ pub const NID_sha3_224: c_int = 1096; >++#[cfg(libressl380)] >++pub const NID_sha3_224: c_int = 1031; >+ #[cfg(ossl111)] >+ pub const NID_sha3_256: c_int = 1097; >++#[cfg(libressl380)] >++pub const NID_sha3_256: c_int = 1032; >+ #[cfg(ossl111)] >+ pub const NID_sha3_384: c_int = 1098; >++#[cfg(libressl380)] >++pub const NID_sha3_384: c_int = 1033; >+ #[cfg(ossl111)] >+ pub const NID_sha3_512: c_int = 1099; >++#[cfg(libressl380)] >++pub const NID_sha3_512: c_int = 1034; >+ #[cfg(ossl111)] >+ pub const NID_shake128: c_int = 1100; >+ #[cfg(ossl111)] >+diff --git a/openssl/build.rs b/openssl/build.rs >+index 4a5b6289ae..93ef534d27 100644 >+--- vendor/openssl/build.rs >++++ vendor/openssl/build.rs >+@@ -66,6 +66,9 @@ fn main() { >+ if version >= 0x3_07_00_00_0 { >+ println!("cargo:rustc-cfg=libressl370"); >+ } >++ if version >= 0x3_08_00_00_0 { >++ println!("cargo:rustc-cfg=libressl380"); >++ } >+ } >+ >+ if let Ok(vars) = env::var("DEP_OPENSSL_CONF") { >+diff --git a/openssl/src/hash.rs b/openssl/src/hash.rs >+index 7592758101..9fa9ef3e37 100644 >+--- vendor/openssl/src/hash.rs >++++ vendor/openssl/src/hash.rs >+@@ -127,22 +127,22 @@ impl MessageDigest { >+ unsafe { MessageDigest(ffi::EVP_sha512()) } >+ } >+ >+- #[cfg(ossl111)] >++ #[cfg(any(ossl111, libressl380))] >+ pub fn sha3_224() -> MessageDigest { >+ unsafe { MessageDigest(ffi::EVP_sha3_224()) } >+ } >+ >+- #[cfg(ossl111)] >++ #[cfg(any(ossl111, libressl380))] >+ pub fn sha3_256() -> MessageDigest { >+ unsafe { MessageDigest(ffi::EVP_sha3_256()) } >+ } >+ >+- #[cfg(ossl111)] >++ #[cfg(any(ossl111, libressl380))] >+ pub fn sha3_384() -> MessageDigest { >+ unsafe { MessageDigest(ffi::EVP_sha3_384()) } >+ } >+ >+- #[cfg(ossl111)] >++ #[cfg(any(ossl111, libressl380))] >+ pub fn sha3_512() -> MessageDigest { >+ unsafe { MessageDigest(ffi::EVP_sha3_512()) } >+ } >+@@ -624,7 +624,7 @@ mod tests { >+ ); >+ } >+ >+- #[cfg(ossl111)] >++ #[cfg(any(ossl111, libressl380))] >+ #[test] >+ fn test_sha3_224() { >+ let tests = [( >+@@ -644,7 +644,7 @@ mod tests { >+ ); >+ } >+ >+- #[cfg(ossl111)] >++ #[cfg(any(ossl111, libressl380))] >+ #[test] >+ fn test_sha3_256() { >+ let tests = [( >+@@ -664,7 +664,7 @@ mod tests { >+ ); >+ } >+ >+- #[cfg(ossl111)] >++ #[cfg(any(ossl111, libressl380))] >+ #[test] >+ fn test_sha3_384() { >+ let tests = [("416c6c20796f75722062617365206172652062656c6f6e6720746f207573", >+@@ -684,7 +684,7 @@ mod tests { >+ ); >+ } >+ >+- #[cfg(ossl111)] >++ #[cfg(any(ossl111, libressl380))] >+ #[test] >+ fn test_sha3_512() { >+ let tests = [("416c6c20796f75722062617365206172652062656c6f6e6720746f207573", >+diff --git a/openssl/src/md.rs b/openssl/src/md.rs >+index 8f191afebe..08e4aacf3e 100644 >+--- vendor/openssl/src/md.rs >++++ vendor/openssl/src/md.rs >+@@ -150,25 +150,25 @@ impl Md { >+ unsafe { MdRef::from_ptr(ffi::EVP_sha512() as *mut _) } >+ } >+ >+- #[cfg(ossl111)] >++ #[cfg(any(ossl111, libressl380))] >+ #[inline] >+ pub fn sha3_224() -> &'static MdRef { >+ unsafe { MdRef::from_ptr(ffi::EVP_sha3_224() as *mut _) } >+ } >+ >+- #[cfg(ossl111)] >++ #[cfg(any(ossl111, libressl380))] >+ #[inline] >+ pub fn sha3_256() -> &'static MdRef { >+ unsafe { MdRef::from_ptr(ffi::EVP_sha3_256() as *mut _) } >+ } >+ >+- #[cfg(ossl111)] >++ #[cfg(any(ossl111, libressl380))] >+ #[inline] >+ pub fn sha3_384() -> &'static MdRef { >+ unsafe { MdRef::from_ptr(ffi::EVP_sha3_384() as *mut _) } >+ } >+ >+- #[cfg(ossl111)] >++ #[cfg(any(ossl111, libressl380))] >+ #[inline] >+ pub fn sha3_512() -> &'static MdRef { >+ unsafe { MdRef::from_ptr(ffi::EVP_sha3_512() as *mut _) } >+diff --git a/openssl/src/nid.rs b/openssl/src/nid.rs >+index 91fcdeca9d..a78d0e660c 100644 >+--- vendor/openssl/src/nid.rs >++++ vendor/openssl/src/nid.rs >+@@ -1078,13 +1078,13 @@ impl Nid { >+ pub const SM2: Nid = Nid(ffi::NID_sm2); >+ #[cfg(any(ossl111, libressl291))] >+ pub const SM3: Nid = Nid(ffi::NID_sm3); >+- #[cfg(ossl111)] >++ #[cfg(any(ossl111, libressl380))] >+ pub const SHA3_224: Nid = Nid(ffi::NID_sha3_224); >+- #[cfg(ossl111)] >++ #[cfg(any(ossl111, libressl380))] >+ pub const SHA3_256: Nid = Nid(ffi::NID_sha3_256); >+- #[cfg(ossl111)] >++ #[cfg(any(ossl111, libressl380))] >+ pub const SHA3_384: Nid = Nid(ffi::NID_sha3_384); >+- #[cfg(ossl111)] >++ #[cfg(any(ossl111, libressl380))] >+ pub const SHA3_512: Nid = Nid(ffi::NID_sha3_512); >+ #[cfg(ossl111)] >+ pub const SHAKE128: Nid = Nid(ffi::NID_shake128); >+https://github.com/sfackler/rust-openssl/commit/6f6e5c4f02c370c594ccf404a4a67e366d26ad1c >+ >+From 6f6e5c4f02c370c594ccf404a4a67e366d26ad1c Mon Sep 17 00:00:00 2001 >+From: Alex Gaynor <alex.gaynor@gmail.com> >+Date: Thu, 2 Nov 2023 21:50:11 -0700 >+Subject: [PATCH] fixes #2050 -- build and test on libressl 3.8.2 >+ >+--- >+ openssl-sys/build/main.rs | 1 + >+ 2 files changed, 3 insertions(+), 2 deletions(-) >+ >+diff --git a/openssl-sys/build/main.rs b/openssl-sys/build/main.rs >+index cd732ca46a..bbee7c5c0d 100644 >+--- vendor/openssl-sys/build/main.rs >++++ vendor/openssl-sys/build/main.rs >+@@ -292,6 +292,7 @@ See rust-openssl documentation for more information: >+ (3, 7, _) => ('3', '7', 'x'), >+ (3, 8, 0) => ('3', '8', '0'), >+ (3, 8, 1) => ('3', '8', '1'), >++ (3, 8, _) => ('3', '8', 'x'), >+ _ => version_error(), >+ }; >+ >+From 8a4db4b25154bf3b7fc7b123af4e7787ef9a13e2 Mon Sep 17 00:00:00 2001 >+From: Theo Buehler <tb@openbsd.org> >+Date: Sat, 9 Dec 2023 19:24:59 +0100 >+Subject: [PATCH 1/2] X509_PURPOSE_get0() will return a const pointer >+ >+--- >+ openssl-sys/build/cfgs.rs | 3 +++ >+ openssl-sys/src/handwritten/x509.rs | 4 +--- >+ 2 files changed, 4 insertions(+), 3 deletions(-) >+ >+diff --git a/openssl-sys/build/cfgs.rs b/openssl-sys/build/cfgs.rs >+index 2454ef66a4..91cb734c34 100644 >+--- vendor/openssl-sys/build/cfgs.rs >++++ vendor/openssl-sys/build/cfgs.rs >+@@ -62,6 +62,9 @@ pub fn get(openssl_version: Option<u64>, libressl_version: Option<u64>) -> Vec<& >+ if libressl_version >= 0x3_08_02_00_0 { >+ cfgs.push("libressl382"); >+ } >++ if libressl_version >= 0x3_09_00_00_0 { >++ cfgs.push("libressl390"); >++ } >+ } else { >+ let openssl_version = openssl_version.unwrap(); >+ >+diff --git a/openssl-sys/src/handwritten/x509.rs b/openssl-sys/src/handwritten/x509.rs >+index a93142cd2a..107e8182d1 100644 >+--- vendor/openssl-sys/src/handwritten/x509.rs >++++ vendor/openssl-sys/src/handwritten/x509.rs >+@@ -700,10 +700,8 @@ pub struct X509_PURPOSE { >+ const_ptr_api! { >+ extern "C" { >+ pub fn X509_PURPOSE_get_by_sname(sname: #[const_ptr_if(any(ossl110, libressl280))] c_char) -> c_int; >++ pub fn X509_PURPOSE_get0(idx: c_int) -> #[const_ptr_if(libressl390)] X509_PURPOSE; >+ } >+-} >+-extern "C" { >+- pub fn X509_PURPOSE_get0(idx: c_int) -> *mut X509_PURPOSE; >+ } >+ >+ extern "C" { >+From 4d83202cb5a911c05e58aa1cc53d5556a3bd0c32 Mon Sep 17 00:00:00 2001 >+From: Theo Buehler <tb@openbsd.org> >+Date: Sat, 9 Dec 2023 19:27:37 +0100 >+Subject: [PATCH 2/2] X509V3_EXT_add_alias() will be removed >+ >+--- >+ openssl-sys/src/handwritten/x509v3.rs | 1 + >+ openssl/build.rs | 3 +++ >+ openssl/src/x509/mod.rs | 1 + >+ 3 files changed, 5 insertions(+) >+ >+diff --git a/openssl-sys/src/handwritten/x509v3.rs b/openssl-sys/src/handwritten/x509v3.rs >+index 2f59bf6663..1a548c0e25 100644 >+--- vendor/openssl-sys/src/handwritten/x509v3.rs >++++ vendor/openssl-sys/src/handwritten/x509v3.rs >+@@ -84,6 +84,7 @@ const_ptr_api! { >+ } >+ >+ extern "C" { >++ #[cfg(not(libressl390))] >+ pub fn X509V3_EXT_add_alias(nid_to: c_int, nid_from: c_int) -> c_int; >+ pub fn X509V3_EXT_d2i(ext: *mut X509_EXTENSION) -> *mut c_void; >+ pub fn X509V3_EXT_i2d(ext_nid: c_int, crit: c_int, ext: *mut c_void) -> *mut X509_EXTENSION; >+diff --git a/openssl/build.rs b/openssl/build.rs >+index 87a9fa06f5..7677abc086 100644 >+--- vendor/openssl/build.rs >++++ vendor/openssl/build.rs >+@@ -72,6 +72,9 @@ fn main() { >+ if version >= 0x3_08_02_00_0 { >+ println!("cargo:rustc-cfg=libressl382"); >+ } >++ if version >= 0x3_09_00_00_0 { >++ println!("cargo:rustc-cfg=libressl390"); >++ } >+ } >+ >+ if let Ok(vars) = env::var("DEP_OPENSSL_CONF") { >+diff --git a/openssl/src/x509/mod.rs b/openssl/src/x509/mod.rs >+index c918fed667..115193ee05 100644 >+--- vendor/openssl/src/x509/mod.rs >++++ vendor/openssl/src/x509/mod.rs >+@@ -1018,6 +1018,7 @@ impl X509Extension { >+ /// # Safety >+ /// >+ /// This method modifies global state without locking and therefore is not thread safe >++ #[cfg(not(libressl390))] >+ #[corresponds(X509V3_EXT_add_alias)] >+ #[deprecated( >+ note = "Use x509::extension types or new_from_der and then this is not necessary", >-- >2.42.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 266670
:
236898
|
237869
|
240956
|
241050
|
242702
|
243073
|
244725
|
246136
|
246529
|
246931
| 247053 |
247536
|
249461
|
251577
|
254621