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

Add function to verify CertifiedKey consistency #1954

Merged
merged 4 commits into from
Jul 3, 2024

Conversation

lvkv
Copy link
Contributor

@lvkv lvkv commented May 17, 2024

Using the subject_public_key_info() function we added in rustls/webpki#253, this PR:

  • Adds a function to trait SigningKey that returns its SubjectPublicKeyInfo, but only if the implementer opts in
  • Adds a function to CertifiedKey that verifies the consistency of its public and private keys by comparing the SPKI values of its end-entity cert and its key

The motivation behind this is to make it possible to verify consistency for public and private keys (#1918).

@lvkv lvkv changed the title Lvkv verify cert key Add function to verify CertifiedKey consistency May 17, 2024
Copy link

codecov bot commented May 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.29%. Comparing base (08bc10d) to head (1326247).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1954    /-   ##
=======================================
  Coverage   94.28%   94.29%           
=======================================
  Files          97       97           
  Lines       21818    21841    23     
=======================================
  Hits        20572    20595    23     
  Misses       1246     1246           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

rustls/src/error.rs Outdated Show resolved Hide resolved
rustls/src/error.rs Outdated Show resolved Hide resolved
rustls/src/crypto/signer.rs Outdated Show resolved Hide resolved
rustls/src/crypto/signer.rs Outdated Show resolved Hide resolved
rustls/src/crypto/signer.rs Outdated Show resolved Hide resolved
rustls/src/crypto/signer.rs Outdated Show resolved Hide resolved
@cpu
Copy link
Member

cpu commented May 17, 2024

Realized I was reviewing at the same time as Ctz so I submitted my partial review :-) I agree with his feedback.

@cpu
Copy link
Member

cpu commented May 17, 2024

Some (hopefully helpful) pointers for the failed CI tasks:

@lvkv lvkv marked this pull request as ready for review May 21, 2024 02:55
@lvkv
Copy link
Contributor Author

lvkv commented May 21, 2024

I'm converting this to a "ready for review" PR, as it's less of a draft now. Questions:

  • It looks like we've agreed to return Ok(None) by default for SigningKey::public_key. This looks sensible, though it means that certificate_and_key_are_consistent will (as this PR is written) always return Error::InvalidCertificate(CertificateError::BadEncoding), since 1. it interprets the absence of a SPKI as an invalid cert and 2. nobody has overridden the default behavior of certificate_and_key_are_consistent yet. I assume the solution is to update the SigningKey implementers in additional PR(s) before putting this current change in a release?
  • @djc / @cpu suggested that we updated the return type of SigningKey::public_key from Result<Option<Vec<u8>>, Error> to Result<Option<SubjectPublicKeyInfoDer>, Error> over at Add function to verify CertifiedKey consistency #1954 (comment). Does this count as an external type? I'm still poking cargo check-external-types, which I haven't gotten to work locally yet 🙂

Also: I can tidy up the commits like we did over at rustls/webpki#253. I'll wait for reviews to settle first, though.

@lvkv lvkv requested review from ctz, cpu and djc May 21, 2024 02:55
rustls/src/crypto/signer.rs Outdated Show resolved Hide resolved
rustls/src/crypto/signer.rs Outdated Show resolved Hide resolved
rustls/src/webpki/verify.rs Outdated Show resolved Hide resolved
rustls/src/crypto/signer.rs Outdated Show resolved Hide resolved
@cpu
Copy link
Member

cpu commented May 21, 2024

It looks like we've agreed to return Ok(None) by default for SigningKey::public_key. This looks sensible, though it means that certificate_and_key_are_consistent will (as this PR is written) always return Error::InvalidCertificate(CertificateError::BadEncoding), since 1. it interprets the absence of a SPKI as an invalid cert and 2. nobody has overridden the default behavior of certificate_and_key_are_consistent yet. I assume the solution is to update the SigningKey implementers in additional PR(s) before putting this current change in a release?

Hmm, yeah, it does seem a little off that if SigningKey::public_key's default impl isn't overridden the new API produces a BadEncoding error. I could see that being confusing. I suggested the bad encoding error thinking it was used only when the SPKI was missing from a cert, but didn't think about the case where the SigningKey wasn't able to provide the information.

Perhaps it would be better to formulate certificate_and_key_are_consistent() (or whatever its name ends up being) to be infallible. Instead of returning a Result<bool>, maybe we could return an enum with variants like Consistent, Inconsistent, Unknown. We'd return Unknown if the SPKI can't be produced for either the key or the cert, Inconsistent if we compared SPKIs and they weren't byte-for-byte identical, and Consistent if they were.

My thinking is that even when we implement public_key() for the aws-lc-rs and ring signing keys there is still the possibility of external implementations of the trait not having caught up yet. I think treating that as an error instead of a variant like Unknown might be too heavy-weight given I see this more as a helper API than load-bearing. WDYT?

rustls/Cargo.toml Outdated Show resolved Hide resolved
@lvkv lvkv requested review from cpu and djc May 22, 2024 03:41
@lvkv
Copy link
Contributor Author

lvkv commented May 22, 2024

Perhaps it would be better to formulate certificate_and_key_are_consistent() (or whatever its name ends up being) to be infallible. Instead of returning a Result, maybe we could return an enum with variants like Consistent, Inconsistent, Unknown. We'd return Unknown if the SPKI can't be produced for either the key or the cert, Inconsistent if we compared SPKIs and they weren't byte-for-byte identical, and Consistent if they were.

@cpu, I took a stab at rewriting the keys_match() function with this in mind. The "unknown" in particular feels a bit goofy to me, like Rustls is a magic 8 ball that wants me to "ask again later" (i.e. when we've gone around and implemented public_key on all the SigningKeys) 🙂

As a dev, I'm unsure if I'd ever handle Unknown differently from Inconsistent differently from Error. I basically only ever want Consistent, and anything else indicates misconfiguration—resulting in either a fast failure, alert or both for whatever system I'm developing.

My thinking is that even when we implement public_key() for the aws-lc-rs and ring signing keys there is still the possibility of external implementations of the trait not having caught up yet. I think treating that as an error instead of a variant like Unknown might be too heavy-weight given I see this more as a helper API than load-bearing. WDYT?

I think the design should reflect whether or not this check will happen by default during the creation of a CertifiedKey (going off of #1918 (comment)). Open to opinions!

@cpu
Copy link
Member

cpu commented May 22, 2024

@cpu, I took a stab at rewriting the keys_match() function with this in mind

Thanks! That looks close to what I was thinking, but I was imagining it wouldn't be a Result<KeyConsistency, Error> return, just KeyConsistency.

The "unknown" in particular feels a bit goofy to me, like Rustls is a magic 8 ball that wants me to "ask again later" (i.e. when we've gone around and implemented public_key on all the SigningKeys)
As a dev, I'm unsure if I'd ever handle Unknown differently from Inconsistent differently from Error. I basically only ever want Consistent, and anything else indicates misconfiguration—resulting in either a fast failure, alert or both for whatever system I'm developing.

Yeah :-/ It is awkward throwing a third variant in the mix.

If folks don't think my suggestion is a net improvement I'm not tied to it and open to alternatives. My main concern was avoiding a bad encoding error for the case where SigningKey::public_key() returns Ok(None). If that's fixed another way I'm also satisfied.

Maybe if the principle call-site we care about using that fn is going to turn it into an error anyway the default impl should be Err(General("unimplemented".into())) (bikeshedding the details as appropriate) instead of Ok(None).

@djc
Copy link
Member

djc commented May 22, 2024

From #1918:

Ideally Rustls would extract the SPKI from the EE certificate and then ask the crypto provider to do a pairwise consistency check as part of the construction of a CertifiedKey.

Is this actually what we're doing? Currently this PR actually just does a byte-for-byte comparison of the SPKI data, right?

@djc
Copy link
Member

djc commented May 22, 2024

Perhaps it would be better to formulate certificate_and_key_are_consistent() (or whatever its name ends up being) to be infallible. Instead of returning a Result<bool>, maybe we could return an enum with variants like Consistent, Inconsistent, Unknown. We'd return Unknown if the SPKI can't be produced for either the key or the cert, Inconsistent if we compared SPKIs and they weren't byte-for-byte identical, and Consistent if they were.

I think the core question is the intended behavior for crypto providers that don't implement this. I think in rustls 0.24 we might want to tighten this up to force crypto provider implementers to support this? If that's the case, I think probably it'd make sense to just yield Result<(), Error> and have the default impl yield Ok(()) for now.

@cpu
Copy link
Member

cpu commented May 22, 2024

Is this actually what we're doing?

Is that your preference? Without strong signal it seems better to follow the plan outlined by Ctz unless there's consensus it isn't the right approach. When that comment was posted I didn't understand the advantages (I'm still not sure I do with crystal clarity). I asked in the Discord thread and Ctz said:

yes, i think he's saying that crypto libraries asked for the public half of a key pair could fulfil the request from a public key they read in (alongside the private key; for example RSA keys in PKCS#1 format) rather than one they computed. i think that seems like a harder situation for a user to get in though, and likely a different problem

@djc
Copy link
Member

djc commented May 22, 2024

Is this actually what we're doing?

Is that your preference? Without strong signal it seems better to follow the plan outlined by Ctz unless there's consensus it isn't the right approach. When that comment was posted I didn't understand the advantages (I'm still not sure I do with crystal clarity).

Ahh, sorry for potentially derailing this discussion from an agreed upon plan. To be clear, doing this is definitely better than doing nothing. I just think "doing SPKI bytes comparison" is probably a weaker guarantee than if we could ask the crypto provider to do curve/group/whatever magic math thing to check that the keys are actually compatible.

@lvkv
Copy link
Contributor Author

lvkv commented May 27, 2024

My main concern was avoiding a bad encoding error for the case where SigningKey::public_key() returns Ok(None). If that's fixed another way I'm also satisfied.

Agree. @cpu How do you guys feel about the following options to avoid this? Ordered from least to most drastic:

  1. Option 1: Change the default implementation of SigningKey::public_key to something along the lines of err(Error::Unimplemented). This would allow us to disambiguate None from unimplemented when implementing CertifiedKey::keys_match and, in turn, avoid us mistaking "unimplemented" for "bad encoding".

  2. Option 2: Remove the default implementation of SigningKey::public_key altogether and frontload the work of implementing it for types that impl SigningKey. This avoids the "unimplemented" case altogether.

  3. Option 3: All of Option 2, plus removing the Option from the return type of SigningKey::public_key, taking it from Result<Option<SubjectPublicKeyInfoDer>, Error> to Result<SubjectPublicKeyInfoDer, Error>. This would eliminate both the "unimplemented" problem, but also the "unknown" case when one of the SPKIs is None.

Also open to suggestions!

@cpu
Copy link
Member

cpu commented May 29, 2024

@lvkv From my perspective I think Option 1 is probably the most agreeable. Option 2 and 3 will be breaking API changes to the exported SigningKey trait and we're trying to avoid those while the ecosystem is catching up w/ our last release.

@djc
Copy link
Member

djc commented May 30, 2024

Option 1 sounds good, maybe we should file an issue with a label to remind ourselves to remove the default impl for the next semver-breaking release?

@ctz
Copy link
Member

ctz commented May 30, 2024

I was thinking originally we could call the new consistency API CertifiedKey::keys_match in several places that accept CertifiedKeys and are already fallible. There are only a few such places, but doing that unprompted requires either a) we don't treat missing SigningKey::public_key as an error, or b) require SigningKey::public_key as a fundamental part of that trait.

(a) means we can add those calls, and land this PR before writing the wedge of encoding conversion code that would be needed for the impls of SigningKey just in this crate.

(b) I think is a tough sell, needing a lot of research. For example, can you get a public key given a windows NCRYPT_KEY_HANDLE? I have no idea, but it seems not, and the suggestion is to look up the certificate and extract the public key from that (which would be quite circular...)

The other option, of course, is that we don't insert those calls, and leave the API for others to call when they know or expect their SigningKey to support getting the public key.

@djc
Copy link
Member

djc commented May 30, 2024

Right, so I think this probably is the right direction still:

I think the core question is the intended behavior for crypto providers that don't implement this. I think in rustls 0.24 we might want to tighten this up to force crypto provider implementers to support this? If that's the case, I think probably it'd make sense to just yield Result<(), Error> and have the default impl yield Ok(()) for now.

@cpu
Copy link
Member

cpu commented Jun 12, 2024

@lvkv Apologies, I think we lost some of the earlier momentum we had going here. Have you become busy (very reasonable!) or are there remaining points of uncertainty we should try and hash out to unblock progress?

@lvkv
Copy link
Contributor Author

lvkv commented Jun 12, 2024

Thanks for checking in. I'll be much more available after a few days! (Apartment hunting moving in NYC)

@lvkv
Copy link
Contributor Author

lvkv commented Jun 15, 2024

Coming back to this now! It's not clear to me, based on the discussion above, that there's a consensus yet on what the API for this should look like and why 🙂.

One idea to unstick the conversation: how do we feel about merging what we have right now (after cleanup)? I've also just added a commit to bring code coverage up to 100%. The plan would be:

  • Clean up and land this PR with its current API
  • Begin working on public_key implementations
  • (Optional) Revise the API as needed for the next minor release

Edit: typo

@lvkv lvkv requested review from cpu and djc June 19, 2024 17:08
Copy link

rustls-benchmarking bot commented Jun 20, 2024

Benchmark results

Instruction counts

Significant differences

There are no significant instruction count differences

Other differences

Click to expand
Scenario Baseline Candidate Diff Threshold
handshake_session_id_aws_lc_rs_1.2_rsa_aes_server 3875329 3973880 98551 (2.54%) 6.18%
handshake_tickets_aws_lc_rs_1.2_rsa_aes_server 4433645 4516641 82996 (1.87%) 3.90%
handshake_no_resume_aws_lc_rs_1.2_rsa_aes_server 13415528 13351001 -64527 (-0.48%) 0.89%
handshake_no_resume_aws_lc_rs_1.3_ecdsap384_aes_client 8760828 8741435 -19393 (-0.22%) 0.98%
handshake_no_resume_ring_1.3_ecdsap256_aes_server 2131256 2135893 4637 (0.22%) 0.81%
handshake_no_resume_ring_1.3_ecdsap256_chacha_client 3922318 3913823 -8495 (-0.22%) 0.33%
handshake_no_resume_ring_1.3_ecdsap256_chacha_server 2137601 2133242 -4359 (-0.20%) 0.82%
handshake_no_resume_aws_lc_rs_1.3_rsa_aes_server 13774669 13801360 26691 (0.19%) 0.78%
handshake_session_id_aws_lc_rs_1.3_rsa_aes_server 32955275 32993605 38330 (0.12%) 0.67%
handshake_no_resume_ring_1.3_ecdsap256_aes_client 3916520 3920888 4368 (0.11%) 0.46%
handshake_tickets_aws_lc_rs_1.3_rsa_chacha_server 33464929 33501996 37067 (0.11%) 0.46%
handshake_session_id_aws_lc_rs_1.3_ecdsap384_chacha_client 30648777 30615366 -33411 (-0.11%) 0.31%
handshake_no_resume_aws_lc_rs_1.3_ecdsap384_chacha_client 8778649 8771173 -7476 (-0.09%) 0.71%
transfer_no_resume_aws_lc_rs_1.2_rsa_aes_server 46387213 46426705 39492 (0.09%) 0.38%
handshake_no_resume_aws_lc_rs_1.3_ecdsap256_aes_client 3382332 3379952 -2380 (-0.07%) 0.24%
handshake_session_id_aws_lc_rs_1.3_ecdsap384_aes_client 30674788 30691860 17072 (0.06%) 0.41%
transfer_no_resume_aws_lc_rs_1.3_ecdsap384_aes_client 58247230 58278308 31078 (0.05%) 0.20%
transfer_no_resume_aws_lc_rs_1.3_rsa_chacha_server 80601637 80641895 40258 (0.05%) 0.23%
handshake_no_resume_aws_lc_rs_1.3_rsa_chacha_server 13801434 13795385 -6049 (-0.04%) 1.00%
transfer_no_resume_aws_lc_rs_1.3_rsa_aes_server 46454867 46437482 -17385 (-0.04%) 0.27%
handshake_tickets_aws_lc_rs_1.3_ecdsap384_chacha_client 31108553 31097248 -11305 (-0.04%) 0.31%
handshake_tickets_aws_lc_rs_1.3_ecdsap384_aes_client 31151710 31162886 11176 (0.04%) 0.39%
handshake_tickets_aws_lc_rs_1.3_ecdsap256_aes_client 31134072 31143464 9392 (0.03%) 0.20%
handshake_tickets_ring_1.3_ecdsap256_chacha_client 42269712 42282236 12524 (0.03%) 0.20%
transfer_no_resume_aws_lc_rs_1.3_ecdsap384_chacha_client 92722571 92696038 -26533 (-0.03%) 0.20%
handshake_session_id_aws_lc_rs_1.3_ecdsap256_aes_client 30673105 30681706 8601 (0.03%) 0.20%
handshake_session_id_aws_lc_rs_1.2_rsa_aes_client 4001721 4000628 -1093 (-0.03%) 0.20%
handshake_session_id_aws_lc_rs_1.3_ecdsap256_chacha_client 30649388 30657513 8125 (0.03%) 0.20%
handshake_session_id_aws_lc_rs_1.3_rsa_chacha_server 32889444 32896995 7551 (0.02%) 0.56%
handshake_session_id_aws_lc_rs_1.3_rsa_chacha_client 30662745 30669721 6976 (0.02%) 0.20%
handshake_session_id_aws_lc_rs_1.3_ecdsap256_chacha_server 32939167 32946196 7029 (0.02%) 0.20%
handshake_session_id_ring_1.3_ecdsap256_chacha_client 41810548 41819285 8737 (0.02%) 0.20%
handshake_session_id_aws_lc_rs_1.3_ecdsap256_aes_server 32980554 32987347 6793 (0.02%) 0.20%
handshake_session_id_aws_lc_rs_1.3_ecdsap384_chacha_server 32940214 32946817 6603 (0.02%) 0.20%
handshake_tickets_ring_1.3_ecdsap256_chacha_server 43953580 43962390 8810 (0.02%) 0.20%
handshake_tickets_aws_lc_rs_1.3_ecdsap256_chacha_server 33516863 33523525 6662 (0.02%) 0.20%
transfer_no_resume_ring_1.3_ecdsap256_aes_server 46462823 46453647 -9176 (-0.02%) 0.20%
handshake_session_id_aws_lc_rs_1.3_ecdsap384_aes_server 32980506 32986919 6413 (0.02%) 0.20%
handshake_no_resume_aws_lc_rs_1.3_ecdsap256_chacha_client 3385684 3385047 -637 (-0.02%) 0.28%
handshake_tickets_aws_lc_rs_1.3_ecdsap384_aes_server 33549454 33555735 6281 (0.02%) 0.20%
handshake_tickets_aws_lc_rs_1.3_rsa_chacha_client 31132583 31138374 5791 (0.02%) 0.20%
handshake_tickets_aws_lc_rs_1.3_ecdsap256_chacha_client 31116249 31121845 5596 (0.02%) 0.20%
handshake_tickets_aws_lc_rs_1.3_rsa_aes_client 31153786 31159148 5362 (0.02%) 0.20%
handshake_tickets_ring_1.3_rsa_chacha_client 42286029 42292902 6873 (0.02%) 0.20%
transfer_no_resume_ring_1.3_ecdsap256_aes_client 58323097 58313640 -9457 (-0.02%) 0.20%
handshake_session_id_ring_1.3_ecdsap384_aes_server 43465421 43472198 6777 (0.02%) 0.20%
handshake_session_id_aws_lc_rs_1.3_rsa_aes_client 30689157 30693764 4607 (0.02%) 0.20%
handshake_session_id_ring_1.3_ecdsap384_aes_client 41885084 41891294 6210 (0.01%) 0.20%
handshake_session_id_ring_1.3_ecdsap256_chacha_server 43366209 43372631 6422 (0.01%) 0.20%
handshake_tickets_aws_lc_rs_1.3_ecdsap384_chacha_server 33517127 33522078 4951 (0.01%) 0.20%
handshake_tickets_ring_1.3_ecdsap384_aes_client 42333476 42339634 6158 (0.01%) 0.20%
handshake_session_id_ring_1.3_rsa_aes_server 43463553 43469619 6066 (0.01%) 0.20%
handshake_tickets_ring_1.3_ecdsap384_aes_server 44038899 44045015 6116 (0.01%) 0.20%
handshake_tickets_aws_lc_rs_1.3_ecdsap256_aes_server 33549939 33554538 4599 (0.01%) 0.20%
handshake_tickets_ring_1.3_rsa_aes_server 44035511 44041540 6029 (0.01%) 0.20%
handshake_no_resume_aws_lc_rs_1.3_ecdsap256_aes_server 1912485 1912737 252 (0.01%) 0.20%
handshake_session_id_ring_1.3_ecdsap384_chacha_server 43366505 43372137 5632 (0.01%) 0.20%
handshake_tickets_ring_1.3_ecdsap384_chacha_client 42268812 42274176 5364 (0.01%) 0.20%
transfer_no_resume_aws_lc_rs_1.3_ecdsap256_aes_client 58254735 58262061 7326 (0.01%) 0.20%
handshake_session_id_ring_1.3_rsa_chacha_client 41822717 41827908 5191 (0.01%) 0.20%
handshake_session_id_ring_1.3_rsa_aes_client 41904599 41909632 5033 (0.01%) 0.20%
handshake_tickets_ring_1.2_rsa_aes_server 4691316 4691826 510 (0.01%) 0.20%
handshake_tickets_ring_1.3_rsa_aes_client 42352700 42357212 4512 (0.01%) 0.20%
handshake_tickets_ring_1.2_rsa_aes_client 4529554 4529072 -482 (-0.01%) 0.20%
handshake_tickets_ring_1.3_rsa_chacha_server 43953717 43958381 4664 (0.01%) 0.20%
handshake_session_id_ring_1.3_ecdsap384_chacha_client 41805150 41809522 4372 (0.01%) 0.20%
handshake_session_id_ring_1.3_rsa_chacha_server 43364475 43369500 4525 (0.01%) 0.20%
handshake_session_id_ring_1.2_rsa_aes_server 4251406 4251823 417 (0.01%) 0.20%
handshake_no_resume_ring_1.2_rsa_aes_client 2854054 2853787 -267 (-0.01%) 0.20%
handshake_no_resume_aws_lc_rs_1.2_rsa_aes_client 2016629 2016811 182 (0.01%) 0.20%
handshake_tickets_ring_1.3_ecdsap384_chacha_server 43956484 43960186 3702 (0.01%) 0.20%
handshake_no_resume_aws_lc_rs_1.3_ecdsap384_chacha_server 4295053 4295410 357 (0.01%) 0.20%
handshake_session_id_ring_1.3_ecdsap256_aes_server 43465507 43469044 3537 (0.01%) 0.20%
handshake_tickets_aws_lc_rs_1.2_rsa_aes_client 4325084 4324764 -320 (-0.01%) 0.20%
handshake_no_resume_ring_1.3_rsa_aes_client 2950709 2950924 215 (0.01%) 0.20%
transfer_no_resume_ring_1.3_ecdsap256_chacha_client 92646556 92653083 6527 (0.01%) 0.20%
transfer_no_resume_ring_1.3_ecdsap256_chacha_server 80522309 80526667 4358 (0.01%) 0.20%
handshake_tickets_ring_1.3_ecdsap256_aes_client 42338368 42340150 1782 (0.00%) 0.20%
handshake_no_resume_aws_lc_rs_1.3_ecdsap384_aes_server 4291952 4291778 -174 (-0.00%) 0.20%
handshake_no_resume_aws_lc_rs_1.3_rsa_chacha_client 2234578 2234499 -79 (-0.00%) 0.20%
handshake_no_resume_aws_lc_rs_1.3_rsa_aes_client 2227489 2227567 78 (0.00%) 0.20%
handshake_no_resume_ring_1.3_rsa_aes_server 12177374 12177736 362 (0.00%) 0.20%
handshake_no_resume_aws_lc_rs_1.3_ecdsap256_chacha_server 1915777 1915831 54 (0.00%) 0.20%
handshake_session_id_ring_1.3_ecdsap256_aes_client 41889522 41890587 1065 (0.00%) 0.20%
handshake_tickets_ring_1.3_ecdsap256_aes_server 44039543 44040416 873 (0.00%) 0.20%
handshake_no_resume_ring_1.3_ecdsap384_aes_server 13739228 13739448 220 (0.00%) 0.20%
handshake_no_resume_ring_1.3_rsa_chacha_client 2956683 2956636 -47 (-0.00%) 0.20%
handshake_tickets_aws_lc_rs_1.3_rsa_aes_server 33557843 33557363 -480 (-0.00%) 0.59%
transfer_no_resume_aws_lc_rs_1.3_ecdsap384_aes_server 46452169 46452691 522 (0.00%) 0.20%
handshake_session_id_ring_1.2_rsa_aes_client 4264670 4264626 -44 (-0.00%) 0.20%
transfer_no_resume_aws_lc_rs_1.3_ecdsap256_chacha_client 92715980 92716933 953 (0.00%) 0.20%
handshake_no_resume_ring_1.3_ecdsap384_aes_client 35473839 35473507 -332 (-0.00%) 0.20%
handshake_no_resume_ring_1.2_rsa_aes_server 11988671 11988575 -96 (-0.00%) 0.20%
handshake_no_resume_ring_1.3_ecdsap384_chacha_server 13741605 13741711 106 (0.00%) 0.20%
transfer_no_resume_aws_lc_rs_1.2_rsa_aes_client 68658507 68658036 -471 (-0.00%) 0.20%
transfer_no_resume_aws_lc_rs_1.3_rsa_chacha_client 92718939 92719565 626 (0.00%) 0.20%
transfer_no_resume_ring_1.3_ecdsap384_aes_client 58314414 58314757 343 (0.00%) 0.20%
handshake_no_resume_ring_1.3_rsa_chacha_server 12183382 12183440 58 (0.00%) 0.20%
transfer_no_resume_aws_lc_rs_1.3_ecdsap256_chacha_server 80632005 80632319 314 (0.00%) 0.20%
transfer_no_resume_ring_1.3_ecdsap384_chacha_server 80530161 80530469 308 (0.00%) 0.20%
transfer_no_resume_aws_lc_rs_1.3_ecdsap256_aes_server 46453194 46453017 -177 (-0.00%) 0.20%
transfer_no_resume_ring_1.2_rsa_aes_client 58200538 58200697 159 (0.00%) 0.20%
transfer_no_resume_ring_1.3_ecdsap384_chacha_client 92647565 92647788 223 (0.00%) 0.20%
transfer_no_resume_aws_lc_rs_1.3_rsa_aes_client 58262002 58262139 137 (0.00%) 0.20%
transfer_no_resume_ring_1.3_rsa_aes_client 58319428 58319322 -106 (-0.00%) 0.20%
transfer_no_resume_ring_1.3_rsa_chacha_client 92652182 92652323 141 (0.00%) 0.20%
transfer_no_resume_ring_1.3_rsa_chacha_server 80538845 80538963 118 (0.00%) 0.20%
transfer_no_resume_ring_1.3_rsa_aes_server 46470206 46470147 -59 (-0.00%) 0.20%
transfer_no_resume_ring_1.2_rsa_aes_server 46376070 46376113 43 (0.00%) 0.20%
transfer_no_resume_ring_1.3_ecdsap384_aes_server 46462213 46462246 33 (0.00%) 0.20%
handshake_no_resume_ring_1.3_ecdsap384_chacha_client 35475452 35475474 22 (0.00%) 0.20%
transfer_no_resume_aws_lc_rs_1.3_ecdsap384_chacha_server 80631444 80631486 42 (0.00%) 0.20%

Wall-time

Significant differences

⚠️ There are significant wall-time differences

Click to expand
Scenario Baseline Candidate Diff Threshold
handshake_no_resume_aws_lc_rs_1.2_rsa_aes 1.35 ms 1.39 ms ⚠️ 0.04 ms (2.84%) 2.06%
handshake_no_resume_aws_lc_rs_1.3_rsa_aes 1.41 ms 1.44 ms ⚠️ 0.04 ms (2.75%) 2.31%
handshake_tickets_aws_lc_rs_1.2_rsa_aes 2.22 ms 2.27 ms ⚠️ 0.05 ms (2.12%) 1.00%
handshake_session_id_aws_lc_rs_1.2_rsa_aes 2.06 ms 2.10 ms ⚠️ 0.04 ms (1.95%) 1.04%
handshake_tickets_ring_1.2_rsa_aes 1.64 ms 1.66 ms ⚠️ 0.03 ms (1.69%) 1.23%
handshake_session_id_ring_1.2_rsa_aes 1.55 ms 1.58 ms ⚠️ 0.03 ms (1.67%) 1.32%

Other differences

Click to expand
Scenario Baseline Candidate Diff Threshold
handshake_no_resume_aws_lc_rs_1.3_rsa_chacha 1.40 ms 1.44 ms 0.04 ms (3.00%) 3.14%
transfer_no_resume_aws_lc_rs_1.3_rsa_aes 5.41 ms 5.57 ms 0.16 ms (2.91%) 3.23%
transfer_no_resume_aws_lc_rs_1.2_rsa_aes 5.40 ms 5.55 ms 0.15 ms (2.81%) 3.03%
transfer_no_resume_aws_lc_rs_1.3_ecdsap256_aes 4.48 ms 4.60 ms 0.12 ms (2.75%) 3.99%
transfer_no_resume_aws_lc_rs_1.3_ecdsap384_aes 5.21 ms 5.32 ms 0.12 ms (2.23%) 3.27%
transfer_no_resume_ring_1.3_ecdsap256_aes 6.31 ms 6.43 ms 0.12 ms (1.85%) 3.07%
handshake_no_resume_aws_lc_rs_1.3_ecdsap256_aes 479.96 µs 488.73 µs 8.76 µs (1.83%) 2.77%
transfer_no_resume_ring_1.2_rsa_aes 6.72 ms 6.84 ms 0.12 ms (1.81%) 2.95%
transfer_no_resume_ring_1.3_rsa_aes 6.79 ms 6.91 ms 0.12 ms (1.78%) 2.67%
handshake_no_resume_aws_lc_rs_1.3_ecdsap256_chacha 478.93 µs 487.03 µs 8.09 µs (1.69%) 2.89%
handshake_no_resume_ring_1.3_ecdsap256_chacha 503.59 µs 509.96 µs 6.37 µs (1.27%) 2.04%
transfer_no_resume_ring_1.3_ecdsap384_aes 9.40 ms 9.52 ms 0.12 ms (1.24%) 1.73%
handshake_no_resume_ring_1.3_ecdsap256_aes 507.27 µs 513.38 µs 6.10 µs (1.20%) 2.35%
transfer_no_resume_aws_lc_rs_1.3_rsa_chacha 13.87 ms 14.03 ms 0.16 ms (1.13%) 1.40%
handshake_tickets_aws_lc_rs_1.3_rsa_chacha 6.34 ms 6.42 ms 0.07 ms (1.13%) 1.22%
handshake_tickets_aws_lc_rs_1.3_rsa_aes 6.35 ms 6.41 ms 0.07 ms (1.05%) 1.19%
transfer_no_resume_ring_1.3_ecdsap256_chacha 12.95 ms 13.07 ms 0.13 ms (0.98%) 1.37%
handshake_session_id_aws_lc_rs_1.3_rsa_aes 6.30 ms 6.36 ms 0.06 ms (0.96%) 1.11%
transfer_no_resume_aws_lc_rs_1.3_ecdsap256_chacha 12.94 ms 13.06 ms 0.12 ms (0.95%) 1.53%
transfer_no_resume_ring_1.3_rsa_chacha 13.44 ms 13.55 ms 0.12 ms (0.89%) 1.32%
transfer_no_resume_aws_lc_rs_1.3_ecdsap384_chacha 13.66 ms 13.77 ms 0.12 ms (0.87%) 1.32%
handshake_session_id_aws_lc_rs_1.3_rsa_chacha 6.28 ms 6.34 ms 0.05 ms (0.85%) 1.10%
transfer_no_resume_ring_1.3_ecdsap384_chacha 16.04 ms 16.17 ms 0.13 ms (0.79%) 1.22%
handshake_no_resume_aws_lc_rs_1.3_ecdsap384_chacha 1.19 ms 1.20 ms 0.01 ms (0.75%) 1.00%
handshake_tickets_aws_lc_rs_1.3_ecdsap256_aes 5.41 ms 5.44 ms 0.04 ms (0.66%) 1.51%
handshake_tickets_aws_lc_rs_1.3_ecdsap256_chacha 5.41 ms 5.44 ms 0.04 ms (0.66%) 1.39%
handshake_tickets_aws_lc_rs_1.3_ecdsap384_chacha 6.11 ms 6.15 ms 0.04 ms (0.64%) 1.15%
handshake_tickets_ring_1.3_rsa_aes 7.24 ms 7.29 ms 0.05 ms (0.64%) 1.00%
handshake_tickets_ring_1.3_ecdsap256_aes 6.76 ms 6.81 ms 0.04 ms (0.63%) 1.00%
handshake_no_resume_aws_lc_rs_1.3_ecdsap384_aes 1.20 ms 1.21 ms 0.01 ms (0.59%) 1.00%
handshake_no_resume_ring_1.2_rsa_aes 978.00 µs 983.70 µs 5.70 µs (0.58%) 1.12%
handshake_session_id_aws_lc_rs_1.3_ecdsap256_aes 5.36 ms 5.39 ms 0.03 ms (0.58%) 1.69%
handshake_tickets_aws_lc_rs_1.3_ecdsap384_aes 6.12 ms 6.16 ms 0.03 ms (0.55%) 1.47%
handshake_tickets_ring_1.3_ecdsap256_chacha 6.73 ms 6.77 ms 0.04 ms (0.53%) 1.00%
handshake_session_id_ring_1.3_ecdsap256_aes 6.72 ms 6.75 ms 0.04 ms (0.53%) 1.00%
handshake_tickets_ring_1.3_rsa_chacha 7.20 ms 7.24 ms 0.04 ms (0.50%) 1.00%
handshake_session_id_ring_1.3_rsa_aes 7.20 ms 7.24 ms 0.04 ms (0.50%) 1.00%
handshake_no_resume_ring_1.3_rsa_aes 989.16 µs 993.96 µs 4.80 µs (0.48%) 1.13%
handshake_session_id_aws_lc_rs_1.3_ecdsap256_chacha 5.35 ms 5.37 ms 0.03 ms (0.47%) 1.36%
handshake_session_id_aws_lc_rs_1.3_ecdsap384_aes 6.08 ms 6.10 ms 0.03 ms (0.44%) 1.28%
handshake_tickets_ring_1.3_ecdsap384_aes 9.84 ms 9.89 ms 0.04 ms (0.43%) 1.00%
handshake_no_resume_ring_1.3_rsa_chacha 989.83 µs 994.01 µs 4.18 µs (0.42%) 1.27%
handshake_session_id_ring_1.3_rsa_chacha 7.16 ms 7.19 ms 0.03 ms (0.41%) 1.00%
handshake_session_id_ring_1.3_ecdsap256_chacha 6.68 ms 6.71 ms 0.03 ms (0.39%) 1.00%
handshake_session_id_aws_lc_rs_1.3_ecdsap384_chacha 6.05 ms 6.07 ms 0.02 ms (0.36%) 1.20%
handshake_tickets_ring_1.3_ecdsap384_chacha 9.81 ms 9.84 ms 0.03 ms (0.34%) 1.00%
handshake_session_id_ring_1.3_ecdsap384_chacha 9.76 ms 9.79 ms 0.03 ms (0.26%) 1.00%
handshake_session_id_ring_1.3_ecdsap384_aes 9.80 ms 9.82 ms 0.03 ms (0.26%) 1.00%
handshake_no_resume_ring_1.3_ecdsap384_aes 3.60 ms 3.61 ms 0.01 ms (0.20%) 1.00%
handshake_no_resume_ring_1.3_ecdsap384_chacha 3.60 ms 3.61 ms 0.01 ms (0.19%) 1.00%

Additional information

Historical results

Checkout details:

Copy link
Member

@cpu cpu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! I had a couple suggestions for the commit order/content.

rustls/src/error.rs Outdated Show resolved Hide resolved
rustls/src/lib.rs Show resolved Hide resolved
rustls/src/error.rs Outdated Show resolved Hide resolved
@lvkv
Copy link
Contributor Author

lvkv commented Jun 24, 2024

Cool, I'll add these in today

@lvkv
Copy link
Contributor Author

lvkv commented Jun 25, 2024

Home stretch! This one felt a bit slow, so I'm down to increase the pace for whatever work follows this PR

Copy link
Member

@djc djc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for all the work on this!

rustls/src/webpki/verify.rs Outdated Show resolved Hide resolved
rustls/src/crypto/signer.rs Outdated Show resolved Hide resolved
@lvkv lvkv force-pushed the lvkv-verify-cert-key branch 2 times, most recently from 751d1da to e0ccb07 Compare July 3, 2024 17:24
Copy link
Member

@cpu cpu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

rustls/tests/api.rs Outdated Show resolved Hide resolved
@cpu cpu enabled auto-merge July 3, 2024 18:00
@cpu cpu added this pull request to the merge queue Jul 3, 2024
Merged via the queue into rustls:main with commit cc393e7 Jul 3, 2024
25 checks passed
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.

None yet

4 participants