From 9fb6143b11ff1b83fb416587e1f42621292e278b Mon Sep 17 00:00:00 2001 From: 0x676e67 Date: Sun, 18 May 2025 18:55:08 +0800 Subject: [PATCH] chore(boring): deprecate legacy `CertCompressionAlgorithm` API (#69) * chore(boring): deprecate legacy `CertCompressionAlgorithm` API * ci: fix windows build --- .github/workflows/ci.yml | 6 +++--- boring-sys/build/main.rs | 2 +- boring/src/error.rs | 2 +- boring/src/ssl/cert_compression.rs | 5 +++++ boring/src/ssl/mod.rs | 17 +++++++++++------ tokio-boring/src/lib.rs | 4 +--- 6 files changed, 22 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a1c88152..414e4b81 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -200,9 +200,9 @@ jobs: - uses: actions/checkout@v4 with: submodules: 'recursive' - - name: Install Rust (rustup) - run: rustup update ${{ matrix.rust }} --no-self-update && rustup default ${{ matrix.rust }} - shell: bash + # - name: Install Rust (rustup) + # run: rustup update ${{ matrix.rust }} --no-self-update && rustup default ${{ matrix.rust }} + # shell: bash - run: rustup target add ${{ matrix.target }} - name: Install target-specific APT dependencies if: "matrix.apt_packages != ''" diff --git a/boring-sys/build/main.rs b/boring-sys/build/main.rs index 948ef92d..c6bb2f5e 100644 --- a/boring-sys/build/main.rs +++ b/boring-sys/build/main.rs @@ -540,7 +540,7 @@ fn run_command(command: &mut Command) -> io::Result { None => format!("{:?} was terminated by signal", command), }; - return Err(io::Error::new(io::ErrorKind::Other, err)); + return Err(io::Error::other(err)); } Ok(out) diff --git a/boring/src/error.rs b/boring/src/error.rs index 32d6304a..c2478cb1 100644 --- a/boring/src/error.rs +++ b/boring/src/error.rs @@ -79,7 +79,7 @@ impl error::Error for ErrorStack {} impl From for io::Error { fn from(e: ErrorStack) -> io::Error { - io::Error::new(io::ErrorKind::Other, e) + io::Error::other(e) } } diff --git a/boring/src/ssl/cert_compression.rs b/boring/src/ssl/cert_compression.rs index 6682f610..a52f5c45 100644 --- a/boring/src/ssl/cert_compression.rs +++ b/boring/src/ssl/cert_compression.rs @@ -3,6 +3,11 @@ use std::{io::Read, slice}; /// IANA assigned identifier of compression algorithm. /// See https://www.rfc-editor.org/rfc/rfc8879.html#name-compression-algorithms +#[deprecated( + since = "4.15.13", + note = "This enum is deprecated and will be removed in a future version. \ + Use `boring::ssl::CertificateCompressionAlgorithm` instead." +)] #[repr(u16)] #[derive(Debug, Copy, Clone, PartialEq, Eq)] pub enum CertCompressionAlgorithm { diff --git a/boring/src/ssl/mod.rs b/boring/src/ssl/mod.rs index e3b9e9a5..87a40bf0 100644 --- a/boring/src/ssl/mod.rs +++ b/boring/src/ssl/mod.rs @@ -103,6 +103,10 @@ pub use self::async_callbacks::{ BoxCustomVerifyFuture, BoxGetSessionFinish, BoxGetSessionFuture, BoxPrivateKeyMethodFinish, BoxPrivateKeyMethodFuture, BoxSelectCertFinish, BoxSelectCertFuture, ExDataFuture, }; +#[deprecated( + since = "4.15.13", + note = "Use `boring2::ssl::CertificateCompressionAlgorithm` instead" +)] #[cfg(feature = "cert-compression")] pub use self::cert_compression::CertCompressionAlgorithm; pub use self::connector::{ @@ -1364,6 +1368,10 @@ impl SslContextBuilder { } /// Sets whether a certificate compression algorithm should be used. + #[deprecated( + since = "4.15.13", + note = "Use `add_certificate_compression_algorithm` instead." + )] #[cfg(feature = "cert-compression")] #[corresponds(SSL_CTX_add_cert_compression_alg)] pub fn add_cert_compression_alg( @@ -1945,6 +1953,7 @@ impl SslContextBuilder { /// The indices must be in the range [0, 25). /// Extension duplication will be verified by the user. /// If duplication occurs, TLS connection failure may occur. + #[deprecated(since = "4.15.13", note = "use `set_extension_permutation` instead")] #[corresponds(SSL_CTX_set_extension_permutation)] #[cfg(not(feature = "fips-compat"))] pub fn set_extension_permutation_indices(&mut self, indices: &[u8]) -> Result<(), ErrorStack> { @@ -3851,9 +3860,7 @@ impl SslStream { } Err(ref e) if e.code() == ErrorCode::WANT_READ && e.io_error().is_none() => {} Err(e) => { - return Err(e - .into_io_error() - .unwrap_or_else(|e| io::Error::new(io::ErrorKind::Other, e))); + return Err(e.into_io_error().unwrap_or_else(io::Error::other)); } } } @@ -4075,9 +4082,7 @@ impl Write for SslStream { Ok(n) => return Ok(n), Err(ref e) if e.code() == ErrorCode::WANT_READ && e.io_error().is_none() => {} Err(e) => { - return Err(e - .into_io_error() - .unwrap_or_else(|e| io::Error::new(io::ErrorKind::Other, e))); + return Err(e.into_io_error().unwrap_or_else(io::Error::other)); } } } diff --git a/tokio-boring/src/lib.rs b/tokio-boring/src/lib.rs index f1593ed8..89d10127 100644 --- a/tokio-boring/src/lib.rs +++ b/tokio-boring/src/lib.rs @@ -240,9 +240,7 @@ where return Poll::Pending; } Err(e) => { - return Poll::Ready(Err(e - .into_io_error() - .unwrap_or_else(|e| io::Error::new(io::ErrorKind::Other, e)))); + return Poll::Ready(Err(e.into_io_error().unwrap_or_else(io::Error::other))); } }