lang/rust: Add support for LibreSSL 2.6.3

Patches come from upstream:
    https://github.com/sfackler/rust-openssl

PR:		223500
Reported by:	Charlie Li <ml+freebsd-bugs@vishwin.info>
This commit is contained in:
Jean-Sébastien Pédron 2017-11-09 14:14:59 +00:00
parent e3a14704bf
commit 3130d6b687
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=453810
5 changed files with 38 additions and 29 deletions

View File

@ -1,12 +1,14 @@
--- src/vendor/openssl-sys/build.rs.orig 2017-10-10 20:21:44 UTC
--- src/vendor/openssl-sys/build.rs.orig 2017-10-09 21:52:49 UTC
+++ src/vendor/openssl-sys/build.rs
@@ -260,8 +260,12 @@ fn validate_headers(include_dirs: &[PathBuf]) -> Versi
@@ -307,8 +307,14 @@ fn validate_headers(include_dirs: &[PathBuf]) -> Versi
#include <openssl/opensslv.h>
#include <openssl/opensslconf.h>
-#if LIBRESSL_VERSION_NUMBER >= 0x20601000
+#if LIBRESSL_VERSION_NUMBER >= 0x20603000
+#if LIBRESSL_VERSION_NUMBER >= 0x20604000
RUST_LIBRESSL_NEW
+#elif LIBRESSL_VERSION_NUMBER >= 0x20603000
+RUST_LIBRESSL_263
+#elif LIBRESSL_VERSION_NUMBER >= 0x20602000
+RUST_LIBRESSL_262
+#elif LIBRESSL_VERSION_NUMBER >= 0x20601000
@ -14,7 +16,7 @@
#elif LIBRESSL_VERSION_NUMBER >= 0x20600000
RUST_LIBRESSL_260
#elif LIBRESSL_VERSION_NUMBER >= 0x20506000
@@ -356,42 +360,63 @@ See rust-openssl README for more information:
@@ -403,42 +409,70 @@ See rust-openssl README for more information:
println!("cargo:rustc-cfg=libressl");
println!("cargo:rustc-cfg=libressl250");
println!("cargo:libressl=true");
@ -75,6 +77,13 @@
+ println!("cargo:rustc-cfg=libressl262");
+ println!("cargo:libressl=true");
+ println!("cargo:libressl_version=262");
+ println!("cargo:version=101");
+ Version::Libressl
+ } else if expanded.contains("RUST_LIBRESSL_263") {
+ println!("cargo:rustc-cfg=libressl");
+ println!("cargo:rustc-cfg=libressl263");
+ println!("cargo:libressl=true");
+ println!("cargo:libressl_version=263");
println!("cargo:version=101");
Version::Libressl
} else if expanded.contains("RUST_OPENSSL_110F") {

View File

@ -1,18 +1,18 @@
--- src/vendor/openssl-sys/src/lib.rs.orig 2017-10-10 20:22:00 UTC
--- src/vendor/openssl-sys/src/lib.rs.orig 2017-10-09 21:52:49 UTC
+++ src/vendor/openssl-sys/src/lib.rs
@@ -1210,10 +1210,15 @@ pub const SSL_VERIFY_NONE: c_int = 0;
@@ -1225,10 +1225,15 @@ pub const SSL_VERIFY_NONE: c_int = 0;
pub const SSL_VERIFY_PEER: c_int = 1;
pub const SSL_VERIFY_FAIL_IF_NO_PEER_CERT: c_int = 2;
-#[cfg(not(ossl101))]
+#[cfg(not(any(libressl261, libressl262, ossl101)))]
+#[cfg(not(any(libressl261, libressl262, libressl263, ossl101)))]
pub const SSL_OP_TLSEXT_PADDING: c_ulong = 0x00000010;
+#[cfg(any(libressl261, libressl262))]
+#[cfg(any(libressl261, libressl262, libressl263))]
+pub const SSL_OP_TLSEXT_PADDING: c_ulong = 0x0;
pub const SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS: c_ulong = 0x00000800;
+#[cfg(not(any(libressl261, libressl262)))]
+#[cfg(not(any(libressl261, libressl262, libressl263)))]
pub const SSL_OP_CRYPTOPRO_TLSEXT_BUG: c_ulong = 0x80000000;
+#[cfg(any(libressl261, libressl262))]
+#[cfg(any(libressl261, libressl262, libressl263))]
+pub const SSL_OP_CRYPTOPRO_TLSEXT_BUG: c_ulong = 0x0;
pub const SSL_OP_LEGACY_SERVER_CONNECT: c_ulong = 0x00000004;
#[cfg(not(libressl))]

View File

@ -1,12 +1,12 @@
--- src/vendor/openssl-sys/src/libressl/mod.rs.orig 2017-10-10 20:22:20 UTC
--- src/vendor/openssl-sys/src/libressl/mod.rs.orig 2017-10-09 21:52:49 UTC
+++ src/vendor/openssl-sys/src/libressl/mod.rs
@@ -345,6 +345,9 @@ pub const SSL_CTRL_OPTIONS: c_int = 32;
pub const SSL_CTRL_CLEAR_OPTIONS: c_int = 77;
pub const SSL_CTRL_SET_ECDH_AUTO: c_int = 94;
+#[cfg(any(libressl261, libressl262))]
+#[cfg(any(libressl261, libressl262, libressl263))]
+pub const SSL_OP_ALL: c_ulong = 0x4;
+#[cfg(not(any(libressl261, libressl262)))]
+#[cfg(not(any(libressl261, libressl262, libressl263)))]
pub const SSL_OP_ALL: c_ulong = 0x80000014;
pub const SSL_OP_CISCO_ANYCONNECT: c_ulong = 0x0;
pub const SSL_OP_NO_COMPRESSION: c_ulong = 0x0;
@ -14,9 +14,9 @@
pub const SSL_OP_SSLEAY_080_CLIENT_DH_BUG: c_ulong = 0x0;
pub const SSL_OP_TLS_D5_BUG: c_ulong = 0x0;
pub const SSL_OP_TLS_BLOCK_PADDING_BUG: c_ulong = 0x0;
+#[cfg(any(libressl261, libressl262))]
+#[cfg(any(libressl261, libressl262, libressl263))]
+pub const SSL_OP_SINGLE_ECDH_USE: c_ulong = 0x0;
+#[cfg(not(any(libressl261, libressl262)))]
+#[cfg(not(any(libressl261, libressl262, libressl263)))]
pub const SSL_OP_SINGLE_ECDH_USE: c_ulong = 0x00080000;
pub const SSL_OP_SINGLE_DH_USE: c_ulong = 0x00100000;
pub const SSL_OP_NO_SSLv2: c_ulong = 0x0;

View File

@ -1,18 +1,18 @@
--- src/vendor/openssl/src/ssl/mod.rs.orig 2017-10-10 20:21:00 UTC
--- src/vendor/openssl/src/ssl/mod.rs.orig 2017-10-09 21:52:52 UTC
+++ src/vendor/openssl/src/ssl/mod.rs
@@ -652,6 +652,7 @@ impl SslContextBuilder {
/// Set the protocols to be used during Next Protocol Negotiation (the protocols
/// supported by the application).
+ #[cfg(not(any(libressl261, libressl262)))]
+ #[cfg(not(any(libressl261, libressl262, libressl263)))]
pub fn set_npn_protocols(&mut self, protocols: &[&[u8]]) -> Result<(), ErrorStack> {
// Firstly, convert the list of protocols to a byte-array that can be passed to OpenSSL
// APIs -- a list of length-prefixed strings.
@@ -1295,6 +1296,7 @@ impl SslRef {
@@ -1310,6 +1311,7 @@ impl SslRef {
///
/// The protocol's name is returned is an opaque sequence of bytes. It is up to the client
/// to interpret it.
+ #[cfg(not(any(libressl261, libressl262)))]
+ #[cfg(not(any(libressl261, libressl262, libressl263)))]
pub fn selected_npn_protocol(&self) -> Option<&[u8]> {
unsafe {
let mut data: *const c_uchar = ptr::null();

View File

@ -1,36 +1,36 @@
--- src/vendor/openssl/src/ssl/tests/mod.rs.orig 2017-10-10 20:21:13 UTC
+++ src/vendor/openssl/src/ssl/tests/mod.rs
@@ -564,6 +564,7 @@ fn test_connect_with_unilateral_alpn() {
--- src/vendor/openssl/src/ssl/tests/mod.rs.orig 2017-10-09 23:52:52.000000000 +0200
+++ src/vendor/openssl/src/ssl/tests/mod.rs 2017-11-09 13:42:46.721625000 +0100
@@ -503,6 +503,7 @@
/// Tests that connecting with the client using NPN, but the server not does not
/// break the existing connection behavior.
#[test]
+#[cfg(not(any(libressl261, libressl262)))]
+#[cfg(not(any(libressl261, libressl262, libressl263)))]
fn test_connect_with_unilateral_npn() {
let (_s, stream) = Server::new();
let mut ctx = SslContext::builder(SslMethod::tls()).unwrap();
@@ -676,6 +677,7 @@ fn test_connect_with_npn_successful_single_match() {
@@ -615,6 +616,7 @@
/// Tests that when the `SslStream` is created as a server stream, the protocols
/// are correctly advertised to the client.
#[test]
+#[cfg(not(any(libressl261, libressl262)))]
+#[cfg(not(any(libressl261, libressl262, libressl263)))]
fn test_npn_server_advertise_multiple() {
let listener = TcpListener::bind("127.0.0.1:0").unwrap();
let localhost = listener.local_addr().unwrap();
@@ -1311,7 +1313,7 @@ fn tmp_dh_callback() {
@@ -1239,7 +1241,7 @@
}
#[test]
-#[cfg(any(all(feature = "v101", ossl101), all(feature = "v102", ossl102)))]
+#[cfg(any(all(feature = "v101", ossl101, not(any(libressl261, libressl262))), all(feature = "v102", ossl102)))]
+#[cfg(any(all(feature = "v101", ossl101, not(any(libressl261, libressl262, libressl263))), all(feature = "v102", ossl102)))]
fn tmp_ecdh_callback() {
use ec::EcKey;
use nid;
@@ -1378,7 +1380,7 @@ fn tmp_dh_callback_ssl() {
@@ -1306,7 +1308,7 @@
}
#[test]
-#[cfg(any(all(feature = "v101", ossl101), all(feature = "v102", ossl102)))]
+#[cfg(any(all(feature = "v101", ossl101, not(any(libressl261, libressl262))), all(feature = "v102", ossl102)))]
+#[cfg(any(all(feature = "v101", ossl101, not(any(libressl261, libressl262, libressl263))), all(feature = "v102", ossl102)))]
fn tmp_ecdh_callback_ssl() {
use ec::EcKey;
use nid;