From 734786addfa14258432489fc828e7d548e88753d Mon Sep 17 00:00:00 2001 From: Kornel Date: Thu, 28 Nov 2024 18:46:22 +0000 Subject: [PATCH 1/2] Clippy --- boring/Cargo.toml | 1 + boring/src/asn1.rs | 4 ++-- boring/src/bio.rs | 2 +- boring/src/bn.rs | 22 +++++++++++----------- boring/src/derive.rs | 6 +++--- boring/src/sign.rs | 16 ++++++++-------- boring/src/ssl/bio.rs | 2 +- boring/src/stack.rs | 4 ++-- boring/src/x509/mod.rs | 4 ++-- 9 files changed, 31 insertions(+), 30 deletions(-) diff --git a/boring/Cargo.toml b/boring/Cargo.toml index 19e79432..96bfbc92 100644 --- a/boring/Cargo.toml +++ b/boring/Cargo.toml @@ -10,6 +10,7 @@ readme = "README.md" keywords = ["crypto", "tls", "ssl", "dtls"] categories = ["cryptography", "api-bindings"] edition = { workspace = true } +rust-version = "1.70" [package.metadata.docs.rs] features = ["rpk", "pq-experimental", "underscore-wildcards"] diff --git a/boring/src/asn1.rs b/boring/src/asn1.rs index 02e601fc..8a196a7d 100644 --- a/boring/src/asn1.rs +++ b/boring/src/asn1.rs @@ -240,7 +240,7 @@ impl PartialEq for Asn1TimeRef { } } -impl<'a> PartialEq for &'a Asn1TimeRef { +impl PartialEq for &Asn1TimeRef { fn eq(&self, other: &Asn1Time) -> bool { self.diff(other) .map(|t| t.days == 0 && t.secs == 0) @@ -260,7 +260,7 @@ impl PartialOrd for Asn1TimeRef { } } -impl<'a> PartialOrd for &'a Asn1TimeRef { +impl PartialOrd for &Asn1TimeRef { fn partial_cmp(&self, other: &Asn1Time) -> Option { self.compare(other).ok() } diff --git a/boring/src/bio.rs b/boring/src/bio.rs index a0c882a2..6566ebb8 100644 --- a/boring/src/bio.rs +++ b/boring/src/bio.rs @@ -9,7 +9,7 @@ use crate::error::ErrorStack; pub struct MemBioSlice<'a>(*mut ffi::BIO, PhantomData<&'a [u8]>); -impl<'a> Drop for MemBioSlice<'a> { +impl Drop for MemBioSlice<'_> { fn drop(&mut self) { unsafe { ffi::BIO_free_all(self.0); diff --git a/boring/src/bn.rs b/boring/src/bn.rs index b5b02077..27fdeb32 100644 --- a/boring/src/bn.rs +++ b/boring/src/bn.rs @@ -1126,7 +1126,7 @@ macro_rules! delegate { }; } -impl<'a, 'b> Add<&'b BigNumRef> for &'a BigNumRef { +impl Add<&BigNumRef> for &BigNumRef { type Output = BigNum; fn add(self, oth: &BigNumRef) -> BigNum { @@ -1138,7 +1138,7 @@ impl<'a, 'b> Add<&'b BigNumRef> for &'a BigNumRef { delegate!(Add, add); -impl<'a, 'b> Sub<&'b BigNumRef> for &'a BigNumRef { +impl Sub<&BigNumRef> for &BigNumRef { type Output = BigNum; fn sub(self, oth: &BigNumRef) -> BigNum { @@ -1150,7 +1150,7 @@ impl<'a, 'b> Sub<&'b BigNumRef> for &'a BigNumRef { delegate!(Sub, sub); -impl<'a, 'b> Mul<&'b BigNumRef> for &'a BigNumRef { +impl Mul<&BigNumRef> for &BigNumRef { type Output = BigNum; fn mul(self, oth: &BigNumRef) -> BigNum { @@ -1163,7 +1163,7 @@ impl<'a, 'b> Mul<&'b BigNumRef> for &'a BigNumRef { delegate!(Mul, mul); -impl<'a, 'b> Div<&'b BigNumRef> for &'a BigNumRef { +impl<'b> Div<&'b BigNumRef> for &BigNumRef { type Output = BigNum; fn div(self, oth: &'b BigNumRef) -> BigNum { @@ -1176,7 +1176,7 @@ impl<'a, 'b> Div<&'b BigNumRef> for &'a BigNumRef { delegate!(Div, div); -impl<'a, 'b> Rem<&'b BigNumRef> for &'a BigNumRef { +impl<'b> Rem<&'b BigNumRef> for &BigNumRef { type Output = BigNum; fn rem(self, oth: &'b BigNumRef) -> BigNum { @@ -1189,7 +1189,7 @@ impl<'a, 'b> Rem<&'b BigNumRef> for &'a BigNumRef { delegate!(Rem, rem); -impl<'a> Shl for &'a BigNumRef { +impl Shl for &BigNumRef { type Output = BigNum; fn shl(self, n: i32) -> BigNum { @@ -1199,7 +1199,7 @@ impl<'a> Shl for &'a BigNumRef { } } -impl<'a> Shl for &'a BigNum { +impl Shl for &BigNum { type Output = BigNum; fn shl(self, n: i32) -> BigNum { @@ -1207,7 +1207,7 @@ impl<'a> Shl for &'a BigNum { } } -impl<'a> Shr for &'a BigNumRef { +impl Shr for &BigNumRef { type Output = BigNum; fn shr(self, n: i32) -> BigNum { @@ -1217,7 +1217,7 @@ impl<'a> Shr for &'a BigNumRef { } } -impl<'a> Shr for &'a BigNum { +impl Shr for &BigNum { type Output = BigNum; fn shr(self, n: i32) -> BigNum { @@ -1225,7 +1225,7 @@ impl<'a> Shr for &'a BigNum { } } -impl<'a> Neg for &'a BigNumRef { +impl Neg for &BigNumRef { type Output = BigNum; fn neg(self) -> BigNum { @@ -1233,7 +1233,7 @@ impl<'a> Neg for &'a BigNumRef { } } -impl<'a> Neg for &'a BigNum { +impl Neg for &BigNum { type Output = BigNum; fn neg(self) -> BigNum { diff --git a/boring/src/derive.rs b/boring/src/derive.rs index 08a47dfb..66df434f 100644 --- a/boring/src/derive.rs +++ b/boring/src/derive.rs @@ -11,10 +11,10 @@ use crate::{cvt, cvt_p}; /// A type used to derive a shared secret between two keys. pub struct Deriver<'a>(*mut ffi::EVP_PKEY_CTX, PhantomData<&'a ()>); -unsafe impl<'a> Sync for Deriver<'a> {} -unsafe impl<'a> Send for Deriver<'a> {} +unsafe impl Sync for Deriver<'_> {} +unsafe impl Send for Deriver<'_> {} -impl<'a> Drop for Deriver<'a> { +impl Drop for Deriver<'_> { fn drop(&mut self) { unsafe { ffi::EVP_PKEY_CTX_free(self.0); diff --git a/boring/src/sign.rs b/boring/src/sign.rs index 5bfa2bc4..ee68bc7d 100644 --- a/boring/src/sign.rs +++ b/boring/src/sign.rs @@ -78,10 +78,10 @@ pub struct Signer<'a> { _p: PhantomData<&'a ()>, } -unsafe impl<'a> Sync for Signer<'a> {} -unsafe impl<'a> Send for Signer<'a> {} +unsafe impl Sync for Signer<'_> {} +unsafe impl Send for Signer<'_> {} -impl<'a> Drop for Signer<'a> { +impl Drop for Signer<'_> { fn drop(&mut self) { // pkey_ctx is owned by the md_ctx, so no need to explicitly free it. unsafe { @@ -337,7 +337,7 @@ impl<'a> Signer<'a> { } } -impl<'a> Write for Signer<'a> { +impl Write for Signer<'_> { fn write(&mut self, buf: &[u8]) -> io::Result { self.update(buf)?; Ok(buf.len()) @@ -354,10 +354,10 @@ pub struct Verifier<'a> { pkey_pd: PhantomData<&'a ()>, } -unsafe impl<'a> Sync for Verifier<'a> {} -unsafe impl<'a> Send for Verifier<'a> {} +unsafe impl Sync for Verifier<'_> {} +unsafe impl Send for Verifier<'_> {} -impl<'a> Drop for Verifier<'a> { +impl Drop for Verifier<'_> { fn drop(&mut self) { // pkey_ctx is owned by the md_ctx, so no need to explicitly free it. unsafe { @@ -560,7 +560,7 @@ impl<'a> Verifier<'a> { } } -impl<'a> Write for Verifier<'a> { +impl Write for Verifier<'_> { fn write(&mut self, buf: &[u8]) -> io::Result { self.update(buf)?; Ok(buf.len()) diff --git a/boring/src/ssl/bio.rs b/boring/src/ssl/bio.rs index 04f43558..37e2866b 100644 --- a/boring/src/ssl/bio.rs +++ b/boring/src/ssl/bio.rs @@ -219,7 +219,7 @@ struct BIO_METHOD(*mut ffi::BIO_METHOD); impl BIO_METHOD { fn new() -> BIO_METHOD { unsafe { - let ptr = ffi::BIO_meth_new(ffi::BIO_TYPE_NONE, b"rust\0".as_ptr() as *const _); + let ptr = ffi::BIO_meth_new(ffi::BIO_TYPE_NONE, b"rust\0".as_ptr().cast()); assert!(!ptr.is_null()); let ret = BIO_METHOD(ptr); assert!(ffi::BIO_meth_set_write(ptr, Some(bwrite::)) != 0); diff --git a/boring/src/stack.rs b/boring/src/stack.rs index 67b95273..78b2773b 100644 --- a/boring/src/stack.rs +++ b/boring/src/stack.rs @@ -338,7 +338,7 @@ impl<'a, T: Stackable> DoubleEndedIterator for Iter<'a, T> { } } -impl<'a, T: Stackable> ExactSizeIterator for Iter<'a, T> {} +impl ExactSizeIterator for Iter<'_, T> {} /// A mutable iterator over the stack's contents. pub struct IterMut<'a, T: Stackable + 'a> { @@ -372,4 +372,4 @@ impl<'a, T: Stackable> DoubleEndedIterator for IterMut<'a, T> { } } -impl<'a, T: Stackable> ExactSizeIterator for IterMut<'a, T> {} +impl ExactSizeIterator for IterMut<'_, T> {} diff --git a/boring/src/x509/mod.rs b/boring/src/x509/mod.rs index af1d5040..eca2eca9 100644 --- a/boring/src/x509/mod.rs +++ b/boring/src/x509/mod.rs @@ -121,7 +121,7 @@ impl X509StoreContextRef { { struct Cleanup<'a>(&'a mut X509StoreContextRef); - impl<'a> Drop for Cleanup<'a> { + impl Drop for Cleanup<'_> { fn drop(&mut self) { unsafe { ffi::X509_STORE_CTX_cleanup(self.0.as_ptr()); @@ -735,7 +735,7 @@ impl Stackable for X509 { /// A context object required to construct certain `X509` extension values. pub struct X509v3Context<'a>(ffi::X509V3_CTX, PhantomData<(&'a X509Ref, &'a ConfRef)>); -impl<'a> X509v3Context<'a> { +impl X509v3Context<'_> { pub fn as_ptr(&self) -> *mut ffi::X509V3_CTX { &self.0 as *const _ as *mut _ } From 26927a218ec94422fadb87243da3abc80c2b2f42 Mon Sep 17 00:00:00 2001 From: Kornel Date: Thu, 28 Nov 2024 19:01:10 +0000 Subject: [PATCH 2/2] Work around Rust settings inconsistent iOS SDK version --- .github/workflows/ci.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 32aa3afe..d587a4a7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -113,16 +113,22 @@ jobs: target: aarch64-apple-ios os: macos-latest check_only: true + custom_env: + IPHONEOS_DEPLOYMENT_TARGET: 17.5 # It's... theoretically possible to run tests on iPhone Simulator, # but for now, make sure that BoringSSL only builds. - thing: aarch64-ios-sim target: aarch64-apple-ios-sim os: macos-latest check_only: true + custom_env: + IPHONEOS_DEPLOYMENT_TARGET: 17.5 - thing: x86_64-ios target: x86_64-apple-ios os: macos-latest check_only: true + custom_env: + IPHONEOS_DEPLOYMENT_TARGET: 17.5 - thing: i686-linux target: i686-unknown-linux-gnu rust: stable