X-Git-Url: https://git.openssl.org/?p=openssl.git;a=blobdiff_plain;f=ssl%2Frecord%2Frec_layer_d1.c;h=5e7aa6345afe4512ba94c8969850cc8d7f53c839;hp=487b096b2444d87b7ce2ac95959343eecf475fd0;hb=0e97f1e1a7f43be3a5e5c6256fe6bcb90caf9e01;hpb=bd990e2535ca387def9a01218a813dc3fa547e3c;ds=sidebyside diff --git a/ssl/record/rec_layer_d1.c b/ssl/record/rec_layer_d1.c index 487b096b24..5e7aa6345a 100644 --- a/ssl/record/rec_layer_d1.c +++ b/ssl/record/rec_layer_d1.c @@ -9,13 +9,12 @@ #include #include -#define USE_SOCKETS #include "../ssl_locl.h" #include #include #include "record_locl.h" -#include #include "../packet_locl.h" +#include "internal/cryptlib.h" int DTLS_RECORD_LAYER_new(RECORD_LAYER *rl) { @@ -645,8 +644,7 @@ int dtls1_read_bytes(SSL *s, int type, int *recvd_type, unsigned char *buf, * (which is tested for at the top of this function) then init must be * finished */ - assert(SSL_is_init_finished(s)); - if (!SSL_is_init_finished(s)) { + if (!ossl_assert(SSL_is_init_finished(s))) { al = SSL_AD_INTERNAL_ERROR; SSLerr(SSL_F_DTLS1_READ_BYTES, ERR_R_INTERNAL_ERROR); goto f_err; @@ -734,7 +732,10 @@ int dtls1_write_bytes(SSL *s, int type, const void *buf, size_t len, { int i; - OPENSSL_assert(len <= SSL3_RT_MAX_PLAIN_LENGTH); + if (!ossl_assert(len <= SSL3_RT_MAX_PLAIN_LENGTH)) { + SSLerr(SSL_F_DTLS1_WRITE_BYTES, ERR_R_INTERNAL_ERROR); + return -1; + } s->rwstate = SSL_NOTHING; i = do_dtls1_write(s, type, buf, len, 0, written); return i; @@ -757,9 +758,9 @@ int do_dtls1_write(SSL *s, int type, const unsigned char *buf, * first check if there is a SSL3_BUFFER still being written out. This * will happen with non blocking IO */ - if (SSL3_BUFFER_get_left(wb) != 0) { - OPENSSL_assert(0); /* XDTLS: want to see if we ever get here */ - return ssl3_write_pending(s, type, buf, len, written); + if (!ossl_assert(SSL3_BUFFER_get_left(wb) == 0)) { + SSLerr(SSL_F_DO_DTLS1_WRITE, ERR_R_INTERNAL_ERROR); + return 0; } /* If we have an alert to send, lets send it */