Wrap TrustAnchor array items in AsRef<T>

Open
#505 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
48/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Quiet
Tech stack
rust
Domain
security

Research direction

Start by reading the TrustAnchor uses in src/verify_cert.rs and src/end_entity.rs, then search the repository for other borrowed arrays of owned TrustAnchors. Check which callers require ownership versus only borrowed access; done means the applicable APIs accept reusable borrowed TrustAnchors without breaking existing owned callers.

Written by the indexing model from the issue text.

Description

There are some places that take a borrowed array of owned TrustAnchors e.g.,

E.g.,
https://github.com/rustls/webpki/blob/34e8f9ecc811ea678a3a7eef8db3a2974f4628bb/src/verify_cert.rs#L39
https://github.com/rustls/webpki/blob/2879b2ce7a476181ac3050f73fe0835f04728e86/src/end_entity.rs#L106

I believe the array sub-type can be wrapped in AsRef in many of these cases e.g.,
trust_anchors: &'p [AsRef<TrustAnchor<'_>>],

In some of the uses, the implementation doesn't seem to actually need ownership of the TrustAnchor and just reads from it a bit. Optionally accepting a borrowed reference should be helpful for cases e.g., where one or more of the TrustAnchors are cached and re-used.

Dominant language
Rust
Stars
167
Forks
112
Avg merge
4h 28m
Merged PRs (30d)
4

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/webpki

All issues in rustls/webpki

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.