FreeBSD Bugzilla – Attachment 241050 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]
0001-lang-rust-Fix-build-with-LibreSSL-3.6
0001-lang-rust-Fix-build-with-LibreSSL-3.6.patch (text/plain), 9.87 KB, created by
Felix Palmen
on 2023-03-22 10:16:45 UTC
(
hide
)
Description:
0001-lang-rust-Fix-build-with-LibreSSL-3.6
Filename:
MIME Type:
Creator:
Felix Palmen
Created:
2023-03-22 10:16:45 UTC
Size:
9.87 KB
patch
obsolete
>From 07d32d11c5028ca4eab8f1fd9c37e84d4af0fba5 Mon Sep 17 00:00:00 2001 >From: Felix Palmen <zirias@FreeBSD.org> >Date: Fri, 4 Nov 2022 14:18:23 +0100 >Subject: [PATCH] lang/rust: Fix build with LibreSSL 3.6 > >PR: 266670 >--- > lang/rust/files/patch-libressl-3.5 | 253 +++++++++++++++++++++ > lang/rust/files/patch-libssh2-libressl-3.5 | 24 ++ > 2 files changed, 277 insertions(+) > create mode 100644 lang/rust/files/patch-libressl-3.5 > create mode 100644 lang/rust/files/patch-libssh2-libressl-3.5 > >diff --git a/lang/rust/files/patch-libressl-3.5 b/lang/rust/files/patch-libressl-3.5 >new file mode 100644 >index 000000000000..42d3dd32dbef >--- /dev/null >+++ b/lang/rust/files/patch-libressl-3.5 >@@ -0,0 +1,253 @@ >+Compatibility with LibreSSL 3.5, taken from >+<https://github.com/sfackler/rust-openssl/commit/ea03bc0200a5> >+ >+--- vendor/openssl-sys/build/cfgs.rs.orig 2022-09-19 15:35:02 UTC >++++ vendor/openssl-sys/build/cfgs.rs >+@@ -34,6 +34,9 @@ pub fn get(openssl_version: Option<u64>, libressl_vers >+ if libressl_version >= 0x3_03_02_00_0 { >+ cfgs.push("libressl332"); >+ } >++ if libressl_version >= 0x3_05_00_00_0 { >++ cfgs.push("libressl350"); >++ } >+ } else { >+ let openssl_version = openssl_version.unwrap(); >+ >+--- vendor/openssl-sys/build/main.rs.orig 2022-09-19 15:35:02 UTC >++++ vendor/openssl-sys/build/main.rs >+@@ -254,6 +254,8 @@ See rust-openssl README for more information: >+ (3, 3, _) => ('3', '3', 'x'), >+ (3, 4, 0) => ('3', '4', '0'), >+ (3, 4, _) => ('3', '4', 'x'), >++ (3, 5, _) => ('3', '5', 'x'), >++ (3, 6, _) => ('3', '6', 'x'), >+ _ => version_error(), >+ }; >+ >+@@ -296,7 +297,7 @@ fn version_error() -> ! { >+ " >+ >+ 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.4.1, but a different version of OpenSSL was found. The build is now aborting >++through 3.6, but a different version of OpenSSL was found. The build is now aborting >+ due to this version mismatch. >+ >+ " >+--- vendor/openssl-sys/src/bn.rs.orig 2022-09-19 15:35:02 UTC >++++ vendor/openssl-sys/src/bn.rs >+@@ -43,7 +43,7 @@ extern "C" { >+ pub fn BN_mul(r: *mut BIGNUM, a: *const BIGNUM, b: *const BIGNUM, ctx: *mut BN_CTX) -> c_int; >+ pub fn BN_sqr(r: *mut BIGNUM, a: *const BIGNUM, ctx: *mut BN_CTX) -> c_int; >+ pub fn BN_set_negative(bn: *mut BIGNUM, n: c_int); >+- #[cfg(ossl110)] >++ #[cfg(any(ossl110, libressl350))] >+ pub fn BN_is_negative(b: *const ::BIGNUM) -> c_int; >+ >+ pub fn BN_div( >+@@ -153,7 +153,7 @@ extern "C" { >+ } >+ >+ cfg_if! { >+- if #[cfg(ossl110)] { >++ if #[cfg(any(ossl110, libressl350))] { >+ extern "C" { >+ pub fn BN_get_rfc2409_prime_768(bn: *mut BIGNUM) -> *mut BIGNUM; >+ pub fn BN_get_rfc2409_prime_1024(bn: *mut BIGNUM) -> *mut BIGNUM; >+--- vendor/openssl-sys/src/hmac.rs.orig 2022-09-19 15:35:02 UTC >++++ vendor/openssl-sys/src/hmac.rs >+@@ -3,7 +3,7 @@ use libc::*; >+ use *; >+ >+ cfg_if! { >+- if #[cfg(ossl110)] { >++ if #[cfg(any(ossl110, libressl350))] { >+ extern "C" { >+ pub fn HMAC_CTX_new() -> *mut HMAC_CTX; >+ pub fn HMAC_CTX_free(ctx: *mut HMAC_CTX); >+--- vendor/openssl-sys/src/ossl_typ.rs.orig 2022-09-19 15:35:02 UTC >++++ vendor/openssl-sys/src/ossl_typ.rs >+@@ -40,7 +40,7 @@ cfg_if! { >+ } >+ } >+ cfg_if! { >+- if #[cfg(ossl110)] { >++ if #[cfg(any(ossl110, libressl350))] { >+ pub enum BIGNUM {} >+ } else { >+ #[repr(C)] >+@@ -1015,7 +1015,7 @@ cfg_if! { >+ pub enum COMP_CTX {} >+ >+ cfg_if! { >+- if #[cfg(ossl110)] { >++ if #[cfg(any(ossl110, libressl350))] { >+ pub enum COMP_METHOD {} >+ } else { >+ #[repr(C)] >+--- vendor/openssl-sys/src/x509.rs.orig 2022-09-19 15:35:02 UTC >++++ vendor/openssl-sys/src/x509.rs >+@@ -25,7 +25,7 @@ stack!(stack_st_X509_EXTENSION); >+ stack!(stack_st_X509_ATTRIBUTE); >+ >+ cfg_if! { >+- if #[cfg(ossl110)] { >++ if #[cfg(any(ossl110, libressl350))] { >+ pub enum X509_REQ_INFO {} >+ } else { >+ #[repr(C)] >+@@ -40,7 +40,7 @@ cfg_if! { >+ } >+ >+ cfg_if! { >+- if #[cfg(ossl110)] { >++ if #[cfg(any(ossl110, libressl350))] { >+ pub enum X509_CRL {} >+ } else { >+ #[repr(C)] >+@@ -67,7 +67,7 @@ cfg_if! { >+ stack!(stack_st_X509_CRL); >+ >+ cfg_if! { >+- if #[cfg(ossl110)] { >++ if #[cfg(any(ossl110, libressl350))] { >+ pub enum X509_CRL_INFO {} >+ } else { >+ #[repr(C)] >+@@ -85,7 +85,7 @@ cfg_if! { >+ } >+ >+ cfg_if! { >+- if #[cfg(ossl110)] { >++ if #[cfg(any(ossl110, libressl350))] { >+ pub enum X509_REVOKED {} >+ } else { >+ #[repr(C)] >+@@ -103,7 +103,7 @@ cfg_if! { >+ stack!(stack_st_X509_REVOKED); >+ >+ cfg_if! { >+- if #[cfg(ossl110)] { >++ if #[cfg(any(ossl110, libressl350))] { >+ pub enum X509_REQ {} >+ } else { >+ #[repr(C)] >+@@ -117,7 +117,7 @@ cfg_if! { >+ } >+ >+ cfg_if! { >+- if #[cfg(ossl110)] { >++ if #[cfg(any(ossl110, libressl350))] { >+ pub enum X509_CINF {} >+ } else { >+ #[repr(C)] >+@@ -140,7 +140,7 @@ cfg_if! { >+ stack!(stack_st_X509); >+ >+ cfg_if! { >+- if #[cfg(not(ossl110))] { >++ if #[cfg(not(any(ossl110, libressl350)))] { >+ pub const X509_LU_FAIL: c_int = 0; >+ pub const X509_LU_X509: c_int = 1; >+ pub const X509_LU_CRL: c_int = 2; >+@@ -221,12 +221,12 @@ extern "C" { >+ >+ const_ptr_api! { >+ extern "C" { >+- #[cfg(ossl102)] >++ #[cfg(any(ossl102, libressl350))] >+ pub fn X509_ALGOR_get0( >+- paobj: *mut #[const_ptr_if(ossl110)] ASN1_OBJECT, >++ paobj: *mut #[const_ptr_if(any(ossl110, libressl350))] ASN1_OBJECT, >+ pptype: *mut c_int, >+- ppval: *mut #[const_ptr_if(ossl110)] c_void, >+- alg: #[const_ptr_if(ossl110)] X509_ALGOR, >++ ppval: *mut #[const_ptr_if(any(ossl110, libressl350))] c_void, >++ alg: #[const_ptr_if(any(ossl110, libressl350))] X509_ALGOR, >+ ); >+ } >+ } >+@@ -343,7 +343,7 @@ const_ptr_api! { >+ } >+ } >+ cfg_if! { >+- if #[cfg(ossl110)] { >++ if #[cfg(any(ossl110, libressl350))] { >+ extern "C" { >+ pub fn X509_set1_notBefore(x: *mut ::X509, tm: *const ::ASN1_TIME) -> c_int; >+ pub fn X509_set1_notAfter(x: *mut ::X509, tm: *const ::ASN1_TIME) -> c_int; >+@@ -356,10 +356,10 @@ cfg_if! { >+ } >+ } >+ extern "C" { >+- #[cfg(ossl110)] >++ #[cfg(any(ossl110, libressl350))] >+ pub fn X509_REQ_get_version(req: *const X509_REQ) -> c_long; >+ pub fn X509_REQ_set_version(req: *mut X509_REQ, version: c_long) -> c_int; >+- #[cfg(ossl110)] >++ #[cfg(any(ossl110, libressl350))] >+ pub fn X509_REQ_get_subject_name(req: *const X509_REQ) -> *mut X509_NAME; >+ } >+ const_ptr_api! { >+@@ -632,7 +632,7 @@ extern "C" { >+ } >+ >+ cfg_if! { >+- if #[cfg(ossl110)] { >++ if #[cfg(any(ossl110, libressl350))] { >+ extern "C" { >+ pub fn X509_OBJECT_free(a: *mut X509_OBJECT); >+ } >+--- vendor/openssl-sys/src/x509_vfy.rs.orig 2022-09-19 15:35:02 UTC >++++ vendor/openssl-sys/src/x509_vfy.rs >+@@ -204,7 +204,7 @@ extern "C" { >+ pub fn X509_STORE_CTX_set_error(ctx: *mut X509_STORE_CTX, error: c_int); >+ } >+ cfg_if! { >+- if #[cfg(ossl110)] { >++ if #[cfg(any(ossl110, libressl350))] { >+ const_ptr_api! { >+ extern "C" { >+ pub fn X509_STORE_CTX_get0_chain(ctx: #[const_ptr_if(ossl300)] X509_STORE_CTX) -> *mut stack_st_X509; >+--- vendor/openssl/build.rs.orig 2022-09-19 15:35:02 UTC >++++ vendor/openssl/build.rs >+@@ -78,5 +78,9 @@ fn main() { >+ if version >= 0x3_04_00_00_0 { >+ println!("cargo:rustc-cfg=libressl340"); >+ } >++ >++ if version >= 0x3_05_00_00_0 { >++ println!("cargo:rustc-cfg=libressl350"); >++ } >+ } >+ } >+--- vendor/openssl/src/bn.rs.orig 2022-09-19 15:35:02 UTC >++++ vendor/openssl/src/bn.rs >+@@ -36,7 +36,7 @@ use crate::string::OpensslString; >+ use crate::{cvt, cvt_n, cvt_p}; >+ >+ cfg_if! { >+- if #[cfg(ossl110)] { >++ if #[cfg(any(ossl110, libressl350))] { >+ use ffi::{ >+ BN_get_rfc2409_prime_1024, BN_get_rfc2409_prime_768, BN_get_rfc3526_prime_1536, >+ BN_get_rfc3526_prime_2048, BN_get_rfc3526_prime_3072, BN_get_rfc3526_prime_4096, >+--- vendor/openssl/src/x509/mod.rs.orig 2022-09-19 15:35:02 UTC >++++ vendor/openssl/src/x509/mod.rs >+@@ -1568,7 +1568,7 @@ cfg_if! { >+ } >+ >+ cfg_if! { >+- if #[cfg(ossl110)] { >++ if #[cfg(any(ossl110, libressl350))] { >+ use ffi::{ >+ X509_ALGOR_get0, ASN1_STRING_get0_data, X509_STORE_CTX_get0_chain, X509_set1_notAfter, >+ X509_set1_notBefore, X509_REQ_get_version, X509_REQ_get_subject_name, >+@@ -1623,7 +1623,7 @@ cfg_if! { >+ } >+ >+ cfg_if! { >+- if #[cfg(ossl110)] { >++ if #[cfg(any(ossl110, libressl350))] { >+ use ffi::X509_OBJECT_free; >+ } else { >+ #[allow(bad_style)] >diff --git a/lang/rust/files/patch-libssh2-libressl-3.5 b/lang/rust/files/patch-libssh2-libressl-3.5 >new file mode 100644 >index 000000000000..895468e69e4c >--- /dev/null >+++ b/lang/rust/files/patch-libssh2-libressl-3.5 >@@ -0,0 +1,24 @@ >+--- vendor/libssh2-sys/libssh2/src/openssl.c.orig 2022-10-17 08:20:24 UTC >++++ vendor/libssh2-sys/libssh2/src/openssl.c >+@@ -653,8 +653,7 @@ _libssh2_EVP_aes_256_ctr(void) >+ >+ void _libssh2_openssl_crypto_init(void) >+ { >+-#if OPENSSL_VERSION_NUMBER >= 0x10100000L && \ >+- !defined(LIBRESSL_VERSION_NUMBER) >++#if OPENSSL_VERSION_NUMBER >= 0x10100000L >+ #ifndef OPENSSL_NO_ENGINE >+ ENGINE_load_builtin_engines(); >+ ENGINE_register_all_complete(); >+--- vendor/libssh2-sys/libssh2/src/openssl.h.orig 2022-10-17 08:18:24 UTC >++++ vendor/libssh2-sys/libssh2/src/openssl.h >+@@ -57,8 +57,7 @@ >+ #include <openssl/pem.h> >+ #include <openssl/rand.h> >+ >+-#if OPENSSL_VERSION_NUMBER >= 0x10100000L && \ >+- !defined(LIBRESSL_VERSION_NUMBER) >++#if OPENSSL_VERSION_NUMBER >= 0x10100000L >+ # define HAVE_OPAQUE_STRUCTS 1 >+ #endif >+ >-- >2.39.2 >
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