-/* $OpenBSD: tlsexttest.c,v 1.45 2020/10/11 02:45:49 tb Exp $ */
+/* $OpenBSD: tlsexttest.c,v 1.46 2021/03/10 18:28:01 jsing Exp $ */
/*
* Copyright (c) 2017 Joel Sing <jsing@openbsd.org>
* Copyright (c) 2017 Doug Hogan <doug@openbsd.org>
if ((ssl = SSL_new(ssl_ctx)) == NULL)
errx(1, "failed to create SSL");
- ssl->client_version = TLS1_1_VERSION;
+ S3I(ssl)->hs.our_max_tls_version = TLS1_1_VERSION;
if (tlsext_sigalgs_client_needs(ssl, SSL_TLSEXT_MSG_CH)) {
fprintf(stderr, "FAIL: client should not need sigalgs\n");
goto done;
}
- ssl->client_version = TLS1_2_VERSION;
+ S3I(ssl)->hs.our_max_tls_version = TLS1_2_VERSION;
if (!tlsext_sigalgs_client_needs(ssl, SSL_TLSEXT_MSG_CH)) {
fprintf(stderr, "FAIL: client should need sigalgs\n");
if ((ssl = SSL_new(ssl_ctx)) == NULL)
errx(1, "failed to create SSL");
+ S3I(ssl)->hs.our_min_tls_version = TLS1_VERSION;
+ S3I(ssl)->hs.our_max_tls_version = TLS1_2_VERSION;
+
if (!tlsext_client_build(ssl, SSL_TLSEXT_MSG_CH, &cbb)) {
FAIL("failed to build clienthello extensions\n");
goto err;
CBB_init(&cbb, 0);
/* Switch to TLSv1.1, disable EC ciphers and session tickets. */
- ssl->client_version = TLS1_1_VERSION;
+ S3I(ssl)->hs.our_max_tls_version = TLS1_1_VERSION;
if (!SSL_set_cipher_list(ssl, "TLSv1.2:!ECDHE:!ECDSA")) {
FAIL("failed to set cipher list\n");
goto err;
if ((ssl->session = SSL_SESSION_new()) == NULL)
errx(1, "failed to create session");
+ S3I(ssl)->hs.our_max_tls_version = TLS1_3_VERSION;
+ S3I(ssl)->hs.negotiated_tls_version = TLS1_3_VERSION;
S3I(ssl)->hs.new_cipher =
ssl3_get_cipher_by_id(TLS1_CK_RSA_WITH_AES_128_SHA256);
if ((ssl = SSL_new(ssl_ctx)) == NULL)
errx(1, "failed to create SSL");
- S3I(ssl)->hs_tls13.max_version = 0;
+ S3I(ssl)->hs.our_max_tls_version = TLS1_1_VERSION;
if (tlsext_versions_client_needs(ssl, SSL_TLSEXT_MSG_CH)) {
FAIL("client should not need versions\n");
goto done;
}
- S3I(ssl)->hs_tls13.max_version = TLS1_2_VERSION;
+ S3I(ssl)->hs.our_max_tls_version = TLS1_2_VERSION;
if (tlsext_versions_client_needs(ssl, SSL_TLSEXT_MSG_CH)) {
FAIL("client should not need versions\n");
goto done;
}
- S3I(ssl)->hs_tls13.max_version = TLS1_3_VERSION;
+ S3I(ssl)->hs.our_max_tls_version = TLS1_3_VERSION;
if (!tlsext_versions_client_needs(ssl, SSL_TLSEXT_MSG_CH)) {
FAIL("client should need versions\n");
goto done;
}
- S3I(ssl)->hs_tls13.max_version = TLS1_3_VERSION;
- S3I(ssl)->hs_tls13.min_version = 0;
- if (tlsext_versions_client_build(ssl, SSL_TLSEXT_MSG_CH, &cbb)) {
- FAIL("client should not have built versions\n");
- failure = 1;
- goto done;
- }
+ S3I(ssl)->hs.our_min_tls_version = TLS1_VERSION;
+ S3I(ssl)->hs.our_max_tls_version = TLS1_3_VERSION;
- S3I(ssl)->hs_tls13.max_version = TLS1_3_VERSION;
- S3I(ssl)->hs_tls13.min_version = TLS1_VERSION;
if (!tlsext_versions_client_build(ssl, SSL_TLSEXT_MSG_CH, &cbb)) {
FAIL("client should have built versions\n");
failure = 1;
if ((ssl = SSL_new(ssl_ctx)) == NULL)
errx(1, "failed to create SSL");
- ssl->version = TLS1_2_VERSION;
+ S3I(ssl)->hs.negotiated_tls_version = TLS1_2_VERSION;
if (tlsext_versions_server_needs(ssl, SSL_TLSEXT_MSG_SH)) {
FAIL("server should not need versions\n");
goto done;
}
- ssl->version = TLS1_3_VERSION;
+ S3I(ssl)->hs.negotiated_tls_version = TLS1_3_VERSION;
if (!tlsext_versions_server_needs(ssl, SSL_TLSEXT_MSG_SH)) {
FAIL("server should need versions\n");
if (!tls13_key_share_generate(S3I(ssl)->hs_tls13.key_share))
errx(1, "failed to generate key share");
- S3I(ssl)->hs_tls13.max_version = 0;
-
- if (tlsext_keyshare_client_needs(ssl, SSL_TLSEXT_MSG_CH)) {
- FAIL("client should not need keyshare\n");
- failure = 1;
- goto done;
- }
-
- S3I(ssl)->hs_tls13.max_version = TLS1_2_VERSION;
+ S3I(ssl)->hs.our_max_tls_version = TLS1_2_VERSION;
if (tlsext_keyshare_client_needs(ssl, SSL_TLSEXT_MSG_CH)) {
FAIL("client should not need keyshare\n");
failure = 1;
goto done;
}
- S3I(ssl)->hs_tls13.max_version = TLS1_3_VERSION;
+ S3I(ssl)->hs.our_max_tls_version = TLS1_3_VERSION;
if (!tlsext_keyshare_client_needs(ssl, SSL_TLSEXT_MSG_CH)) {
FAIL("client should need keyshare\n");
failure = 1;
goto done;
}
- S3I(ssl)->hs_tls13.max_version = TLS1_3_VERSION;
+ S3I(ssl)->hs.our_max_tls_version = TLS1_3_VERSION;
if (!tlsext_keyshare_client_build(ssl, SSL_TLSEXT_MSG_CH, &cbb)) {
FAIL("client should have built keyshare\n");
failure = 1;
if ((ssl = SSL_new(ssl_ctx)) == NULL)
errx(1, "failed to create SSL");
- (ssl)->version = 0;
+ S3I(ssl)->hs.negotiated_tls_version = TLS1_2_VERSION;
if (tlsext_keyshare_server_needs(ssl, SSL_TLSEXT_MSG_SH)) {
FAIL("server should not need keyshare\n");
failure = 1;
goto done;
}
- (ssl)->version = TLS1_2_VERSION;
- if (tlsext_keyshare_server_needs(ssl, SSL_TLSEXT_MSG_SH)) {
- FAIL("server should not need keyshare\n");
- failure = 1;
- goto done;
- }
-
- ssl->version = TLS1_3_VERSION;
+ S3I(ssl)->hs.negotiated_tls_version = TLS1_3_VERSION;
if (tlsext_keyshare_server_needs(ssl, SSL_TLSEXT_MSG_SH)) {
FAIL("client should not need keyshare\n");
failure = 1;
if ((ssl = SSL_new(ssl_ctx)) == NULL)
errx(1, "failed to create SSL");
- S3I(ssl)->hs_tls13.max_version = 0;
- if (tlsext_cookie_client_needs(ssl, SSL_TLSEXT_MSG_CH)) {
- FAIL("client should not need cookie\n");
- failure = 1;
- goto done;
- }
-
- S3I(ssl)->hs_tls13.max_version = TLS1_2_VERSION;
+ S3I(ssl)->hs.our_max_tls_version = TLS1_2_VERSION;
if (tlsext_cookie_client_needs(ssl, SSL_TLSEXT_MSG_CH)) {
FAIL("client should not need cookie\n");
failure = 1;
}
- S3I(ssl)->hs_tls13.max_version = TLS1_3_VERSION;
+ S3I(ssl)->hs.our_max_tls_version = TLS1_3_VERSION;
if (tlsext_cookie_client_needs(ssl, SSL_TLSEXT_MSG_CH)) {
FAIL("client should not need cookie\n");
failure = 1;
if ((ssl = SSL_new(ssl_ctx)) == NULL)
errx(1, "failed to create SSL");
- S3I(ssl)->hs_tls13.max_version = 0;
+ S3I(ssl)->hs.our_max_tls_version = TLS1_2_VERSION;
if (tlsext_cookie_server_needs(ssl, SSL_TLSEXT_MSG_SH)) {
FAIL("server should not need cookie\n");
failure = 1;
goto done;
}
- S3I(ssl)->hs_tls13.max_version = TLS1_2_VERSION;
- if (tlsext_cookie_server_needs(ssl, SSL_TLSEXT_MSG_SH)) {
- FAIL("server should not need cookie\n");
- failure = 1;
- goto done;
- }
-
-
- S3I(ssl)->hs_tls13.max_version = TLS1_3_VERSION;
+ S3I(ssl)->hs.our_max_tls_version = TLS1_3_VERSION;
if (tlsext_cookie_server_needs(ssl, SSL_TLSEXT_MSG_SH)) {
FAIL("server should not need cookie\n");
failure = 1;