mirror of
https://github.com/Telecominfraproject/wlan-cloud-lib-poco.git
synced 2025-11-02 03:27:56 +00:00
#3458: encryptString() crash on redhat/centos 8 with FIPS enabled using md5 default digest
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user