|
@@ -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.
|