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

crypto/tls: cache TLS (client) cert validation? #8580

Closed
gopherbot opened this issue Aug 24, 2014 · 5 comments
Closed

crypto/tls: cache TLS (client) cert validation? #8580

gopherbot opened this issue Aug 24, 2014 · 5 comments
Labels
FrozenDueToAge NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Milestone

Comments

@gopherbot
Copy link

by justin@fathomdb.com:

I'm seeing not-great TLS performance; enabling the ClientSessionCache seems to help. 
But it looks like even when resuming a session, we still call processCertsFromClient,
and do an (expensive) validation of the client cert chain.

Two ideas/questions:

1) Do we really need to re-validate the client cert on resume (haven't we already
validated it on first-connect)?  Can the client switch certs on us?

2) Is it possible to avoid any of this work using a cache?  processCertsFromClient looks
very cacheable to my untrained eye.  I'm thinking something similar to
ClientSessionCache in tls.Config.


I guess I could turn off client-cert validation by the tls package, and implement my own
cache.  It would sure be nice if this was out-of-the-box though!

Session resumption makes this less important, but I don't see why we wouldn't also cache
validation of server certs.
@gopherbot
Copy link
Author

Comment 1 by justin@fathomdb.com:

An update/clarification:
The expensive bit of the cert-chain validation seems to be the EC computations (my code
spends 50% of CPU time in crypto/elliptic.p256ReduceDegree).
I suggest a good approach might be to memoize the crypto computations (which never
change).  So we wouldn't worry about caching usage verifications or expiration times,
and would rely on the standard caching of e.g. CRLs.  I believe those checks are
comparatively cheap, and much harder to cache correctly.

@bradfitz
Copy link
Contributor

Comment 2:

Copying Adam, who owns TLS.
Naively, without knowing the code, it seems like caching EC computations seems sane if
the hit rate is high and the cache is bounded.

Labels changed: added release-go1.4, repo-main.

Status changed to Accepted.

@rsc
Copy link
Contributor

rsc commented Sep 15, 2014

Comment 3:

Labels changed: added release-none, removed release-go1.4.

@rsc rsc added this to the Unplanned milestone Apr 10, 2015
@odeke-em
Copy link
Member

/cc @agl

@bradfitz bradfitz added the NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. label Feb 18, 2017
@FiloSottile
Copy link
Contributor

Duplicate of #31641

@FiloSottile FiloSottile marked this as a duplicate of #31641 May 7, 2020
@golang golang locked and limited conversation to collaborators May 7, 2021
@rsc rsc unassigned agl Jun 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Projects
None yet
Development

No branches or pull requests

6 participants