Latest update
This commit is contained in:
@@ -989,7 +989,6 @@ static int final_server_name(SSL *s, unsigned int context, int sent)
|
||||
ss->ext.ticklen = 0;
|
||||
ss->ext.tick_lifetime_hint = 0;
|
||||
ss->ext.tick_age_add = 0;
|
||||
ss->ext.tick_identity = 0;
|
||||
if (!ssl_generate_session_id(s, ss)) {
|
||||
SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_FINAL_SERVER_NAME,
|
||||
ERR_R_INTERNAL_ERROR);
|
||||
@@ -1645,7 +1644,6 @@ static int final_early_data(SSL *s, unsigned int context, int sent)
|
||||
|
||||
if (s->max_early_data == 0
|
||||
|| !s->hit
|
||||
|| s->session->ext.tick_identity != 0
|
||||
|| s->early_data_state != SSL_EARLY_DATA_ACCEPTING
|
||||
|| !s->ext.early_data_ok
|
||||
|| s->hello_retry_request != SSL_HRR_NONE
|
||||
|
||||
@@ -996,7 +996,7 @@ EXT_RETURN tls_construct_ctos_psk(SSL *s, WPACKET *pkt, unsigned int context,
|
||||
const EVP_MD *handmd = NULL, *mdres = NULL, *mdpsk = NULL;
|
||||
int dores = 0;
|
||||
|
||||
s->session->ext.tick_identity = TLSEXT_PSK_BAD_IDENTITY;
|
||||
s->ext.tick_identity = 0;
|
||||
|
||||
/*
|
||||
* Note: At this stage of the code we only support adding a single
|
||||
@@ -1086,6 +1086,7 @@ EXT_RETURN tls_construct_ctos_psk(SSL *s, WPACKET *pkt, unsigned int context,
|
||||
agems += s->session->ext.tick_age_add;
|
||||
|
||||
reshashsize = EVP_MD_size(mdres);
|
||||
s->ext.tick_identity++;
|
||||
dores = 1;
|
||||
}
|
||||
|
||||
@@ -1145,6 +1146,7 @@ EXT_RETURN tls_construct_ctos_psk(SSL *s, WPACKET *pkt, unsigned int context,
|
||||
ERR_R_INTERNAL_ERROR);
|
||||
return EXT_RETURN_FAIL;
|
||||
}
|
||||
s->ext.tick_identity++;
|
||||
}
|
||||
|
||||
if (!WPACKET_close(pkt)
|
||||
@@ -1183,11 +1185,6 @@ EXT_RETURN tls_construct_ctos_psk(SSL *s, WPACKET *pkt, unsigned int context,
|
||||
return EXT_RETURN_FAIL;
|
||||
}
|
||||
|
||||
if (dores)
|
||||
s->session->ext.tick_identity = 0;
|
||||
if (s->psksession != NULL)
|
||||
s->psksession->ext.tick_identity = (dores ? 1 : 0);
|
||||
|
||||
return EXT_RETURN_SENT;
|
||||
#else
|
||||
return EXT_RETURN_NOT_SENT;
|
||||
@@ -1932,8 +1929,7 @@ int tls_parse_stoc_early_data(SSL *s, PACKET *pkt, unsigned int context,
|
||||
}
|
||||
|
||||
if (!s->ext.early_data_ok
|
||||
|| !s->hit
|
||||
|| s->session->ext.tick_identity != 0) {
|
||||
|| !s->hit) {
|
||||
/*
|
||||
* If we get here then we didn't send early data, or we didn't resume
|
||||
* using the first identity, or the SNI/ALPN is not consistent so the
|
||||
@@ -1961,17 +1957,28 @@ int tls_parse_stoc_psk(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (s->session->ext.tick_identity == (int)identity) {
|
||||
if (identity >= (unsigned int)s->ext.tick_identity) {
|
||||
SSLfatal(s, SSL_AD_ILLEGAL_PARAMETER, SSL_F_TLS_PARSE_STOC_PSK,
|
||||
SSL_R_BAD_PSK_IDENTITY);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Session resumption tickets are always sent before PSK tickets. If the
|
||||
* ticket index is 0 then it must be for a session resumption ticket if we
|
||||
* sent two tickets, or if we didn't send a PSK ticket.
|
||||
*/
|
||||
if (identity == 0 && (s->psksession == NULL || s->ext.tick_identity == 2)) {
|
||||
s->hit = 1;
|
||||
SSL_SESSION_free(s->psksession);
|
||||
s->psksession = NULL;
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (s->psksession == NULL
|
||||
|| s->psksession->ext.tick_identity != (int)identity) {
|
||||
SSLfatal(s, SSL_AD_ILLEGAL_PARAMETER, SSL_F_TLS_PARSE_STOC_PSK,
|
||||
SSL_R_BAD_PSK_IDENTITY);
|
||||
if (s->psksession == NULL) {
|
||||
/* Should never happen */
|
||||
SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_PARSE_STOC_PSK,
|
||||
ERR_R_INTERNAL_ERROR);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1990,6 +1997,9 @@ int tls_parse_stoc_psk(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
|
||||
s->session = s->psksession;
|
||||
s->psksession = NULL;
|
||||
s->hit = 1;
|
||||
/* Early data is only allowed if we used the first ticket */
|
||||
if (identity != 0)
|
||||
s->ext.early_data_ok = 0;
|
||||
#endif
|
||||
|
||||
return 1;
|
||||
|
||||
@@ -1277,7 +1277,7 @@ int tls_parse_ctos_psk(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
|
||||
goto err;
|
||||
}
|
||||
|
||||
sess->ext.tick_identity = id;
|
||||
s->ext.tick_identity = id;
|
||||
|
||||
SSL_SESSION_free(s->session);
|
||||
s->session = sess;
|
||||
@@ -1951,7 +1951,7 @@ EXT_RETURN tls_construct_stoc_psk(SSL *s, WPACKET *pkt, unsigned int context,
|
||||
|
||||
if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_psk)
|
||||
|| !WPACKET_start_sub_packet_u16(pkt)
|
||||
|| !WPACKET_put_bytes_u16(pkt, s->session->ext.tick_identity)
|
||||
|| !WPACKET_put_bytes_u16(pkt, s->ext.tick_identity)
|
||||
|| !WPACKET_close(pkt)) {
|
||||
SSLfatal(s, SSL_AD_INTERNAL_ERROR,
|
||||
SSL_F_TLS_CONSTRUCT_STOC_PSK, ERR_R_INTERNAL_ERROR);
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include <openssl/dh.h>
|
||||
#include <openssl/bn.h>
|
||||
#include <openssl/engine.h>
|
||||
#include <openssl/trace.h>
|
||||
#include <internal/cryptlib.h>
|
||||
|
||||
static MSG_PROCESS_RETURN tls_process_as_hello_retry_request(SSL *s, PACKET *pkt);
|
||||
@@ -1613,10 +1614,7 @@ MSG_PROCESS_RETURN tls_process_server_hello(SSL *s, PACKET *pkt)
|
||||
* so the PAC-based session secret is always preserved. It'll be
|
||||
* overwritten if the server refuses resumption.
|
||||
*/
|
||||
if (s->session->session_id_length > 0
|
||||
|| (SSL_IS_TLS13(s)
|
||||
&& s->session->ext.tick_identity
|
||||
!= TLSEXT_PSK_BAD_IDENTITY)) {
|
||||
if (s->session->session_id_length > 0) {
|
||||
tsan_counter(&s->session_ctx->stats.sess_miss);
|
||||
if (!ssl_get_new_session(s, 0)) {
|
||||
/* SSLfatal() already called */
|
||||
@@ -2350,11 +2348,9 @@ MSG_PROCESS_RETURN tls_process_key_exchange(SSL *s, PACKET *pkt)
|
||||
ERR_R_INTERNAL_ERROR);
|
||||
goto err;
|
||||
}
|
||||
#ifdef SSL_DEBUG
|
||||
if (SSL_USE_SIGALGS(s))
|
||||
fprintf(stderr, "USING TLSv1.2 HASH %s\n",
|
||||
md == NULL ? "n/a" : EVP_MD_name(md));
|
||||
#endif
|
||||
OSSL_TRACE1(TLS, "USING TLSv1.2 HASH %s\n",
|
||||
md == NULL ? "n/a" : EVP_MD_name(md));
|
||||
|
||||
if (!PACKET_get_length_prefixed_2(pkt, &signature)
|
||||
|| PACKET_remaining(pkt) != 0) {
|
||||
|
||||
+6
-15
@@ -18,6 +18,7 @@
|
||||
#include <openssl/objects.h>
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/x509.h>
|
||||
#include <openssl/trace.h>
|
||||
|
||||
/*
|
||||
* Map error codes to TLS/SSL alart types.
|
||||
@@ -394,11 +395,9 @@ MSG_PROCESS_RETURN tls_process_cert_verify(SSL *s, PACKET *pkt)
|
||||
goto err;
|
||||
}
|
||||
|
||||
#ifdef SSL_DEBUG
|
||||
if (SSL_USE_SIGALGS(s))
|
||||
fprintf(stderr, "USING TLSv1.2 HASH %s\n",
|
||||
md == NULL ? "n/a" : EVP_MD_name(md));
|
||||
#endif
|
||||
OSSL_TRACE1(TLS, "USING TLSv1.2 HASH %s\n",
|
||||
md == NULL ? "n/a" : EVP_MD_name(md));
|
||||
|
||||
/* Check for broken implementations of GOST ciphersuites */
|
||||
/*
|
||||
@@ -439,10 +438,9 @@ MSG_PROCESS_RETURN tls_process_cert_verify(SSL *s, PACKET *pkt)
|
||||
goto err;
|
||||
}
|
||||
|
||||
#ifdef SSL_DEBUG
|
||||
fprintf(stderr, "Using client verify alg %s\n",
|
||||
md == NULL ? "n/a" : EVP_MD_name(md));
|
||||
#endif
|
||||
OSSL_TRACE1(TLS, "Using client verify alg %s\n",
|
||||
md == NULL ? "n/a" : EVP_MD_name(md));
|
||||
|
||||
if (EVP_DigestVerifyInit(mctx, &pctx, md, NULL, pkey) <= 0) {
|
||||
SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_PROCESS_CERT_VERIFY,
|
||||
ERR_R_EVP_LIB);
|
||||
@@ -614,13 +612,6 @@ MSG_PROCESS_RETURN tls_process_key_update(SSL *s, PACKET *pkt)
|
||||
{
|
||||
unsigned int updatetype;
|
||||
|
||||
s->key_update_count++;
|
||||
if (s->key_update_count > MAX_KEY_UPDATE_MESSAGES) {
|
||||
SSLfatal(s, SSL_AD_ILLEGAL_PARAMETER, SSL_F_TLS_PROCESS_KEY_UPDATE,
|
||||
SSL_R_TOO_MANY_KEY_UPDATES);
|
||||
return MSG_PROCESS_ERROR;
|
||||
}
|
||||
|
||||
/*
|
||||
* A KeyUpdate message signals a key change so the end of the message must
|
||||
* be on a record boundary.
|
||||
|
||||
@@ -29,9 +29,6 @@
|
||||
/* Max should actually be 36 but we are generous */
|
||||
#define FINISHED_MAX_LENGTH 64
|
||||
|
||||
/* The maximum number of incoming KeyUpdate messages we will accept */
|
||||
#define MAX_KEY_UPDATE_MESSAGES 32
|
||||
|
||||
/* Dummy message type */
|
||||
#define SSL3_MT_DUMMY -1
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include <openssl/dh.h>
|
||||
#include <openssl/bn.h>
|
||||
#include <openssl/md5.h>
|
||||
#include <openssl/trace.h>
|
||||
|
||||
#define TICKET_NONCE_SIZE 8
|
||||
|
||||
@@ -1835,15 +1836,15 @@ static int tls_early_post_process_client_hello(SSL *s)
|
||||
j = 0;
|
||||
id = s->session->cipher->id;
|
||||
|
||||
#ifdef CIPHER_DEBUG
|
||||
fprintf(stderr, "client sent %d ciphers\n", sk_SSL_CIPHER_num(ciphers));
|
||||
#endif
|
||||
OSSL_TRACE_BEGIN(TLS_CIPHER) {
|
||||
BIO_printf(trc_out, "client sent %d ciphers\n",
|
||||
sk_SSL_CIPHER_num(ciphers));
|
||||
}
|
||||
for (i = 0; i < sk_SSL_CIPHER_num(ciphers); i++) {
|
||||
c = sk_SSL_CIPHER_value(ciphers, i);
|
||||
#ifdef CIPHER_DEBUG
|
||||
fprintf(stderr, "client [%2d of %2d]:%s\n",
|
||||
i, sk_SSL_CIPHER_num(ciphers), SSL_CIPHER_get_name(c));
|
||||
#endif
|
||||
if (trc_out != NULL)
|
||||
BIO_printf(trc_out, "client [%2d of %2d]:%s\n", i,
|
||||
sk_SSL_CIPHER_num(ciphers), SSL_CIPHER_get_name(c));
|
||||
if (c->id == id) {
|
||||
j = 1;
|
||||
break;
|
||||
@@ -1857,8 +1858,10 @@ static int tls_early_post_process_client_hello(SSL *s)
|
||||
SSLfatal(s, SSL_AD_ILLEGAL_PARAMETER,
|
||||
SSL_F_TLS_EARLY_POST_PROCESS_CLIENT_HELLO,
|
||||
SSL_R_REQUIRED_CIPHER_MISSING);
|
||||
OSSL_TRACE_CANCEL(TLS_CIPHER);
|
||||
goto err;
|
||||
}
|
||||
OSSL_TRACE_END(TLS_CIPHER);
|
||||
}
|
||||
|
||||
for (loop = 0; loop < clienthello->compressions_len; loop++) {
|
||||
|
||||
Reference in New Issue
Block a user