summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Rühsen <tim.ruehsen@gmx.de>2019-10-09 18:44:35 +0200
committerTim Rühsen <tim.ruehsen@gmx.de>2019-10-13 12:27:19 +0200
commit971f8114864a50cf266fe09d179139bf728aed65 (patch)
treea9534f60b023f9a463fe12779af7270910cf146c
parentc53e78bc547a7ff5904ff10c622be372ac2d3c38 (diff)
downloadgnutls-971f8114864a50cf266fe09d179139bf728aed65.tar.gz
cipher: Let _gnutls_auth_cipher_setiv() return int
Fixes Coverity issue 1454646 Signed-off-by: Tim Rühsen <tim.ruehsen@gmx.de>
-rw-r--r--lib/cipher.c8
-rw-r--r--lib/cipher_int.h4
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(&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;
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 *