Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split up modules, support no built-in providers, small tidying #505

Merged
merged 7 commits into from
Dec 17, 2024

Conversation

cpu
Copy link
Member

@cpu cpu commented Dec 16, 2024

  • Splits up cipher.rs and lib.rs. The former was quite large, and the latter should ideally be just mod definitions and not substantial code.

  • Adds support for building rustls-ffi without a built-in provider. Mechanically this was always possible, but cargo test wouldn't work without some effort. The client/server examples continue to enforce that a provider is supplied. This build configuration only makes sense for downstream consumers that want to bring their own FFI-ready crypto provider.

  • Tidies up Rust imports to match the Rustls convention.

  • Removes single variant rustls_result enum imports.

  • Fixes cargo capi test by ignoring the version test in this configuration.

  • Removes a small acceptor test helper that wasn't carrying its weight.

Resolves #231

cpu added 4 commits December 16, 2024 09:38
Previously the `cipher` mod was very large. This commit splits it into
three modules:

* `certificate` for the certificate, certified key, and root store
  code.
* `verifier` for the client/server verifier code.
* `cipher` for the remaining ciphersuite/protocol code.

References are updated throughout.
* Move user data related code to `userdata` mod
* Move FFI macro related code to `ffi` mod
* Move version related code to `version` mod
We almost always keep the `rustls_result` enum in-scope because we
return many variants from it. Importing some specific variants is
confusing and we're not doing it consistently. Instead, always use the
`rustls_results::` prefix for referencing variants.
@cpu cpu self-assigned this Dec 16, 2024
@cpu cpu requested a review from ctz December 17, 2024 16:58
.github/workflows/test.yaml Outdated Show resolved Hide resolved
.github/workflows/test.yaml Outdated Show resolved Hide resolved
cpu added 3 commits December 17, 2024 17:08
Also tack a `cargo test --no-default-features` into CI to make sure we
don't regress. The integration tests that use client.c/server.c can't
support this build type: they require a built-in provider.
When running under `cargo ctest` the `rustls-ffi` import doesn't work
for this small integration test.

It's not worth debugging atm. Let's just ignore it for now and only run
the test from the normal 'cargo test' invocation where it works.
The `make_acceptor()` test helper is only used in 2 places, and just
directly invokes a simple constructor. Let's do that in the call-sites
directly instead of adding unhelpful indirection.
@cpu
Copy link
Member Author

cpu commented Dec 17, 2024

Since this is just moving existing code around, making cosmetic tweaks, or build-gating tests I'm going to merge w/o waiting for further review. Always happy to iterate further.

@cpu cpu merged commit 1a1a7f1 into rustls:main Dec 17, 2024
35 checks passed
@cpu cpu deleted the cpu-rust-tidy branch December 17, 2024 22:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Split up cipher.rs into cipher_suites.rs and certificates.rs
2 participants