#3458: encryptString() crash on redhat/centos 8 with FIPS enabled using md5 default digest

This commit is contained in:
Günter Obiltschnig 2022-02-07 18:21:46 +01:00
parent 292b9a7d83
commit 516eebad72

View File

@ -21,6 +21,25 @@
#include <openssl/evp.h>
namespace
{
void throwError()
{
unsigned long err;
std::string msg;
while ((err = ERR_get_error()))
{
if (!msg.empty())
msg.append("; ");
msg.append(ERR_error_string(err, 0));
}
throw Poco::IOException(msg);
}
}
namespace Poco {
namespace Crypto {
@ -186,6 +205,8 @@ void CipherKeyImpl::generateKey(
keyBytes,
ivBytes);
if (!keySize) throwError();
// Copy the buffers to our member byte vectors.
_key.assign(keyBytes, keyBytes + keySize);