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

Open
gopherbot opened this issue Aug 24, 2014 · 4 comments

Comments

Projects
None yet
5 participants
@gopherbot
Copy link

commented Aug 24, 2014

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

This comment has been minimized.

Copy link
Author

commented Aug 25, 2014

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

This comment has been minimized.

Copy link
Member

commented Aug 25, 2014

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

This comment has been minimized.

Copy link
Contributor

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

@rsc rsc removed release-none labels Apr 10, 2015

@odeke-em

This comment has been minimized.

Copy link
Member

commented Feb 18, 2017

/cc @agl

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.