Add a helper function to normalize the current version. We have need to normalize other versions during version negotiation, but almost all will be post-negotiation. Hopefully later this can be replaced with a value explicitly stored on the object and we do away with ssl->version. Change-Id: I595db9163d0af2e7c083b9a09310179aaa9ac812 Reviewed-on: https://boringssl-review.googlesource.com/6841 Reviewed-by: Adam Langley <alangley@gmail.com>
diff --git a/ssl/internal.h b/ssl/internal.h index a9f1508..ad76b8c 100644 --- a/ssl/internal.h +++ b/ssl/internal.h
@@ -1272,7 +1272,11 @@ * * TODO(davidben): To normalize some DTLS-specific code, move away from using * the wire version except at API boundaries. */ -uint16_t ssl3_version_from_wire(SSL *ssl, uint16_t wire_version); +uint16_t ssl3_version_from_wire(const SSL *ssl, uint16_t wire_version); + +/* ssl3_protocol_version returns |ssl|'s protocol version. It is an error to + * call this function before the version is determined. */ +uint16_t ssl3_protocol_version(const SSL *ssl); uint32_t ssl_get_algorithm_prf(const SSL *ssl); int tls1_parse_peer_sigalgs(SSL *ssl, const CBS *sigalgs);