File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -64,12 +64,22 @@ func NewClient(conf *Config) (*Client, error) {
6464 return nil , errors .New ("kms: invalid config: 'APIKey' and 'TLS.GetClientCertificate' are present" )
6565 }
6666
67- tlsConf := conf .TLS . Clone ()
67+ tlsConf := conf .TLS
6868 if conf .APIKey != nil {
6969 cert , err := GenerateCertificate (conf .APIKey , nil )
7070 if err != nil {
7171 return nil , err
7272 }
73+
74+ // ensure that the TLS configuration is not nil and
75+ // the TLS configuration is cloned to avoid
76+ // modifying the original TLS configuration.
77+ if tlsConf == nil {
78+ tlsConf = & tls.Config {}
79+ } else {
80+ tlsConf = tlsConf .Clone ()
81+ }
82+
7383 tlsConf .GetClientCertificate = func (* tls.CertificateRequestInfo ) (* tls.Certificate , error ) {
7484 return & cert , nil
7585 }
You can’t perform that action at this time.
0 commit comments