prf12 implements the TLS 1.2 pseudo-random function, as defined in RFC 5246, Section 5.
(hashFunc func() hash.Hash)
| 65 | |
| 66 | // prf12 implements the TLS 1.2 pseudo-random function, as defined in RFC 5246, Section 5. |
| 67 | func prf12(hashFunc func() hash.Hash) func(result, secret, label, seed []byte) { |
| 68 | return func(result, secret, label, seed []byte) { |
| 69 | labelAndSeed := make([]byte, len(label)+len(seed)) |
| 70 | copy(labelAndSeed, label) |
| 71 | copy(labelAndSeed[len(label):], seed) |
| 72 | |
| 73 | pHash(result, secret, labelAndSeed, hashFunc) |
| 74 | } |
| 75 | } |
| 76 | |
| 77 | const ( |
| 78 | masterSecretLength = 48 // Length of a master secret in TLS 1.1. |
no test coverage detected
searching dependent graphs…