]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
cipher: Let _gnutls_auth_cipher_setiv() return int
authorTim Rühsen <tim.ruehsen@gmx.de>
Wed, 9 Oct 2019 16:44:35 +0000 (18:44 +0200)
committerTim Rühsen <tim.ruehsen@gmx.de>
Sun, 13 Oct 2019 10:27:19 +0000 (12:27 +0200)
Fixes Coverity issue 1454646

Signed-off-by: Tim Rühsen <tim.ruehsen@gmx.de>
lib/cipher.c
lib/cipher_int.h

index 5cae5d5543f8c04a2aeb785186728d9b7dd33809..908304ac7df000ad472fab383cad2d840f1b404b 100644 (file)
@@ -322,9 +322,11 @@ encrypt_packet(gnutls_session_t session,
                        /* copy the random IV.
                         */
                        memcpy(data_ptr, nonce, blocksize);
-                       _gnutls_auth_cipher_setiv(&params->write.
+                       ret = _gnutls_auth_cipher_setiv(&params->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(&params->read.
+                       ret = _gnutls_auth_cipher_setiv(&params->read.
                                                  ctx.tls12,
                                                  ciphertext->data,
                                                  blocksize);
+                       if (ret < 0)
+                               return gnutls_assert_val(ret);
 
                        memcpy(nonce, ciphertext->data, blocksize);
                        ciphertext->size -= blocksize;
index a0951f18c5e10324f60902fa54f1da4a61d25bcd..36c9385fbff9e40703294cb5b33a3419396c6fc0 100644 (file)
@@ -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 *