Check versions before trying to send KeyUpdate.

Otherwise we panic. Thanks to EKR for reporting.

Change-Id: Ie4b6c2e18e1c77c7b660ca5d4c3bafb38a82cb6a
Reviewed-on: https://boringssl-review.googlesource.com/11405
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: Adam Langley <agl@google.com>
diff --git a/ssl/test/runner/conn.go b/ssl/test/runner/conn.go
index f532237..1fd0200 100644
--- a/ssl/test/runner/conn.go
+++ b/ssl/test/runner/conn.go
@@ -1345,7 +1345,9 @@
 	}
 
 	if c.config.Bugs.SendKeyUpdateBeforeEveryAppDataRecord {
-		c.sendKeyUpdateLocked()
+		if err := c.sendKeyUpdateLocked(); err != nil {
+			return 0, err
+		}
 	}
 
 	// SSL 3.0 and TLS 1.0 are susceptible to a chosen-plaintext
@@ -1736,6 +1738,10 @@
 }
 
 func (c *Conn) sendKeyUpdateLocked() error {
+	if c.vers < VersionTLS13 {
+		return errors.New("tls: attempted to send KeyUpdate before TLS 1.3")
+	}
+
 	m := new(keyUpdateMsg)
 	if _, err := c.writeRecord(recordTypeHandshake, m.marshal()); err != nil {
 		return err