Skip to content
This repository has been archived by the owner on Aug 11, 2020. It is now read-only.

Commit

Permalink
deps: Remove EOED when SSL_MODE_QUIC_HACK is enabled
Browse files Browse the repository at this point in the history
Ported from
tatsuhiro-t/openssl@920a331

PR-URL: #6
Reviewed-By: Daniel Bevenius <[email protected]>
  • Loading branch information
jasnell committed Oct 3, 2019
1 parent 71397ae commit 828282e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
6 changes: 6 additions & 0 deletions deps/openssl/openssl/ssl/ssl_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -1816,6 +1816,12 @@ int SSL_read_early_data(SSL *s, void *buf, size_t num, size_t *readbytes)
ret = SSL_accept(s);
if (ret <= 0) {
/* NBIO or error */
if ((s->mode & SSL_MODE_QUIC_HACK)
&& s->ext.early_data == SSL_EARLY_DATA_ACCEPTED) {
*readbytes = 0;
return SSL_READ_EARLY_DATA_FINISH;
}

s->early_data_state = SSL_EARLY_DATA_ACCEPT_RETRY;
return SSL_READ_EARLY_DATA_ERROR;
}
Expand Down
3 changes: 2 additions & 1 deletion deps/openssl/openssl/ssl/statem/statem_clnt.c
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,8 @@ static WRITE_TRAN ossl_statem_client13_write_transition(SSL *s)
return WRITE_TRAN_CONTINUE;

case TLS_ST_PENDING_EARLY_DATA_END:
if (s->ext.early_data == SSL_EARLY_DATA_ACCEPTED) {
if (!(s->mode & SSL_MODE_QUIC_HACK)
&& s->ext.early_data == SSL_EARLY_DATA_ACCEPTED) {
st->hand_state = TLS_ST_CW_END_OF_EARLY_DATA;
return WRITE_TRAN_CONTINUE;
}
Expand Down
12 changes: 11 additions & 1 deletion deps/openssl/openssl/ssl/statem/statem_srvr.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ static int ossl_statem_server13_read_transition(SSL *s, int mt)
return 1;
}
break;
} else if (s->ext.early_data == SSL_EARLY_DATA_ACCEPTED) {
} else if (!(s->mode & SSL_MODE_QUIC_HACK)
&& s->ext.early_data == SSL_EARLY_DATA_ACCEPTED) {
if (mt == SSL3_MT_END_OF_EARLY_DATA) {
st->hand_state = TLS_ST_SR_END_OF_EARLY_DATA;
return 1;
Expand Down Expand Up @@ -939,6 +940,15 @@ WORK_STATE ossl_statem_server_post_work(SSL *s, WORK_STATE wst)
SSL3_CC_APPLICATION | SSL3_CHANGE_CIPHER_SERVER_WRITE))
/* SSLfatal() already called */
return WORK_ERROR;

if ((s->mode & SSL_MODE_QUIC_HACK)
&& s->ext.early_data == SSL_EARLY_DATA_ACCEPTED) {
s->early_data_state = SSL_EARLY_DATA_FINISHED_READING;
if (!s->method->ssl3_enc->change_cipher_state(
s, SSL3_CC_HANDSHAKE | SSL3_CHANGE_CIPHER_SERVER_READ))
/* SSLfatal() already called */
return WORK_ERROR;
}
}
break;

Expand Down

0 comments on commit 828282e

Please sign in to comment.