Skip to content

crypto/tls: don't overwrite Config.sessionTicketKeys if already set #15421

Description

@mark-kubacki

With Go 1.6.2 and earlier and in tls.Config, serverInit() overwrites effects of a prior SetSessionTicketKeys().

Initializing SessionTicketKey to an arbitrary non-null value does not sort this in case of TLS ticket key rotation: SetSessionTicketKeys() could have already been called several times without being allowed to update that lone field because »after [tls.Config has] been passed to a TLS function it must not be modified«.

I expected serverInit() to:

diff --git a/src/crypto/tls/common.go b/src/crypto/tls/common.go
index c68ebfe..94be97e 100644
--- a/src/crypto/tls/common.go
+++ b/src/crypto/tls/common.go
@@ -388,6 +388,9 @@ func (c *Config) serverInit() {
        if c.SessionTicketsDisabled {
                return
        }
+       if len(c.ticketKeys()) > 0 {
+               return
+       }

        alreadySet := false
        for _, b := range c.SessionTicketKey {

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions