-
Notifications
You must be signed in to change notification settings - Fork 18k
crypto/tls: Export TLS default cipher suites #21167
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
Comments
cc @agl |
Possible hack: write a func to use crypto/tls to handshake with itself over an in-memory net.Pipe (not even localhost TCP) and see what it announces to itself with: https://golang.org/pkg/net/#Pipe + shrug |
I don't think we should commit to the default logic being a simple list of ciphersuites. A nil Config.CipherSuites just means "what the team thinks is best", which might involve custom logic. For example #21144 proposed making version-based decisions. TLS 1.3 might bring logic along, too. About what you are trying to do, crypto/tls is just another user of crypto/cipher, so I think replicating the logic is at least as good as inferring it from the defaults. |
The response to #21144 was "if you don't want 3DES, use your own list of cipher suites that doesn't include it". That's what I'm trying to do here, but in selecting my own cipher suites, I lose the automatic performance-based selection between AES and ChaCha20.
The logic I'm trying to replicate here depends on |
We really dislike exposing guts that we're then locked into maintaining for years and years. If we did, it would be in x/crypto with no stability promises (our typical "this package may change at any time, please vendor it if you use it") and we'd then vendor it into std for releases. |
@bdarnell Exactly :) (Shakes fist at GitHub for not emailing significant edits.) While I agree that duplicating the FWIW, github.com/codahale/aesnicheck already offers you the functionality. |
Partially - Anyway, while the duplication is annoying, it's manageable, and no good API suggests itself (it's not clear what a generic api would look like, and a very specific "is AES faster than ChaCha20 here" API is an awkward thing to commit to in a public interface). So I'm OK with closing this issue unless someone has a better idea. |
OK, based on discussion above, closing. |
I would like to set
tls.Config.CipherSuites
to a non-default value (such as mozilla's "modern" compatibility recommendation), and prioritize either AES-GCM or ChaCha20 depending on whether hardware-accelerated AES is available (i.e. the same logic as in tls/common.go).There is no way that I can see to inspect this default certificate list (it is only used in the non-exported
Config.cipherSuites
method), and thecipherhw
package is internal-only. I could duplicate thecipherhw
package and make theCPUID
assembly call myself (and the analogous instructions for other CPUs), but that allows for version skew between my code andcrypto/tls
: what I want is not "does this CPU have AES support", but "willcrypto/tls
use an accelerated AES implementation on this CPU".It would be nice if
crypto/tls
exposed either some way to inspect its default cipher suite list or to make the same performance-based cipher prioritization decisions as the default implementation.The text was updated successfully, but these errors were encountered: