MCPcopy
hub / github.com/XTLS/REALITY / prf10

Function prf10

prf.go:52–71  ·  view source on GitHub ↗

prf10 implements the TLS 1.0 pseudo-random function, as defined in RFC 2246, Section 5.

(secret []byte, label string, seed []byte, keyLen int)

Source from the content-addressed store, hash-verified

50
51// prf10 implements the TLS 1.0 pseudo-random function, as defined in RFC 2246, Section 5.
52func prf10(secret []byte, label string, seed []byte, keyLen int) []byte {
53 result := make([]byte, keyLen)
54 hashSHA1 := sha1.New
55 hashMD5 := md5.New
56
57 labelAndSeed := make([]byte, len(label)+len(seed))
58 copy(labelAndSeed, label)
59 copy(labelAndSeed[len(label):], seed)
60
61 s1, s2 := splitPreMasterSecret(secret)
62 pHash(result, s1, labelAndSeed, hashMD5)
63 result2 := make([]byte, len(result))
64 pHash(result2, s2, labelAndSeed, hashSHA1)
65
66 for i, b := range result2 {
67 result[i] ^= b
68 }
69
70 return result
71}
72
73// prf12 implements the TLS 1.2 pseudo-random function, as defined in RFC 5246, Section 5.
74func prf12(hashFunc func() hash.Hash) prfFunc {

Callers

nothing calls this directly

Calls 2

splitPreMasterSecretFunction · 0.85
pHashFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…