crypto/tls: don't generate random ticket keys if already set.

If SetSessionTicketKeys was called on a fresh tls.Config, the configured
keys would be overridden with a random key by serverInit.

Fixes #15421.

Change-Id: I5d6cc81fc3e5de4dfa15eb614d102fb886150d1b
Reviewed-on: https://go-review.googlesource.com/27317
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Adam Langley 2016-08-17 17:38:06 -07:00
parent 411a026035
commit 2c396d97fb
2 changed files with 15 additions and 4 deletions

View file

@ -450,7 +450,7 @@ func (c *Config) clone() *Config {
}
func (c *Config) serverInit() {
if c.SessionTicketsDisabled {
if c.SessionTicketsDisabled || len(c.ticketKeys()) != 0 {
return
}