prf10 implements the TLS 1.0 pseudo-random function, as defined in RFC 2246, Section 5.
(secret []byte, label string, seed []byte, keyLen int)
| 50 | |
| 51 | // prf10 implements the TLS 1.0 pseudo-random function, as defined in RFC 2246, Section 5. |
| 52 | func 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. |
| 74 | func prf12(hashFunc func() hash.Hash) prfFunc { |
nothing calls this directly
no test coverage detected
searching dependent graphs…