summaryrefslogtreecommitdiffstats
path: root/ssl/statem/statem_srvr.c
diff options
context:
space:
mode:
Diffstat (limited to 'ssl/statem/statem_srvr.c')
-rw-r--r--ssl/statem/statem_srvr.c74
1 files changed, 37 insertions, 37 deletions
diff --git a/ssl/statem/statem_srvr.c b/ssl/statem/statem_srvr.c
index 5dc1e1dbcc..57927271db 100644
--- a/ssl/statem/statem_srvr.c
+++ b/ssl/statem/statem_srvr.c
@@ -180,7 +180,7 @@ int ossl_statem_server_read_transition(SSL_CONNECTION *s, int mt)
{
OSSL_STATEM *st = &s->statem;
- if (SSL_CONNECTION_IS_TLS13(s) || SSL_CONNECTION_IS_DTLS13(s)) {
+ if (SSL_CONNECTION_IS_VERSION13(s)) {
if (!ossl_statem_server13_read_transition(s, mt))
goto err;
return 1;
@@ -415,7 +415,7 @@ int send_certificate_request(SSL_CONNECTION *s)
* don't request if post-handshake-only unless doing
* post-handshake in TLSv1.3:
*/
- && (!(SSL_CONNECTION_IS_TLS13(s) || SSL_CONNECTION_IS_DTLS13(s))
+ && (!SSL_CONNECTION_IS_VERSION13(s)
|| !(s->verify_mode & SSL_VERIFY_POST_HANDSHAKE)
|| s->post_handshake_auth == SSL_PHA_REQUEST_PENDING)
/*
@@ -609,7 +609,7 @@ WRITE_TRAN ossl_statem_server_write_transition(SSL_CONNECTION *s)
* to negotiate yet, so we don't take this branch until later
*/
- if (SSL_CONNECTION_IS_TLS13(s) || SSL_CONNECTION_IS_DTLS13(s))
+ if (SSL_CONNECTION_IS_VERSION13(s))
return ossl_statem_server13_write_transition(s);
switch (st->hand_state) {
@@ -785,7 +785,7 @@ WORK_STATE ossl_statem_server_pre_work(SSL_CONNECTION *s, WORK_STATE wst)
return WORK_FINISHED_CONTINUE;
case TLS_ST_SW_SESSION_TICKET:
- if ((SSL_CONNECTION_IS_TLS13(s) || SSL_CONNECTION_IS_DTLS13(s)) && s->sent_tickets == 0
+ if (SSL_CONNECTION_IS_VERSION13(s) && s->sent_tickets == 0
&& s->ext.extra_tickets_expected == 0) {
/*
* Actually this is the end of the handshake, but we're going
@@ -806,7 +806,7 @@ WORK_STATE ossl_statem_server_pre_work(SSL_CONNECTION *s, WORK_STATE wst)
break;
case TLS_ST_SW_CHANGE:
- if (SSL_CONNECTION_IS_TLS13(s) || SSL_CONNECTION_IS_DTLS13(s))
+ if (SSL_CONNECTION_IS_VERSION13(s))
break;
/* Writes to s->session are only safe for initial handshakes */
if (s->session->cipher == NULL) {
@@ -905,7 +905,7 @@ WORK_STATE ossl_statem_server_post_work(SSL_CONNECTION *s, WORK_STATE wst)
break;
case TLS_ST_SW_SRVR_HELLO:
- if ((SSL_CONNECTION_IS_TLS13(s) || SSL_CONNECTION_IS_DTLS13(s))
+ if (SSL_CONNECTION_IS_VERSION13(s)
&& s->hello_retry_request == SSL_HRR_PENDING) {
if ((s->options & SSL_OP_ENABLE_MIDDLEBOX_COMPAT) == 0
&& statem_flush(s) != 1)
@@ -942,7 +942,7 @@ WORK_STATE ossl_statem_server_post_work(SSL_CONNECTION *s, WORK_STATE wst)
sizeof(sctpauthkey), sctpauthkey);
}
#endif
- if (!(SSL_CONNECTION_IS_TLS13(s) || SSL_CONNECTION_IS_DTLS13(s))
+ if (!SSL_CONNECTION_IS_VERSION13(s)
|| ((s->options & SSL_OP_ENABLE_MIDDLEBOX_COMPAT) != 0
&& s->hello_retry_request != SSL_HRR_COMPLETE))
break;
@@ -955,7 +955,7 @@ WORK_STATE ossl_statem_server_post_work(SSL_CONNECTION *s, WORK_STATE wst)
break;
}
- if (SSL_CONNECTION_IS_TLS13(s) || SSL_CONNECTION_IS_DTLS13(s)) {
+ if (SSL_CONNECTION_IS_VERSION13(s)) {
if (!ssl->method->ssl3_enc->setup_key_block(s)
|| !ssl->method->ssl3_enc->change_cipher_state(s,
SSL3_CC_HANDSHAKE | SSL3_CHANGE_CIPHER_SERVER_WRITE)) {
@@ -1014,7 +1014,7 @@ WORK_STATE ossl_statem_server_post_work(SSL_CONNECTION *s, WORK_STATE wst)
0, NULL);
}
#endif
- if (SSL_CONNECTION_IS_TLS13(s) || SSL_CONNECTION_IS_DTLS13(s)) {
+ if (SSL_CONNECTION_IS_VERSION13(s)) {
/* (D)TLS 1.3 gets the secret size from the handshake md */
size_t dummy;
if (!ssl->method->ssl3_enc->generate_master_secret(s,
@@ -1032,7 +1032,7 @@ WORK_STATE ossl_statem_server_post_work(SSL_CONNECTION *s, WORK_STATE wst)
if (statem_flush(s) != 1)
return WORK_MORE_A;
} else {
- if (!(SSL_CONNECTION_IS_TLS13(s) || SSL_CONNECTION_IS_DTLS13(s))
+ if (!SSL_CONNECTION_IS_VERSION13(s)
|| (s->options & SSL_OP_NO_TX_CERTIFICATE_COMPRESSION) != 0)
s->ext.compress_certificate_from_peer[0] = TLSEXT_comp_cert_none;
}
@@ -1040,7 +1040,7 @@ WORK_STATE ossl_statem_server_post_work(SSL_CONNECTION *s, WORK_STATE wst)
case TLS_ST_SW_ENCRYPTED_EXTENSIONS:
if (!s->hit && !send_certificate_request(s)) {
- if (!(SSL_CONNECTION_IS_TLS13(s) || SSL_CONNECTION_IS_DTLS13(s))
+ if (!SSL_CONNECTION_IS_VERSION13(s)
|| (s->options & SSL_OP_NO_TX_CERTIFICATE_COMPRESSION) != 0)
s->ext.compress_certificate_from_peer[0] = TLSEXT_comp_cert_none;
}
@@ -1057,7 +1057,7 @@ WORK_STATE ossl_statem_server_post_work(SSL_CONNECTION *s, WORK_STATE wst)
case TLS_ST_SW_SESSION_TICKET:
clear_sys_error();
- if ((SSL_CONNECTION_IS_TLS13(s) || SSL_CONNECTION_IS_DTLS13(s)) && statem_flush(s) != 1) {
+ if (SSL_CONNECTION_IS_VERSION13(s) && statem_flush(s) != 1) {
if (SSL_get_error(ssl, 0) == SSL_ERROR_SYSCALL
&& conn_is_closed()) {
/*
@@ -1474,7 +1474,7 @@ MSG_PROCESS_RETURN tls_process_client_hello(SSL_CONNECTION *s, PACKET *pkt)
/* Check if this is actually an unexpected renegotiation ClientHello */
if (s->renegotiate == 0 && !SSL_IS_FIRST_HANDSHAKE(s)) {
- if (!ossl_assert(!(SSL_CONNECTION_IS_TLS13(s) || SSL_CONNECTION_IS_DTLS13(s)))) {
+ if (!ossl_assert(!SSL_CONNECTION_IS_VERSION13(s))) {
SSLfatal(s, SSL_AD_INTERNAL_ERROR, ERR_R_INTERNAL_ERROR);
goto err;
}
@@ -1745,7 +1745,7 @@ static int tls_early_post_process_client_hello(SSL_CONNECTION *s)
}
/* TLSv1.3 specifies that a ClientHello must end on a record boundary */
- if ((SSL_CONNECTION_IS_TLS13(s) || SSL_CONNECTION_IS_DTLS13(s))
+ if (SSL_CONNECTION_IS_VERSION13(s)
&& RECORD_LAYER_processed_read_pending(&s->rlayer)) {
SSLfatal(s, SSL_AD_UNEXPECTED_MESSAGE, SSL_R_NOT_ON_RECORD_BOUNDARY);
goto err;
@@ -1813,7 +1813,7 @@ static int tls_early_post_process_client_hello(SSL_CONNECTION *s)
}
/* For TLSv1.3 we must select the ciphersuite *before* session resumption */
- if ((SSL_CONNECTION_IS_TLS13(s) || SSL_CONNECTION_IS_DTLS13(s))) {
+ if (SSL_CONNECTION_IS_VERSION13(s)) {
const SSL_CIPHER *cipher =
ssl3_choose_cipher(s, ciphers, SSL_get_ciphers(ssl));
@@ -1882,7 +1882,7 @@ static int tls_early_post_process_client_hello(SSL_CONNECTION *s)
}
}
- if ((SSL_CONNECTION_IS_TLS13(s) || SSL_CONNECTION_IS_DTLS13(s))) {
+ if (SSL_CONNECTION_IS_VERSION13(s)) {
memcpy(s->tmp_session_id, s->clienthello->session_id,
s->clienthello->session_id_len);
s->tmp_session_id_len = s->clienthello->session_id_len;
@@ -1892,7 +1892,7 @@ static int tls_early_post_process_client_hello(SSL_CONNECTION *s)
* If it is a hit, check that the cipher is in the list. In TLSv1.3 we check
* ciphersuite compatibility with the session as part of resumption.
*/
- if (!(SSL_CONNECTION_IS_TLS13(s) || SSL_CONNECTION_IS_DTLS13(s)) && s->hit) {
+ if (!SSL_CONNECTION_IS_VERSION13(s) && s->hit) {
j = 0;
id = s->session->cipher->id;
@@ -1961,7 +1961,7 @@ static int tls_early_post_process_client_hello(SSL_CONNECTION *s)
if (!s->hit
&& ssl_version_cmp(s, s->version, SSL_CONNECTION_IS_DTLS(s) ? DTLS1_VERSION : TLS1_VERSION) >= 0
- && !(SSL_CONNECTION_IS_TLS13(s) || SSL_CONNECTION_IS_DTLS13(s))
+ && !SSL_CONNECTION_IS_VERSION13(s)
&& s->ext.session_secret_cb != NULL) {
const SSL_CIPHER *pref_cipher = NULL;
/*
@@ -2006,7 +2006,7 @@ static int tls_early_post_process_client_hello(SSL_CONNECTION *s)
* algorithms from the client, starting at q.
*/
s->s3.tmp.new_compression = NULL;
- if ((SSL_CONNECTION_IS_TLS13(s) || SSL_CONNECTION_IS_DTLS13(s))) {
+ if (SSL_CONNECTION_IS_VERSION13(s)) {
/*
* We already checked above that the NULL compression method appears in
* the list. Now we check there aren't any others (which is illegal in
@@ -2093,7 +2093,7 @@ static int tls_early_post_process_client_hello(SSL_CONNECTION *s)
* Given s->peer_ciphers and SSL_get_ciphers, we must pick a cipher
*/
- if (!s->hit || (SSL_CONNECTION_IS_TLS13(s) || SSL_CONNECTION_IS_DTLS13(s))) {
+ if (!s->hit || SSL_CONNECTION_IS_VERSION13(s)) {
sk_SSL_CIPHER_free(s->peer_ciphers);
s->peer_ciphers = ciphers;
if (ciphers == NULL) {
@@ -2280,7 +2280,7 @@ WORK_STATE tls_post_process_client_hello(SSL_CONNECTION *s, WORK_STATE wst)
wst = WORK_MORE_B;
}
if (wst == WORK_MORE_B) {
- if (!s->hit || (SSL_CONNECTION_IS_TLS13(s) || SSL_CONNECTION_IS_DTLS13(s))) {
+ if (!s->hit || SSL_CONNECTION_IS_VERSION13(s)) {
/* Let cert callback update server certificates if required */
if (!s->hit && s->cert->cert_cb != NULL) {
int rv = s->cert->cert_cb(ssl, s->cert->cert_cb_arg);
@@ -2296,7 +2296,7 @@ WORK_STATE tls_post_process_client_hello(SSL_CONNECTION *s, WORK_STATE wst)
}
/* In TLSv1.3 we selected the ciphersuite before resumption */
- if (!(SSL_CONNECTION_IS_TLS13(s) || SSL_CONNECTION_IS_DTLS13(s))) {
+ if (!SSL_CONNECTION_IS_VERSION13(s)) {
cipher =
ssl3_choose_cipher(s, s->peer_ciphers,
SSL_get_ciphers(ssl));
@@ -2354,7 +2354,7 @@ WORK_STATE tls_post_process_client_hello(SSL_CONNECTION *s, WORK_STATE wst)
* we already did this because cipher negotiation happens earlier, and
* we must handle ALPN before we decide whether to accept early_data.
*/
- if (!(SSL_CONNECTION_IS_TLS13(s) || SSL_CONNECTION_IS_DTLS13(s)) && !tls_handle_alpn(s)) {
+ if (!SSL_CONNECTION_IS_VERSION13(s) && !tls_handle_alpn(s)) {
/* SSLfatal() already called */
goto err;
}
@@ -2471,7 +2471,7 @@ CON_FUNC_RETURN tls_construct_server_hello(SSL_CONNECTION *s, WPACKET *pkt)
if (!tls_construct_extensions(s, pkt,
s->hello_retry_request == SSL_HRR_PENDING
? SSL_EXT_TLS1_3_HELLO_RETRY_REQUEST
- : ((SSL_CONNECTION_IS_TLS13(s) || SSL_CONNECTION_IS_DTLS13(s))
+ : (SSL_CONNECTION_IS_VERSION13(s)
? SSL_EXT_TLS1_3_SERVER_HELLO
: SSL_EXT_TLS1_2_SERVER_HELLO),
NULL, 0)) {
@@ -2827,7 +2827,7 @@ CON_FUNC_RETURN tls_construct_server_key_exchange(SSL_CONNECTION *s,
CON_FUNC_RETURN tls_construct_certificate_request(SSL_CONNECTION *s,
WPACKET *pkt)
{
- if (SSL_CONNECTION_IS_TLS13(s) || SSL_CONNECTION_IS_DTLS13(s)) {
+ if (SSL_CONNECTION_IS_VERSION13(s)) {
/* Send random context when doing post-handshake auth */
if (s->post_handshake_auth == SSL_PHA_REQUEST_PENDING) {
OPENSSL_free(s->pha_context);
@@ -3573,7 +3573,7 @@ MSG_PROCESS_RETURN tls_process_client_rpk(SSL_CONNECTION *sc, PACKET *pkt)
* Freeze the handshake buffer. For <TLS1.3 we do this after the CKE
* message
*/
- if (SSL_CONNECTION_IS_TLS13(sc) || SSL_CONNECTION_IS_DTLS13(sc)) {
+ if (SSL_CONNECTION_IS_VERSION13(sc)) {
if (!ssl3_digest_cached_records(sc, 1)) {
/* SSLfatal() already called */
goto err;
@@ -3633,7 +3633,7 @@ MSG_PROCESS_RETURN tls_process_client_certificate(SSL_CONNECTION *s,
goto err;
}
- if ((SSL_CONNECTION_IS_TLS13(s) || SSL_CONNECTION_IS_DTLS13(s))
+ if (SSL_CONNECTION_IS_VERSION13(s)
&& (!PACKET_get_length_prefixed_1(pkt, &context)
|| (s->pha_context == NULL && PACKET_remaining(&context) != 0)
|| (s->pha_context != NULL
@@ -3672,7 +3672,7 @@ MSG_PROCESS_RETURN tls_process_client_certificate(SSL_CONNECTION *s,
goto err;
}
- if (SSL_CONNECTION_IS_TLS13(s) || SSL_CONNECTION_IS_DTLS13(s)) {
+ if (SSL_CONNECTION_IS_VERSION13(s)) {
RAW_EXTENSION *rawexts = NULL;
PACKET extensions;
@@ -3767,7 +3767,7 @@ MSG_PROCESS_RETURN tls_process_client_certificate(SSL_CONNECTION *s,
* Freeze the handshake buffer. For <TLS1.3 we do this after the CKE
* message
*/
- if ((SSL_CONNECTION_IS_TLS13(s) || SSL_CONNECTION_IS_DTLS13(s)) && !ssl3_digest_cached_records(s, 1)) {
+ if (SSL_CONNECTION_IS_VERSION13(s) && !ssl3_digest_cached_records(s, 1)) {
/* SSLfatal() already called */
goto err;
}
@@ -3778,7 +3778,7 @@ MSG_PROCESS_RETURN tls_process_client_certificate(SSL_CONNECTION *s,
*/
/* Save the current hash state for when we receive the CertificateVerify */
- if (SSL_CONNECTION_IS_TLS13(s) || SSL_CONNECTION_IS_DTLS13(s)) {
+ if (SSL_CONNECTION_IS_VERSION13(s)) {
if (!ssl_handshake_hash(s, s->cert_verify_hash,
sizeof(s->cert_verify_hash),
&s->cert_verify_hash_len)) {
@@ -3826,7 +3826,7 @@ CON_FUNC_RETURN tls_construct_server_certificate(SSL_CONNECTION *s, WPACKET *pkt
* In TLSv1.3 the certificate chain is always preceded by a 0 length context
* for the server Certificate message
*/
- if ((SSL_CONNECTION_IS_TLS13(s) || SSL_CONNECTION_IS_DTLS13(s)) && !WPACKET_put_bytes_u8(pkt, 0)) {
+ if (SSL_CONNECTION_IS_VERSION13(s) && !WPACKET_put_bytes_u8(pkt, 0)) {
SSLfatal(s, SSL_AD_INTERNAL_ERROR, ERR_R_INTERNAL_ERROR);
return CON_FUNC_ERROR;
}
@@ -3891,7 +3891,7 @@ static int create_ticket_prequel(SSL_CONNECTION *s, WPACKET *pkt,
*/
#define ONE_WEEK_SEC (7 * 24 * 60 * 60)
- if (SSL_CONNECTION_IS_TLS13(s) || SSL_CONNECTION_IS_DTLS13(s)) {
+ if (SSL_CONNECTION_IS_VERSION13(s)) {
if (ossl_time_compare(s->session->timeout,
ossl_seconds2time(ONE_WEEK_SEC)) > 0)
timeout = ONE_WEEK_SEC;
@@ -3903,7 +3903,7 @@ static int create_ticket_prequel(SSL_CONNECTION *s, WPACKET *pkt,
return 0;
}
- if (SSL_CONNECTION_IS_TLS13(s) || SSL_CONNECTION_IS_DTLS13(s)) {
+ if (SSL_CONNECTION_IS_VERSION13(s)) {
if (!WPACKET_put_bytes_u32(pkt, age_add)
|| !WPACKET_sub_memcpy_u8(pkt, tick_nonce, TICKET_NONCE_SIZE)) {
SSLfatal(s, SSL_AD_INTERNAL_ERROR, ERR_R_INTERNAL_ERROR);
@@ -4030,7 +4030,7 @@ static CON_FUNC_RETURN construct_stateless_ticket(SSL_CONNECTION *s,
* length ticket is not allowed so we abort construction of the
* ticket
*/
- if (SSL_CONNECTION_IS_TLS13(s) || SSL_CONNECTION_IS_DTLS13(s)) {
+ if (SSL_CONNECTION_IS_VERSION13(s)) {
ok = CON_FUNC_DONT_SEND;
goto err;
}
@@ -4173,7 +4173,7 @@ CON_FUNC_RETURN tls_construct_new_session_ticket(SSL_CONNECTION *s, WPACKET *pkt
age_add_u.age_add = 0;
- if (SSL_CONNECTION_IS_TLS13(s) || SSL_CONNECTION_IS_DTLS13(s)) {
+ if (SSL_CONNECTION_IS_VERSION13(s)) {
size_t i, hashlen;
uint64_t nonce;
static const unsigned char nonce_label[] = "resumption";
@@ -4260,7 +4260,7 @@ CON_FUNC_RETURN tls_construct_new_session_ticket(SSL_CONNECTION *s, WPACKET *pkt
* SSL_OP_NO_TICKET is set - we are caching tickets anyway so there
* is no point in using full stateless tickets.
*/
- if ((SSL_CONNECTION_IS_TLS13(s) || SSL_CONNECTION_IS_DTLS13(s))
+ if (SSL_CONNECTION_IS_VERSION13(s)
&& ((s->options & SSL_OP_NO_TICKET) != 0
|| (s->max_early_data > 0
&& (s->options & SSL_OP_NO_ANTI_REPLAY) == 0))) {
@@ -4285,7 +4285,7 @@ CON_FUNC_RETURN tls_construct_new_session_ticket(SSL_CONNECTION *s, WPACKET *pkt
}
}
- if (SSL_CONNECTION_IS_TLS13(s) || SSL_CONNECTION_IS_DTLS13(s)) {
+ if (SSL_CONNECTION_IS_VERSION13(s)) {
if (!tls_construct_extensions(s, pkt,
SSL_EXT_TLS1_3_NEW_SESSION_TICKET,
NULL, 0)) {