rustls-ffi icon indicating copy to clipboard operation
rustls-ffi copied to clipboard

MSRV >= 1.76: Tidy up crypto provider customization

Open cpu opened this issue 1 year ago • 0 comments

In the crypto provider integration code's CryptoProviderBuilder struct (from https://github.com/rustls/rustls-ffi/pull/441), there is an instance of awkward CryptoProvider initialization:

        CryptoProvider {
            cipher_suites,
            kx_groups: self.base.kx_groups.clone(),
            signature_verification_algorithms: self.base.signature_verification_algorithms,
            secure_random: self.base.secure_random,
            key_provider: self.base.key_provider,
        }

We would ideally use the struct update syntax, .. to fill in the non-customized fields (everything but cipher_suites), but we can't do that naively with the Arc<CryptoProvider> we have as a base - we need a CryptoProvider.

Arc::unwrap_or_clone() would allow this in a convenient fashion but we can't use that until our MSRV is >= 1.76, so this issue is a reminder for the future.

cpu avatar Jul 30 '24 15:07 cpu