mirror of
https://github.com/pocoproject/poco.git
synced 2025-01-19 08:46:41 +01:00
#3458: encryptString() crash on redhat/centos 8 with FIPS enabled using md5 default digest
This commit is contained in:
parent
292b9a7d83
commit
516eebad72
@ -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);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user