Qt6 Migration: Complete migration with DDS/RTI support and build validation
Major Changes:
- Merged latest Qt5 devel content from dlbo (292 files changed, 7 new dirs)
- Consolidated forward-declarations and include folders
- Removed unneeded modules per Niklas' repo check list
Build System Fixes:
- Fixed CMake VERSION_GREATER syntax in ParticipantManagement/CMakeLists.txt
- Added VLC packages (libvlc-dev, vlc-plugin-base) to docker_build.sh
- Added PostgreSQL dev packages (libpq-dev, postgresql-server-dev-all) to Dockerfile
- Fixed locale warnings (ANSI_X3.4-1968 → C.UTF-8)
- Fixed ArcGIS SDK path warnings when BUILD_ARCGIS=OFF
Code Generation Fixes:
- Fixed IDL enum collisions (PortType→CorePortType/DdsutPortType, PdmEventType)
- Fixed Grantlee template svc_translation.cpp.grantlee:
- Changed {{ idl_enum.name }}_def:: to {{ idl_enum.name }}::
- Fixed .underlying() calls for C++11 scoped enums (enum class)
- Removed generated files from repo (moc_*, *_dtc.h, *_ftc.h)
Validation:
- BUILD_RTI=ON: SUCCESS
- BUILD_RTI=OFF: SUCCESS
- C++17 standard maintained for RTI 7.7 compatibility
- Ubuntu 26.04 Docker environment verified
Remaining Warnings (expected):
- BgViewer, KDChart, KDReports, Poppler-Qt6 not found (optional features)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
18662 files changed
+4115092
-5435
No files matched your search
@@ -0,0 +1,237 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Crypt/Decrypt functions (AES 256 CBC)
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*/
|
||||
|
||||
#include "aes_crypt.h"
|
||||
#include <QtCore/QByteArray>
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/err.h>
|
||||
#include <NGLLogger/NGLLoggerBootstrap.h>
|
||||
|
||||
namespace LtsLicence
|
||||
{
|
||||
struct AesCryptPrivate
|
||||
{
|
||||
AesCryptPrivate()
|
||||
: passPhrase(QLatin1String("LTS " LTS_VERSION_MAJOR "." LTS_VERSION_MINOR))
|
||||
, logger(NGL::NGLLoggerBootstrap::getNGLRootLogger().getNGLLogger("LtsLicenceLib.AesCrypt"))
|
||||
{
|
||||
qsrand(time(nullptr));
|
||||
#if OPENSSL_VERSION_NUMBER < 0x1010000fL
|
||||
ERR_load_crypto_strings();
|
||||
#endif
|
||||
}
|
||||
~AesCryptPrivate()
|
||||
{
|
||||
#if OPENSSL_VERSION_NUMBER < 0x1010000fL
|
||||
ERR_free_strings();
|
||||
#endif
|
||||
}
|
||||
|
||||
QString passPhrase;
|
||||
NGL::INGLLogger &logger;
|
||||
};
|
||||
Q_GLOBAL_STATIC(AesCryptPrivate, s_Private)
|
||||
|
||||
void setPassPhrase(const QString &passPhrase)
|
||||
{
|
||||
s_Private->passPhrase = passPhrase;
|
||||
}
|
||||
|
||||
QString passPhrase()
|
||||
{
|
||||
return s_Private->passPhrase;
|
||||
}
|
||||
|
||||
QByteArray decryptData(const QByteArray &dataToDecrypt,
|
||||
const QString &pw,
|
||||
bool *bOk)
|
||||
{
|
||||
if (bOk)
|
||||
*bOk = false;
|
||||
|
||||
int ret;
|
||||
int outSize1 = 0;
|
||||
int outSize2 = 0;
|
||||
unsigned char key[32];
|
||||
|
||||
// convert password to a key suitable for aes 256 cbc
|
||||
const QByteArray baPassword = pw.toUtf8();
|
||||
const unsigned char *dataPw = reinterpret_cast<const unsigned char *>(baPassword.data());
|
||||
int i = EVP_BytesToKey(EVP_aes_256_cbc(),
|
||||
EVP_sha1(),
|
||||
nullptr,
|
||||
dataPw,
|
||||
baPassword.size(),
|
||||
5,
|
||||
key,
|
||||
nullptr);
|
||||
if (i != 32)
|
||||
{
|
||||
ERROR_LOG(s_Private->logger) << "Wrong key size - should be 256 bits" ;
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
const QByteArray baSalt = dataToDecrypt.left(EVP_MAX_IV_LENGTH);
|
||||
const unsigned char *salt = reinterpret_cast<const unsigned char *>(baSalt.data());
|
||||
|
||||
const QByteArray bufEncrypted = dataToDecrypt.mid(EVP_MAX_IV_LENGTH);
|
||||
|
||||
EVP_CIPHER_CTX *ctx = EVP_CIPHER_CTX_new();
|
||||
ret = EVP_DecryptInit_ex(ctx,
|
||||
EVP_aes_256_cbc(),
|
||||
nullptr,
|
||||
key,
|
||||
salt);
|
||||
if (ret == 0)
|
||||
{
|
||||
EVP_CIPHER_CTX_free(ctx);
|
||||
char errbuf[256];
|
||||
ERR_error_string_n(ERR_get_error(), errbuf, sizeof(errbuf));
|
||||
ERROR_LOG(s_Private->logger) << "EVP_DecryptInit_ex failed" ;
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
// now decrypt the data, make sure to have enough space
|
||||
QByteArray bufDecrypted;
|
||||
bufDecrypted.resize(bufEncrypted.size() + EVP_CIPHER_CTX_block_size(ctx));
|
||||
const unsigned char *dataIn = reinterpret_cast<const unsigned char *>(bufEncrypted.data());
|
||||
unsigned char *dataOut = reinterpret_cast<unsigned char *>(bufDecrypted.data());
|
||||
|
||||
ret = EVP_DecryptUpdate(ctx,
|
||||
dataOut,
|
||||
&outSize1,
|
||||
dataIn,
|
||||
bufEncrypted.size());
|
||||
if (ret == 0)
|
||||
{
|
||||
EVP_CIPHER_CTX_free(ctx);
|
||||
char errbuf[256];
|
||||
ERR_error_string_n(ERR_get_error(), errbuf, sizeof(errbuf));
|
||||
ERROR_LOG(s_Private->logger) << "EVP_DecryptUpdate failed" ;
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
ret = EVP_DecryptFinal_ex(ctx,
|
||||
dataOut + outSize1,
|
||||
&outSize2);
|
||||
if (ret == 0)
|
||||
{
|
||||
EVP_CIPHER_CTX_free(ctx);
|
||||
char errbuf[256];
|
||||
ERR_error_string_n(ERR_get_error(), errbuf, sizeof(errbuf));
|
||||
ERROR_LOG(s_Private->logger) << "EVP_DecryptFinal_ex failed" ;
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
EVP_CIPHER_CTX_free(ctx);
|
||||
|
||||
bufDecrypted.resize(outSize1 + outSize2);
|
||||
|
||||
if (bOk)
|
||||
*bOk = true;
|
||||
return bufDecrypted;
|
||||
}
|
||||
|
||||
// decrpyt data (passphrase is set via setPassPhrase())
|
||||
QByteArray encryptData(const QByteArray &dataToEncrypt,
|
||||
const QString &pw,
|
||||
bool *bOk)
|
||||
{
|
||||
if (bOk)
|
||||
*bOk = false;
|
||||
|
||||
int ret;
|
||||
int outSize1 = 0;
|
||||
int outSize2 = 0;
|
||||
unsigned char key[32];
|
||||
QByteArray bufEncrypted;
|
||||
|
||||
// convert password to a key suitable for aes 256 cbc
|
||||
const QByteArray baPassword = pw.toUtf8();
|
||||
const unsigned char *dataPw = reinterpret_cast<const unsigned char *>(baPassword.data());
|
||||
int i = EVP_BytesToKey(EVP_aes_256_cbc(),
|
||||
EVP_sha1(),
|
||||
nullptr,
|
||||
dataPw,
|
||||
baPassword.size(),
|
||||
5,
|
||||
key,
|
||||
nullptr);
|
||||
if (i != 32)
|
||||
{
|
||||
ERROR_LOG(s_Private->logger) << "Wrong key size - should be 256 bits" ;
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
// generate a salt
|
||||
QByteArray baSalt(EVP_MAX_IV_LENGTH, 0);
|
||||
for (int i = 0; i < EVP_MAX_IV_LENGTH; ++i)
|
||||
baSalt[i] = qrand();
|
||||
const unsigned char *salt = reinterpret_cast<const unsigned char *>(baSalt.data());
|
||||
|
||||
// Init Encryption
|
||||
EVP_CIPHER_CTX *ctx = EVP_CIPHER_CTX_new();
|
||||
ret = EVP_EncryptInit_ex(ctx,
|
||||
EVP_aes_256_cbc(),
|
||||
nullptr,
|
||||
key,
|
||||
salt);
|
||||
if (ret == 0)
|
||||
{
|
||||
EVP_CIPHER_CTX_free(ctx);
|
||||
char errbuf[256];
|
||||
ERR_error_string_n(ERR_get_error(), errbuf, sizeof(errbuf));
|
||||
ERROR_LOG(s_Private->logger) << "EVP_EncryptInit_ex failed" ;
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
// now encrypt the data, make sure to have enough space
|
||||
bufEncrypted = QByteArray::fromRawData(reinterpret_cast<const char *>(salt), EVP_MAX_IV_LENGTH);
|
||||
bufEncrypted.resize(bufEncrypted.size() +
|
||||
dataToEncrypt.size() +
|
||||
EVP_CIPHER_CTX_block_size(ctx));
|
||||
const unsigned char *dataIn = reinterpret_cast<const unsigned char *>(dataToEncrypt.data());
|
||||
unsigned char *dataOut = reinterpret_cast<unsigned char *>(bufEncrypted.data());
|
||||
dataOut += baSalt.size();
|
||||
ret = EVP_EncryptUpdate(ctx,
|
||||
dataOut,
|
||||
&outSize1,
|
||||
dataIn,
|
||||
dataToEncrypt.size());
|
||||
if (ret == 0)
|
||||
{
|
||||
EVP_CIPHER_CTX_free(ctx);
|
||||
char errbuf[256];
|
||||
ERR_error_string_n(ERR_get_error(), errbuf, sizeof(errbuf));
|
||||
ERROR_LOG(s_Private->logger) << "EVP_EncryptUpdate failed" ;
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
// Finish encryption
|
||||
ret = EVP_EncryptFinal_ex(ctx,
|
||||
dataOut + outSize1,
|
||||
&outSize2);
|
||||
if (ret == 0)
|
||||
{
|
||||
EVP_CIPHER_CTX_free(ctx);
|
||||
char errbuf[256];
|
||||
ERR_error_string_n(ERR_get_error(), errbuf, sizeof(errbuf));
|
||||
ERROR_LOG(s_Private->logger) << "EVP_EncryptFinal_ex failed" ;
|
||||
return QByteArray();
|
||||
}
|
||||
// cleanup
|
||||
EVP_CIPHER_CTX_free(ctx);
|
||||
|
||||
bufEncrypted.resize(outSize1 + outSize2 + baSalt.size());
|
||||
|
||||
if (bOk)
|
||||
*bOk = true;
|
||||
return bufEncrypted;
|
||||
}
|
||||
|
||||
} // namespace LtsLicence
|
||||
Reference in new issue
Block a user