mirror of
https://github.com/refraction-networking/utls.git
synced 2025-04-01 19:17:36 +03:00
26 lines
563 B
Go
26 lines
563 B
Go
package tls13
|
|
|
|
import fips140 "hash"
|
|
|
|
func NewEarlySecretFromSecret[H fips140.Hash](hash func() H, secret []byte) *EarlySecret {
|
|
return &EarlySecret{
|
|
secret: secret,
|
|
hash: func() fips140.Hash { return hash() },
|
|
}
|
|
}
|
|
|
|
func (s *EarlySecret) Secret() []byte {
|
|
if s != nil {
|
|
return s.secret
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func NewMasterSecretFromSecret[H fips140.Hash](hash func() H, secret []byte) *MasterSecret {
|
|
return &MasterSecret{
|
|
secret: secret,
|
|
hash: func() fips140.Hash { return hash() },
|
|
}
|
|
}
|
|
|
|
func (s *MasterSecret) Secret() []byte { return s.secret }
|