MSRV >= 1.76: Tidy up crypto provider customization

Open
#450 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
35/100
Issue type
Refactor
Clarity
Clearly specified
Activity status
Stale
Tech stack
rust

Research direction

Start in the crypto provider integration code at the CryptoProviderBuilder struct and review how its base Arc is used. Once the MSRV is at least 1.76, replace the explicit non-customized field initialization with struct update syntax while preserving the customized cipher_suites field; verify the integration still builds and tests pass.

Written by the indexing model from the issue text.

Description

enhancement

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.

Dominant language
Rust
Stars
171
Forks
45
Avg merge
16h 43m
Merged PRs (30d)
18

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from rustls/rustls-ffi

All issues in rustls/rustls-ffi

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.