diff options
author | Matt Caswell <matt@openssl.org> | 2017-05-22 12:33:42 +0100 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2017-05-22 14:00:43 +0100 |
commit | b77f3ed17134fe6bf99d143abb1aec3f2bfac555 (patch) | |
tree | a69d558f10df0648f0adcfb78a8b11933629879d /ssl/record | |
parent | a89325e41f52b4a1f58202f6d8f5597105fc9f5a (diff) |
Convert existing usage of assert() to ossl_assert() in libssl
Provides consistent output and approach.
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3496)
Diffstat (limited to 'ssl/record')
-rw-r--r-- | ssl/record/rec_layer_d1.c | 4 | ||||
-rw-r--r-- | ssl/record/rec_layer_s3.c | 1 | ||||
-rw-r--r-- | ssl/record/ssl3_record.c | 4 | ||||
-rw-r--r-- | ssl/record/ssl3_record_tls13.c | 4 |
4 files changed, 3 insertions, 10 deletions
diff --git a/ssl/record/rec_layer_d1.c b/ssl/record/rec_layer_d1.c index 879a9b039c..9f80050f01 100644 --- a/ssl/record/rec_layer_d1.c +++ b/ssl/record/rec_layer_d1.c @@ -14,7 +14,6 @@ #include <openssl/evp.h> #include <openssl/buffer.h> #include "record_locl.h" -#include <assert.h> #include "../packet_locl.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; diff --git a/ssl/record/rec_layer_s3.c b/ssl/record/rec_layer_s3.c index dabb02cf1b..fbabdf48c5 100644 --- a/ssl/record/rec_layer_s3.c +++ b/ssl/record/rec_layer_s3.c @@ -8,7 +8,6 @@ */ #include <stdio.h> -#include <assert.h> #include <limits.h> #include <errno.h> #define USE_SOCKETS diff --git a/ssl/record/ssl3_record.c b/ssl/record/ssl3_record.c index bba0cc0f0b..bd27290aa8 100644 --- a/ssl/record/ssl3_record.c +++ b/ssl/record/ssl3_record.c @@ -7,7 +7,6 @@ * https://www.openssl.org/source/license.html */ -#include <assert.h> #include "../ssl_locl.h" #include "internal/constant_time_locl.h" #include <openssl/rand.h> @@ -436,8 +435,7 @@ int ssl3_get_record(SSL *s) unsigned char *mac; /* TODO(size_t): convert this to do size_t properly */ imac_size = EVP_MD_CTX_size(s->read_hash); - assert(imac_size >= 0 && imac_size <= EVP_MAX_MD_SIZE); - if (imac_size < 0 || imac_size > EVP_MAX_MD_SIZE) { + if (!ossl_assert(imac_size >= 0 && imac_size <= EVP_MAX_MD_SIZE)) { al = SSL_AD_INTERNAL_ERROR; SSLerr(SSL_F_SSL3_GET_RECORD, ERR_LIB_EVP); goto f_err; diff --git a/ssl/record/ssl3_record_tls13.c b/ssl/record/ssl3_record_tls13.c index 9e65852f9d..61e209254e 100644 --- a/ssl/record/ssl3_record_tls13.c +++ b/ssl/record/ssl3_record_tls13.c @@ -7,7 +7,6 @@ * https://www.openssl.org/source/license.html */ -#include <assert.h> #include "../ssl_locl.h" #include "record_locl.h" @@ -64,8 +63,7 @@ int tls13_enc(SSL *s, SSL3_RECORD *recs, size_t n_recs, int sending) * To get here we must have selected a ciphersuite - otherwise ctx would * be NULL */ - assert(s->s3->tmp.new_cipher != NULL); - if (s->s3->tmp.new_cipher == NULL) + if (!ossl_assert(s->s3->tmp.new_cipher != NULL)) return -1; alg_enc = s->s3->tmp.new_cipher->algorithm_enc; } |