OpenSSL 1.1.1-pre2
This commit is contained in:
+8
-19
@@ -7,17 +7,17 @@
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#define USE_SOCKETS
|
||||
#include "ssl_locl.h"
|
||||
|
||||
int dtls1_write_app_data_bytes(SSL *s, int type, const void *buf_, int len)
|
||||
int dtls1_write_app_data_bytes(SSL *s, int type, const void *buf_, size_t len,
|
||||
size_t *written)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (SSL_in_init(s) && !ossl_statem_get_in_handshake(s)) {
|
||||
i = s->handshake_func(s);
|
||||
if (i < 0)
|
||||
return (i);
|
||||
return i;
|
||||
if (i == 0) {
|
||||
SSLerr(SSL_F_DTLS1_WRITE_APP_DATA_BYTES,
|
||||
SSL_R_SSL_HANDSHAKE_FAILURE);
|
||||
@@ -30,8 +30,7 @@ int dtls1_write_app_data_bytes(SSL *s, int type, const void *buf_, int len)
|
||||
return -1;
|
||||
}
|
||||
|
||||
i = dtls1_write_bytes(s, type, buf_, len);
|
||||
return i;
|
||||
return dtls1_write_bytes(s, type, buf_, len, written);
|
||||
}
|
||||
|
||||
int dtls1_dispatch_alert(SSL *s)
|
||||
@@ -40,6 +39,7 @@ int dtls1_dispatch_alert(SSL *s)
|
||||
void (*cb) (const SSL *ssl, int type, int val) = NULL;
|
||||
unsigned char buf[DTLS1_AL_HEADER_LENGTH];
|
||||
unsigned char *ptr = &buf[0];
|
||||
size_t written;
|
||||
|
||||
s->s3->alert_dispatch = 0;
|
||||
|
||||
@@ -47,23 +47,12 @@ int dtls1_dispatch_alert(SSL *s)
|
||||
*ptr++ = s->s3->send_alert[0];
|
||||
*ptr++ = s->s3->send_alert[1];
|
||||
|
||||
#ifdef DTLS1_AD_MISSING_HANDSHAKE_MESSAGE
|
||||
if (s->s3->send_alert[1] == DTLS1_AD_MISSING_HANDSHAKE_MESSAGE) {
|
||||
s2n(s->d1->handshake_read_seq, ptr);
|
||||
l2n3(s->d1->r_msg_hdr.frag_off, ptr);
|
||||
}
|
||||
#endif
|
||||
|
||||
i = do_dtls1_write(s, SSL3_RT_ALERT, &buf[0], sizeof(buf), 0);
|
||||
i = do_dtls1_write(s, SSL3_RT_ALERT, &buf[0], sizeof(buf), 0, &written);
|
||||
if (i <= 0) {
|
||||
s->s3->alert_dispatch = 1;
|
||||
/* fprintf( stderr, "not done with alert\n" ); */
|
||||
} else {
|
||||
if (s->s3->send_alert[0] == SSL3_AL_FATAL
|
||||
#ifdef DTLS1_AD_MISSING_HANDSHAKE_MESSAGE
|
||||
|| s->s3->send_alert[1] == DTLS1_AD_MISSING_HANDSHAKE_MESSAGE
|
||||
#endif
|
||||
)
|
||||
if (s->s3->send_alert[0] == SSL3_AL_FATAL)
|
||||
(void)BIO_flush(s->wbio);
|
||||
|
||||
if (s->msg_callback)
|
||||
@@ -80,5 +69,5 @@ int dtls1_dispatch_alert(SSL *s)
|
||||
cb(s, SSL_CB_WRITE_ALERT, j);
|
||||
}
|
||||
}
|
||||
return (i);
|
||||
return i;
|
||||
}
|
||||
Reference in New Issue
Block a user