Validate ProtocolVersion and CipherSuite

Also fix a memory overflow in P_hash