chore(boring): deprecate legacy `CertCompressionAlgorithm` API (#69)

* chore(boring): deprecate legacy `CertCompressionAlgorithm` API

* ci: fix windows build
This commit is contained in:
0x676e67 2025-05-18 18:55:08 +08:00 committed by GitHub
parent 2b497506ef
commit 9fb6143b11
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 22 additions and 14 deletions

View File

@ -200,9 +200,9 @@ jobs:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
submodules: 'recursive' submodules: 'recursive'
- name: Install Rust (rustup) # - name: Install Rust (rustup)
run: rustup update ${{ matrix.rust }} --no-self-update && rustup default ${{ matrix.rust }} # run: rustup update ${{ matrix.rust }} --no-self-update && rustup default ${{ matrix.rust }}
shell: bash # shell: bash
- run: rustup target add ${{ matrix.target }} - run: rustup target add ${{ matrix.target }}
- name: Install target-specific APT dependencies - name: Install target-specific APT dependencies
if: "matrix.apt_packages != ''" if: "matrix.apt_packages != ''"

View File

@ -540,7 +540,7 @@ fn run_command(command: &mut Command) -> io::Result<Output> {
None => format!("{:?} was terminated by signal", command), None => format!("{:?} was terminated by signal", command),
}; };
return Err(io::Error::new(io::ErrorKind::Other, err)); return Err(io::Error::other(err));
} }
Ok(out) Ok(out)

View File

@ -79,7 +79,7 @@ impl error::Error for ErrorStack {}
impl From<ErrorStack> for io::Error { impl From<ErrorStack> for io::Error {
fn from(e: ErrorStack) -> io::Error { fn from(e: ErrorStack) -> io::Error {
io::Error::new(io::ErrorKind::Other, e) io::Error::other(e)
} }
} }

View File

@ -3,6 +3,11 @@ use std::{io::Read, slice};
/// IANA assigned identifier of compression algorithm. /// IANA assigned identifier of compression algorithm.
/// See https://www.rfc-editor.org/rfc/rfc8879.html#name-compression-algorithms /// 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)] #[repr(u16)]
#[derive(Debug, Copy, Clone, PartialEq, Eq)] #[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub enum CertCompressionAlgorithm { pub enum CertCompressionAlgorithm {

View File

@ -103,6 +103,10 @@ pub use self::async_callbacks::{
BoxCustomVerifyFuture, BoxGetSessionFinish, BoxGetSessionFuture, BoxPrivateKeyMethodFinish, BoxCustomVerifyFuture, BoxGetSessionFinish, BoxGetSessionFuture, BoxPrivateKeyMethodFinish,
BoxPrivateKeyMethodFuture, BoxSelectCertFinish, BoxSelectCertFuture, ExDataFuture, BoxPrivateKeyMethodFuture, BoxSelectCertFinish, BoxSelectCertFuture, ExDataFuture,
}; };
#[deprecated(
since = "4.15.13",
note = "Use `boring2::ssl::CertificateCompressionAlgorithm` instead"
)]
#[cfg(feature = "cert-compression")] #[cfg(feature = "cert-compression")]
pub use self::cert_compression::CertCompressionAlgorithm; pub use self::cert_compression::CertCompressionAlgorithm;
pub use self::connector::{ pub use self::connector::{
@ -1364,6 +1368,10 @@ impl SslContextBuilder {
} }
/// Sets whether a certificate compression algorithm should be used. /// 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")] #[cfg(feature = "cert-compression")]
#[corresponds(SSL_CTX_add_cert_compression_alg)] #[corresponds(SSL_CTX_add_cert_compression_alg)]
pub fn 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). /// The indices must be in the range [0, 25).
/// Extension duplication will be verified by the user. /// Extension duplication will be verified by the user.
/// If duplication occurs, TLS connection failure may occur. /// 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)] #[corresponds(SSL_CTX_set_extension_permutation)]
#[cfg(not(feature = "fips-compat"))] #[cfg(not(feature = "fips-compat"))]
pub fn set_extension_permutation_indices(&mut self, indices: &[u8]) -> Result<(), ErrorStack> { pub fn set_extension_permutation_indices(&mut self, indices: &[u8]) -> Result<(), ErrorStack> {
@ -3851,9 +3860,7 @@ impl<S: Read + Write> SslStream<S> {
} }
Err(ref e) if e.code() == ErrorCode::WANT_READ && e.io_error().is_none() => {} Err(ref e) if e.code() == ErrorCode::WANT_READ && e.io_error().is_none() => {}
Err(e) => { Err(e) => {
return Err(e return Err(e.into_io_error().unwrap_or_else(io::Error::other));
.into_io_error()
.unwrap_or_else(|e| io::Error::new(io::ErrorKind::Other, e)));
} }
} }
} }
@ -4075,9 +4082,7 @@ impl<S: Read + Write> Write for SslStream<S> {
Ok(n) => return Ok(n), Ok(n) => return Ok(n),
Err(ref e) if e.code() == ErrorCode::WANT_READ && e.io_error().is_none() => {} Err(ref e) if e.code() == ErrorCode::WANT_READ && e.io_error().is_none() => {}
Err(e) => { Err(e) => {
return Err(e return Err(e.into_io_error().unwrap_or_else(io::Error::other));
.into_io_error()
.unwrap_or_else(|e| io::Error::new(io::ErrorKind::Other, e)));
} }
} }
} }

View File

@ -240,9 +240,7 @@ where
return Poll::Pending; return Poll::Pending;
} }
Err(e) => { Err(e) => {
return Poll::Ready(Err(e return Poll::Ready(Err(e.into_io_error().unwrap_or_else(io::Error::other)));
.into_io_error()
.unwrap_or_else(|e| io::Error::new(io::ErrorKind::Other, e))));
} }
} }