From 971f8114864a50cf266fe09d179139bf728aed65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20R=C3=BChsen?= Date: Wed, 9 Oct 2019 18:44:35 +0200 Subject: cipher: Let _gnutls_auth_cipher_setiv() return int MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes Coverity issue 1454646 Signed-off-by: Tim Rühsen --- lib/cipher.c | 8 ++++++-- lib/cipher_int.h | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/cipher.c b/lib/cipher.c index 5cae5d5543..908304ac7d 100644 --- a/lib/cipher.c +++ b/lib/cipher.c @@ -322,9 +322,11 @@ encrypt_packet(gnutls_session_t session, /* copy the random IV. */ memcpy(data_ptr, nonce, blocksize); - _gnutls_auth_cipher_setiv(¶ms->write. + ret = _gnutls_auth_cipher_setiv(¶ms->write. ctx.tls12, data_ptr, blocksize); + if (ret < 0) + return gnutls_assert_val(ret); /*data_ptr += blocksize;*/ cipher_data += blocksize; @@ -734,10 +736,12 @@ decrypt_packet(gnutls_session_t session, /* ignore the IV in TLS 1.1+ */ if (explicit_iv) { - _gnutls_auth_cipher_setiv(¶ms->read. + ret = _gnutls_auth_cipher_setiv(¶ms->read. ctx.tls12, ciphertext->data, blocksize); + if (ret < 0) + return gnutls_assert_val(ret); memcpy(nonce, ciphertext->data, blocksize); ciphertext->size -= blocksize; diff --git a/lib/cipher_int.h b/lib/cipher_int.h index a0951f18c5..36c9385fbf 100644 --- a/lib/cipher_int.h +++ b/lib/cipher_int.h @@ -241,11 +241,11 @@ int _gnutls_auth_cipher_decrypt2(auth_cipher_hd_st * handle, int _gnutls_auth_cipher_tag(auth_cipher_hd_st * handle, void *tag, int tag_size); -inline static void _gnutls_auth_cipher_setiv(const auth_cipher_hd_st * +inline static int _gnutls_auth_cipher_setiv(const auth_cipher_hd_st * handle, const void *iv, size_t ivlen) { - _gnutls_cipher_setiv(&handle->cipher, iv, ivlen); + return _gnutls_cipher_setiv(&handle->cipher, iv, ivlen); } inline static size_t _gnutls_auth_cipher_tag_len(auth_cipher_hd_st * -- cgit v1.2.1