diff options
Diffstat (limited to 'src/Common/libzip/zip_crypto_openssl.c')
-rw-r--r-- | src/Common/libzip/zip_crypto_openssl.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/Common/libzip/zip_crypto_openssl.c b/src/Common/libzip/zip_crypto_openssl.c index 7f1da10e..9e9e8e7c 100644 --- a/src/Common/libzip/zip_crypto_openssl.c +++ b/src/Common/libzip/zip_crypto_openssl.c @@ -1,6 +1,6 @@ /* zip_crypto_openssl.c -- OpenSSL wrapper. - Copyright (C) 2018-2021 Dieter Baron and Thomas Klausner + Copyright (C) 2018-2023 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at <info@libzip.org> @@ -126,8 +126,9 @@ _zip_crypto_aes_free(_zip_crypto_aes_t *aes) { bool _zip_crypto_aes_encrypt_block(_zip_crypto_aes_t *aes, const zip_uint8_t *in, zip_uint8_t *out) { - int len; - if (EVP_EncryptUpdate(aes, out, &len, in, ZIP_CRYPTO_AES_BLOCK_LENGTH) != 1) { + int len = 0; + if (EVP_EncryptUpdate(aes, out, &len, in, ZIP_CRYPTO_AES_BLOCK_LENGTH) != 1 + || len != ZIP_CRYPTO_AES_BLOCK_LENGTH) { return false; } return true; @@ -214,11 +215,11 @@ _zip_crypto_hmac_free(_zip_crypto_hmac_t *hmac) { bool _zip_crypto_hmac_output(_zip_crypto_hmac_t *hmac, zip_uint8_t *data) { #ifdef USE_OPENSSL_3_API - size_t length; + size_t length = 0; return EVP_MAC_final(hmac->ctx, data, &length, ZIP_CRYPTO_SHA1_LENGTH) == 1 && length == ZIP_CRYPTO_SHA1_LENGTH; #else - unsigned int length; - return HMAC_Final(hmac, data, &length) == 1; + unsigned int length = 0; + return HMAC_Final(hmac, data, &length) == 1 && length == ZIP_CRYPTO_SHA1_LENGTH; #endif } |