Fixes Coverity
1598052
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Todd Short <todd.short@me.com>
(Merged from https://github.com/openssl/openssl/pull/24929)
}
/* For integrity-only ciphers, nonce_len is same as MAC size */
- if (rl->mac_ctx != NULL)
+ if (rl->mac_ctx != NULL) {
nonce_len = EVP_MAC_CTX_get_mac_size(rl->mac_ctx);
- else
- nonce_len = EVP_CIPHER_CTX_get_iv_length(enc_ctx);
+ } else {
+ int ivlen = EVP_CIPHER_CTX_get_iv_length(enc_ctx);
+
+ if (ivlen < 0) {
+ /* Should not happen */
+ RLAYERfatal(rl, SSL_AD_INTERNAL_ERROR, ERR_R_INTERNAL_ERROR);
+ return 0;
+ }
+ nonce_len = (size_t)ivlen;
+ }
if (!sending) {
/*