Skip to content

Commit

Permalink
upgrade Poco to 1.11.5
Browse files Browse the repository at this point in the history
  • Loading branch information
obiltschnig committed Nov 3, 2022
1 parent 4dc3143 commit 74e9459
Show file tree
Hide file tree
Showing 90 changed files with 12,216 additions and 1,892 deletions.
11 changes: 0 additions & 11 deletions CppUnit/include/Poco/CppUnit/CppUnit.h

This file was deleted.

11 changes: 0 additions & 11 deletions CppUnit/include/Poco/CppUnit/CppUnitException.h

This file was deleted.

11 changes: 0 additions & 11 deletions CppUnit/include/Poco/CppUnit/Guards.h

This file was deleted.

11 changes: 0 additions & 11 deletions CppUnit/include/Poco/CppUnit/Orthodox.h

This file was deleted.

11 changes: 0 additions & 11 deletions CppUnit/include/Poco/CppUnit/RepeatedTest.h

This file was deleted.

12 changes: 0 additions & 12 deletions CppUnit/include/Poco/CppUnit/Test.h

This file was deleted.

11 changes: 0 additions & 11 deletions CppUnit/include/Poco/CppUnit/TestCaller.h

This file was deleted.

11 changes: 0 additions & 11 deletions CppUnit/include/Poco/CppUnit/TestCase.h

This file was deleted.

11 changes: 0 additions & 11 deletions CppUnit/include/Poco/CppUnit/TestDecorator.h

This file was deleted.

13 changes: 0 additions & 13 deletions CppUnit/include/Poco/CppUnit/TestFailure.h

This file was deleted.

11 changes: 0 additions & 11 deletions CppUnit/include/Poco/CppUnit/TestResult.h

This file was deleted.

11 changes: 0 additions & 11 deletions CppUnit/include/Poco/CppUnit/TestRunner.h

This file was deleted.

11 changes: 0 additions & 11 deletions CppUnit/include/Poco/CppUnit/TestSetup.h

This file was deleted.

11 changes: 0 additions & 11 deletions CppUnit/include/Poco/CppUnit/TestSuite.h

This file was deleted.

11 changes: 0 additions & 11 deletions CppUnit/include/Poco/CppUnit/TextTestResult.h

This file was deleted.

11 changes: 0 additions & 11 deletions CppUnit/include/Poco/CppUnit/estring.h

This file was deleted.

1 change: 0 additions & 1 deletion Crypto/include/Poco/Crypto/Cipher.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ class Crypto_API Cipher: public Poco::RefCountedObject
ENC_BINHEX = 0x02, /// BinHex-encoded output
ENC_BASE64_NO_LF = 0x81, /// Base64-encoded output, no linefeeds
ENC_BINHEX_NO_LF = 0x82 /// BinHex-encoded output, no linefeeds

};

virtual ~Cipher();
Expand Down
14 changes: 14 additions & 0 deletions Crypto/include/Poco/Crypto/Crypto.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,15 @@
#define POCO_EXTERNAL_OPENSSL_SLPRO 2


//
// Temporarily suppress deprecation warnings coming
// from OpenSSL 3.0, until we have updated our code.
//
#if !defined(POCO_DONT_SUPPRESS_OPENSSL_DEPRECATED)
#define OPENSSL_SUPPRESS_DEPRECATED
#endif


#include "Poco/Foundation.h"
#include <openssl/opensslv.h>

Expand All @@ -39,6 +48,11 @@
#endif


#if OPENSSL_VERSION_NUMBER < 0x10000000L
#error "OpenSSL version too old. At least OpenSSL 1.0.0 is required."
#endif


enum RSAPaddingMode
/// The padding mode used for RSA public key encryption.
{
Expand Down
26 changes: 19 additions & 7 deletions Crypto/include/Poco/Crypto/OpenSSLInitializer.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@
#include "Poco/Mutex.h"
#include "Poco/AtomicCounter.h"
#include <openssl/crypto.h>

#if OPENSSL_VERSION_NUMBER >= 0x30000000L
#include <openssl/provider.h>
#endif
#if defined(OPENSSL_FIPS) && OPENSSL_VERSION_NUMBER < 0x010001000L
#include <openssl/fips.h>
#endif
Expand Down Expand Up @@ -50,38 +52,48 @@ class Crypto_API OpenSSLInitializer
public:
OpenSSLInitializer();
/// Automatically initialize OpenSSL on startup.

~OpenSSLInitializer();
/// Automatically shut down OpenSSL on exit.

static void initialize();
/// Initializes the OpenSSL machinery.

static void uninitialize();
/// Shuts down the OpenSSL machinery.

static bool isFIPSEnabled();
// Returns true if FIPS mode is enabled, false otherwise.
/// Returns true if FIPS mode is enabled, false otherwise.

static void enableFIPSMode(bool enabled);
// Enable or disable FIPS mode. If FIPS is not available, this method doesn't do anything.
/// Enable or disable FIPS mode. If FIPS is not available, this method doesn't do anything.

protected:
enum
{
SEEDSIZE = 256
};


#if OPENSSL_VERSION_NUMBER < 0x10100000L
// OpenSSL multithreading support
static void lock(int mode, int n, const char* file, int line);
static unsigned long id();
static struct CRYPTO_dynlock_value* dynlockCreate(const char* file, int line);
static void dynlock(int mode, struct CRYPTO_dynlock_value* lock, const char* file, int line);
static void dynlockDestroy(struct CRYPTO_dynlock_value* lock, const char* file, int line);
#endif

private:
static Poco::FastMutex* _mutexes;
static Poco::AtomicCounter _rc;

#if OPENSSL_VERSION_NUMBER < 0x10100000L
static Poco::FastMutex* _mutexes;
#endif

#if OPENSSL_VERSION_NUMBER >= 0x30000000L
static OSSL_PROVIDER* _defaultProvider;
static OSSL_PROVIDER* _legacyProvider;
#endif
};


Expand Down
6 changes: 4 additions & 2 deletions Crypto/src/CipherImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,20 +98,22 @@ namespace
{
#if OPENSSL_VERSION_NUMBER >= 0x10100000L
_pContext = EVP_CIPHER_CTX_new();
EVP_CipherInit(
if (!_pContext) throwError();
int rc = EVP_CipherInit(
_pContext,
_pCipher,
&_key[0],
_iv.empty() ? 0 : &_iv[0],
(dir == DIR_ENCRYPT) ? 1 : 0);
#else
EVP_CipherInit(
int rc = EVP_CipherInit(
&_context,
_pCipher,
&_key[0],
_iv.empty() ? 0 : &_iv[0],
(dir == DIR_ENCRYPT) ? 1 : 0);
#endif
if (rc == 0) throwError();

#if OPENSSL_VERSION_NUMBER >= 0x10001000L
if (_iv.size() != EVP_CIPHER_iv_length(_pCipher) && EVP_CIPHER_mode(_pCipher) == EVP_CIPH_GCM_MODE)
Expand Down
21 changes: 21 additions & 0 deletions Crypto/src/CipherKeyImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down Expand Up @@ -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);

Expand Down
6 changes: 2 additions & 4 deletions Crypto/src/ECKeyImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@
#include "Poco/StreamCopier.h"
#include <sstream>
#include <openssl/evp.h>
#if OPENSSL_VERSION_NUMBER >= 0x00908000L
#include <openssl/bn.h>
#endif


namespace Poco {
Expand Down Expand Up @@ -78,8 +76,8 @@ ECKeyImpl::ECKeyImpl(int curve):
}


ECKeyImpl::ECKeyImpl(const std::string& publicKeyFile,
const std::string& privateKeyFile,
ECKeyImpl::ECKeyImpl(const std::string& publicKeyFile,
const std::string& privateKeyFile,
const std::string& privateKeyPassphrase): KeyPairImpl("ec", KT_EC_IMPL), _pEC(0)
{
if (EVPPKey::loadKey(&_pEC, PEM_read_PrivateKey, EVP_PKEY_get1_EC_KEY, privateKeyFile, privateKeyPassphrase))
Expand Down
Loading

0 comments on commit 74e9459

Please sign in to comment.