MCPcopy Index your code
hub / github.com/XTLS/Go / prf10

Function prf10

prf.go:48–64  ·  view source on GitHub ↗

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

(result, secret, label, seed []byte)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 2

splitPreMasterSecretFunction · 0.85
pHashFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…