0
0
mirror of https://github.com/XTLS/REALITY.git synced 2025-08-22 14:38:35 +00:00

crypto/tls: avoid referencing potentially unused symbols in init

A reference to a function in a "var _ = ..." init-time
initialization keeps the symbol live. Move references to
Config.EncryptTicket and Config.DecryptTicket into tests.
These references increase the size of an unused import of
crypto/tls by about 1MiB.

Change-Id: I6d62a6dcbd73e22972a217afcda7395e909b52cc
Reviewed-on: https://go-review.googlesource.com/c/go/+/498595
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Run-TryBot: Damien Neil <dneil@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
yuhan6665 2023-10-14 09:42:25 -04:00
parent edf00b752d
commit 7e0808395e

View File

@ -301,8 +301,6 @@ func (c *Config) EncryptTicket(cs ConnectionState, ss *SessionState) ([]byte, er
return c.encryptTicket(stateBytes, ticketKeys) return c.encryptTicket(stateBytes, ticketKeys)
} }
var _ = &Config{WrapSession: (&Config{}).EncryptTicket}
func (c *Config) encryptTicket(state []byte, ticketKeys []ticketKey) ([]byte, error) { func (c *Config) encryptTicket(state []byte, ticketKeys []ticketKey) ([]byte, error) {
if len(ticketKeys) == 0 { if len(ticketKeys) == 0 {
return nil, errors.New("tls: internal error: session ticket keys unavailable") return nil, errors.New("tls: internal error: session ticket keys unavailable")
@ -348,8 +346,6 @@ func (c *Config) DecryptTicket(identity []byte, cs ConnectionState) (*SessionSta
return s, nil return s, nil
} }
var _ = &Config{UnwrapSession: (&Config{}).DecryptTicket}
func (c *Config) decryptTicket(encrypted []byte, ticketKeys []ticketKey) []byte { func (c *Config) decryptTicket(encrypted []byte, ticketKeys []ticketKey) []byte {
if len(encrypted) < aes.BlockSize+sha256.Size { if len(encrypted) < aes.BlockSize+sha256.Size {
return nil return nil