diff options
author | Tim Rühsen <tim.ruehsen@gmx.de> | 2019-10-09 18:44:35 +0200 |
---|---|---|
committer | Tim Rühsen <tim.ruehsen@gmx.de> | 2019-10-13 12:27:19 +0200 |
commit | 971f8114864a50cf266fe09d179139bf728aed65 (patch) | |
tree | a9534f60b023f9a463fe12779af7270910cf146c | |
parent | c53e78bc547a7ff5904ff10c622be372ac2d3c38 (diff) | |
download | gnutls-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.c | 8 | ||||
-rw-r--r-- | 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 * |