Kaydet (Commit) e11ff5a4 authored tarafından Caolán McNamara's avatar Caolán McNamara

ofz#4929 ensure min input len for openssl ciphers

openssl is not the default backend

Change-Id: Id7bd77c1a12a15c0ebb4e7d758362c7778bfc2fd
Reviewed-on: https://gerrit.libreoffice.org/47349Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 3071ba2a
......@@ -128,10 +128,20 @@ Decrypt::Decrypt(std::vector<sal_uInt8>& key, std::vector<sal_uInt8>& iv, Crypto
const EVP_CIPHER* cipher = getCipher(type);
const size_t nMinKeySize = EVP_CIPHER_key_length(cipher);
if (key.size() < nMinKeySize)
key.resize(nMinKeySize, 0);
if (iv.empty())
EVP_DecryptInit_ex(&mContext, cipher, nullptr, key.data(), 0);
else
{
const size_t nMinIVSize = EVP_CIPHER_iv_length(cipher);
if (iv.size() < nMinIVSize)
iv.resize(nMinIVSize, 0);
EVP_DecryptInit_ex(&mContext, cipher, nullptr, key.data(), iv.data());
}
EVP_CIPHER_CTX_set_padding(&mContext, 0);
#endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment