This is an experimental flag that dates back to SSLeay 0.8.1b or earlier. It's never set internally and never set in consumers. Change-Id: I922583635c9f3d8d93f08f1707531ad22a26ae6a Reviewed-on: https://boringssl-review.googlesource.com/2214 Reviewed-by: Adam Langley <agl@google.com>kris/onging/CECPQ3_patch15
@@ -339,7 +339,6 @@ typedef struct ssl3_buffer_st | |||||
#define SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS 0x0001 | #define SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS 0x0001 | ||||
#define SSL3_FLAGS_POP_BUFFER 0x0004 | |||||
/* TODO(davidben): This flag can probably be merged into s3->change_cipher_spec | /* TODO(davidben): This flag can probably be merged into s3->change_cipher_spec | ||||
* to something tri-state. (Normal / Expect CCS / Between CCS and Finished). */ | * to something tri-state. (Normal / Expect CCS / Between CCS and Finished). */ | ||||
#define SSL3_FLAGS_EXPECT_CCS 0x0080 | #define SSL3_FLAGS_EXPECT_CCS 0x0080 | ||||
@@ -349,7 +348,6 @@ typedef struct ssl3_buffer_st | |||||
typedef struct ssl3_state_st | typedef struct ssl3_state_st | ||||
{ | { | ||||
long flags; | long flags; | ||||
int delay_buf_pop_ret; | |||||
unsigned char read_sequence[8]; | unsigned char read_sequence[8]; | ||||
int read_mac_secret_size; | int read_mac_secret_size; | ||||
@@ -439,8 +439,6 @@ int dtls1_connect(SSL *s) | |||||
if (ret <= 0) goto end; | if (ret <= 0) goto end; | ||||
s->state=SSL3_ST_CW_FLUSH; | s->state=SSL3_ST_CW_FLUSH; | ||||
/* clear flags */ | |||||
s->s3->flags&= ~SSL3_FLAGS_POP_BUFFER; | |||||
if (s->hit) | if (s->hit) | ||||
{ | { | ||||
s->s3->tmp.next_state=SSL_ST_OK; | s->s3->tmp.next_state=SSL_ST_OK; | ||||
@@ -520,11 +518,8 @@ int dtls1_connect(SSL *s) | |||||
} | } | ||||
#endif | #endif | ||||
/* If we are not 'joining' the last two packets, | |||||
* remove the buffering now */ | |||||
if (!(s->s3->flags & SSL3_FLAGS_POP_BUFFER)) | |||||
ssl_free_wbio_buffer(s); | |||||
/* else do it later in ssl3_write */ | |||||
/* Remove write buffering now. */ | |||||
ssl_free_wbio_buffer(s); | |||||
s->init_num=0; | s->init_num=0; | ||||
s->renegotiate=0; | s->renegotiate=0; | ||||
@@ -467,8 +467,6 @@ int ssl3_connect(SSL *s) | |||||
if (ret <= 0) goto end; | if (ret <= 0) goto end; | ||||
s->state=SSL3_ST_CW_FLUSH; | s->state=SSL3_ST_CW_FLUSH; | ||||
/* clear flags */ | |||||
s->s3->flags&= ~SSL3_FLAGS_POP_BUFFER; | |||||
if (s->hit) | if (s->hit) | ||||
{ | { | ||||
s->s3->tmp.next_state=SSL_ST_OK; | s->s3->tmp.next_state=SSL_ST_OK; | ||||
@@ -579,11 +577,8 @@ int ssl3_connect(SSL *s) | |||||
s->init_buf=NULL; | s->init_buf=NULL; | ||||
} | } | ||||
/* If we are not 'joining' the last two packets, | |||||
* remove the buffering now */ | |||||
if (!(s->s3->flags & SSL3_FLAGS_POP_BUFFER)) | |||||
ssl_free_wbio_buffer(s); | |||||
/* else do it later in ssl3_write */ | |||||
/* Remove write buffering now. */ | |||||
ssl_free_wbio_buffer(s); | |||||
s->init_num=0; | s->init_num=0; | ||||
s->renegotiate=0; | s->renegotiate=0; | ||||
@@ -2037,8 +2037,6 @@ int ssl3_shutdown(SSL *s) | |||||
int ssl3_write(SSL *s, const void *buf, int len) | int ssl3_write(SSL *s, const void *buf, int len) | ||||
{ | { | ||||
int ret,n; | |||||
#if 0 | #if 0 | ||||
if (s->shutdown & SSL_SEND_SHUTDOWN) | if (s->shutdown & SSL_SEND_SHUTDOWN) | ||||
{ | { | ||||
@@ -2049,63 +2047,15 @@ int ssl3_write(SSL *s, const void *buf, int len) | |||||
ERR_clear_system_error(); | ERR_clear_system_error(); | ||||
if (s->s3->renegotiate) ssl3_renegotiate_check(s); | if (s->s3->renegotiate) ssl3_renegotiate_check(s); | ||||
/* This is an experimental flag that sends the | |||||
* last handshake message in the same packet as the first | |||||
* use data - used to see if it helps the TCP protocol during | |||||
* session-id reuse */ | |||||
/* The second test is because the buffer may have been removed */ | |||||
if ((s->s3->flags & SSL3_FLAGS_POP_BUFFER) && (s->wbio == s->bbio)) | |||||
{ | |||||
/* First time through, we write into the buffer */ | |||||
if (s->s3->delay_buf_pop_ret == 0) | |||||
{ | |||||
ret=ssl3_write_bytes(s,SSL3_RT_APPLICATION_DATA, | |||||
buf,len); | |||||
if (ret <= 0) return(ret); | |||||
s->s3->delay_buf_pop_ret=ret; | |||||
} | |||||
s->rwstate=SSL_WRITING; | |||||
n=BIO_flush(s->wbio); | |||||
if (n <= 0) return(n); | |||||
s->rwstate=SSL_NOTHING; | |||||
/* We have flushed the buffer, so remove it */ | |||||
ssl_free_wbio_buffer(s); | |||||
s->s3->flags&= ~SSL3_FLAGS_POP_BUFFER; | |||||
ret=s->s3->delay_buf_pop_ret; | |||||
s->s3->delay_buf_pop_ret=0; | |||||
} | |||||
else | |||||
{ | |||||
ret=s->method->ssl_write_bytes(s,SSL3_RT_APPLICATION_DATA, | |||||
buf,len); | |||||
if (ret <= 0) return(ret); | |||||
} | |||||
return(ret); | |||||
return s->method->ssl_write_bytes(s, SSL3_RT_APPLICATION_DATA, buf, | |||||
len); | |||||
} | } | ||||
static int ssl3_read_internal(SSL *s, void *buf, int len, int peek) | static int ssl3_read_internal(SSL *s, void *buf, int len, int peek) | ||||
{ | { | ||||
int n,ret; | |||||
int ret; | |||||
ERR_clear_system_error(); | ERR_clear_system_error(); | ||||
if ((s->s3->flags & SSL3_FLAGS_POP_BUFFER) && (s->wbio == s->bbio)) | |||||
{ | |||||
/* Deal with an application that calls SSL_read() when handshake data | |||||
* is yet to be written. | |||||
*/ | |||||
if (BIO_wpending(s->wbio) > 0) | |||||
{ | |||||
s->rwstate=SSL_WRITING; | |||||
n=BIO_flush(s->wbio); | |||||
if (n <= 0) return(n); | |||||
s->rwstate=SSL_NOTHING; | |||||
} | |||||
} | |||||
if (s->s3->renegotiate) ssl3_renegotiate_check(s); | if (s->s3->renegotiate) ssl3_renegotiate_check(s); | ||||
s->s3->in_read_app_data=1; | s->s3->in_read_app_data=1; | ||||
ret=s->method->ssl_read_bytes(s,SSL3_RT_APPLICATION_DATA,buf,len,peek); | ret=s->method->ssl_read_bytes(s,SSL3_RT_APPLICATION_DATA,buf,len,peek); | ||||