Why does the SSL/TLS handshake have a client and server random?
From The First Few Milliseconds of an HTTPS Connection:
The master secret is a function of the client and server randoms.
master_secret = PRF(pre_master_secret,
"master secret",
ClientHello.random + ServerHello.random)
Both the client and the server need to be able to calculate the master secret. Generating a pre-master secret on the client and just sending that to the server would mean the the client never gets to find out the master secret.
Why not just use the pre-master?
This would mean that the entire key generation routine was based on client generated values. If a Man-In-The-Middle attacker replayed the handshake, the same pre-master secret would be sent and then used for the connection. Having the server generate a random value (ServerHello.random
) will mean that the MAC secret is different if the ClientHello.random
is repeated, and therefore the MAC and encryption keys will be different, preventing any replay attack.