From: Tim Rühsen Date: Wed, 9 Oct 2019 16:44:35 +0000 (+0200) Subject: cipher: Let _gnutls_auth_cipher_setiv() return int X-Git-Tag: gnutls_3_6_11~32^2~3 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=971f8114864a50cf266fe09d179139bf728aed65;p=thirdparty%2Fgnutls.git cipher: Let _gnutls_auth_cipher_setiv() return int Fixes Coverity issue 1454646 Signed-off-by: Tim Rühsen --- 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 *