FreeBSD Bugzilla – Attachment 246931 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]
v0
0001-lang-rust-Fix-build-with-libressl.patch (text/plain), 12.83 KB, created by
Mikael Urankar
on 2023-12-09 15:36:41 UTC
(
hide
)
Description:
v0
Filename:
MIME Type:
Creator:
Mikael Urankar
Created:
2023-12-09 15:36:41 UTC
Size:
12.83 KB
patch
obsolete
>From aa6c8a017a617243b993b6c94e2d98af57ad1c97 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 >--- > lang/rust/files/patch-libressl | 342 +++++++++++++++++++++++++++++++++ > 1 file changed, 342 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 0000000000..ec138b0356 >--- /dev/null >+++ b/lang/rust/files/patch-libressl >@@ -0,0 +1,342 @@ >+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(), >+ }; >+ >-- >2.43.0 >
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