int max_proto_version;
size_t max_cert_list;
int first_packet;
- /* what was passed, used for SSLv3/TLS rollback check */
+ /*
+ * What was passed in ClientHello.legacy_version. Used for RSA pre-master
+ * secret and SSLv3/TLS (<=1.2) rollback check
+ */
int client_version;
/*
* If we're using more than one pipeline how should we divide the data
SSL_COMP *comp;
#endif
SSL_SESSION *sess = s->session;
- int client_version;
if (!WPACKET_set_max_size(pkt, SSL3_RT_MAX_PLAIN_LENGTH)) {
/* Should not happen */
* For TLS 1.3 we always set the ClientHello version to 1.2 and rely on the
* supported_versions extension for the real supported versions.
*/
- client_version = SSL_IS_TLS13(s) ? TLS1_2_VERSION : s->client_version;
- if (!WPACKET_put_bytes_u16(pkt, client_version)
+ if (!WPACKET_put_bytes_u16(pkt, s->client_version)
|| !WPACKET_memcpy(pkt, s->s3->client_random, SSL3_RANDOM_SIZE)) {
SSLerr(SSL_F_TLS_CONSTRUCT_CLIENT_HELLO, ERR_R_INTERNAL_ERROR);
return 0;
* wheter to ignore versions <TLS1.2 in supported_versions. At the
* moment we honour them if present. To be reviewed later
*/
- if ((int)candidate_vers > s->client_version)
- s->client_version = candidate_vers;
if (version_cmp(s, candidate_vers, best_vers) <= 0)
continue;
for (vent = table;
/*
* ssl_set_client_hello_version - Work out what version we should be using for
- * the initial ClientHello.
+ * the initial ClientHello.legacy_version field.
*
* @s: client SSL handle.
*
if (ret != 0)
return ret;
- s->client_version = s->version = ver_max;
+ s->version = ver_max;
+
+ /* TLS1.3 always uses TLS1.2 in the legacy_version field */
+ if (!SSL_IS_DTLS(s) && ver_max > TLS1_2_VERSION)
+ ver_max = TLS1_2_VERSION;
+
+ s->client_version = ver_max;
return 0;
}