Latest update - pre9
This commit is contained in:
@@ -816,8 +816,8 @@ int do_ssl3_write(SSL *s, int type, const unsigned char *buf,
|
||||
/* Clear our SSL3_RECORD structures */
|
||||
memset(wr, 0, sizeof(wr));
|
||||
for (j = 0; j < numpipes; j++) {
|
||||
unsigned int version = SSL_TREAT_AS_TLS13(s) ? TLS1_2_VERSION
|
||||
: s->version;
|
||||
unsigned int version = (s->version == TLS1_3_VERSION) ? TLS1_2_VERSION
|
||||
: s->version;
|
||||
unsigned char *compressdata = NULL;
|
||||
size_t maxcomplen;
|
||||
unsigned int rectype;
|
||||
@@ -829,7 +829,10 @@ int do_ssl3_write(SSL *s, int type, const unsigned char *buf,
|
||||
* In TLSv1.3, once encrypting, we always use application data for the
|
||||
* record type
|
||||
*/
|
||||
if (SSL_TREAT_AS_TLS13(s) && s->enc_write_ctx != NULL)
|
||||
if (SSL_TREAT_AS_TLS13(s)
|
||||
&& s->enc_write_ctx != NULL
|
||||
&& (s->statem.enc_write_state != ENC_WRITE_STATE_WRITE_PLAIN_ALERTS
|
||||
|| type != SSL3_RT_ALERT))
|
||||
rectype = SSL3_RT_APPLICATION_DATA;
|
||||
else
|
||||
rectype = type;
|
||||
@@ -892,7 +895,10 @@ int do_ssl3_write(SSL *s, int type, const unsigned char *buf,
|
||||
SSL3_RECORD_reset_input(&wr[j]);
|
||||
}
|
||||
|
||||
if (SSL_TREAT_AS_TLS13(s) && s->enc_write_ctx != NULL) {
|
||||
if (SSL_TREAT_AS_TLS13(s)
|
||||
&& s->enc_write_ctx != NULL
|
||||
&& (s->statem.enc_write_state != ENC_WRITE_STATE_WRITE_PLAIN_ALERTS
|
||||
|| type != SSL3_RT_ALERT)) {
|
||||
size_t rlen, max_send_fragment;
|
||||
|
||||
if (!WPACKET_put_bytes_u8(thispkt, type)) {
|
||||
@@ -981,8 +987,7 @@ int do_ssl3_write(SSL *s, int type, const unsigned char *buf,
|
||||
SSL3_RECORD_set_length(thiswr, len);
|
||||
}
|
||||
|
||||
if (s->early_data_state == SSL_EARLY_DATA_WRITING
|
||||
|| s->early_data_state == SSL_EARLY_DATA_WRITE_RETRY) {
|
||||
if (s->statem.enc_write_state == ENC_WRITE_STATE_WRITE_PLAIN_ALERTS) {
|
||||
/*
|
||||
* We haven't actually negotiated the version yet, but we're trying to
|
||||
* send early data - so we need to use the tls13enc function.
|
||||
|
||||
@@ -342,7 +342,10 @@ int ssl3_get_record(SSL *s)
|
||||
if (SSL_IS_TLS13(s) && s->enc_read_ctx != NULL) {
|
||||
if (thisrr->type != SSL3_RT_APPLICATION_DATA
|
||||
&& (thisrr->type != SSL3_RT_CHANGE_CIPHER_SPEC
|
||||
|| !SSL_IS_FIRST_HANDSHAKE(s))) {
|
||||
|| !SSL_IS_FIRST_HANDSHAKE(s))
|
||||
&& (thisrr->type != SSL3_RT_ALERT
|
||||
|| s->statem.enc_read_state
|
||||
!= ENC_READ_STATE_ALLOW_PLAIN_ALERTS)) {
|
||||
SSLfatal(s, SSL_AD_UNEXPECTED_MESSAGE,
|
||||
SSL_F_SSL3_GET_RECORD, SSL_R_BAD_RECORD_TYPE);
|
||||
return -1;
|
||||
@@ -692,7 +695,9 @@ int ssl3_get_record(SSL *s)
|
||||
}
|
||||
}
|
||||
|
||||
if (SSL_IS_TLS13(s) && s->enc_read_ctx != NULL) {
|
||||
if (SSL_IS_TLS13(s)
|
||||
&& s->enc_read_ctx != NULL
|
||||
&& thisrr->type != SSL3_RT_ALERT) {
|
||||
size_t end;
|
||||
|
||||
if (thisrr->length == 0
|
||||
|
||||
@@ -52,7 +52,13 @@ int tls13_enc(SSL *s, SSL3_RECORD *recs, size_t n_recs, int sending)
|
||||
seq = RECORD_LAYER_get_read_sequence(&s->rlayer);
|
||||
}
|
||||
|
||||
if (ctx == NULL) {
|
||||
/*
|
||||
* If we're sending an alert and ctx != NULL then we must be forcing
|
||||
* plaintext alerts. If we're reading and ctx != NULL then we allow
|
||||
* plaintext alerts at certain points in the handshake. If we've got this
|
||||
* far then we have already validated that a plaintext alert is ok here.
|
||||
*/
|
||||
if (ctx == NULL || rec->type == SSL3_RT_ALERT) {
|
||||
memmove(rec->data, rec->input, rec->length);
|
||||
rec->input = rec->data;
|
||||
return 1;
|
||||
|
||||
Reference in New Issue
Block a user