diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/3rdparty/open62541/open62541.c | 7 | ||||
-rw-r--r-- | src/opcua/configure.cmake | 46 | ||||
-rw-r--r-- | src/opcua/doc/src/qtopcua.qdoc | 4 | ||||
-rw-r--r-- | src/plugins/opcua/open62541/CMakeLists.txt | 22 | ||||
-rw-r--r-- | src/plugins/opcua/open62541/qopen62541node.h | 2 |
5 files changed, 48 insertions, 33 deletions
diff --git a/src/3rdparty/open62541/open62541.c b/src/3rdparty/open62541/open62541.c index 2ca1f25..041cd56 100644 --- a/src/3rdparty/open62541/open62541.c +++ b/src/3rdparty/open62541/open62541.c @@ -60855,8 +60855,11 @@ UA_OpenSSL_LoadLocalCertificate(const UA_ByteString *certificate, UA_ByteString X509_free(cert); if (length > 0) { - target->length = (size_t) length; - target->data = derData; + UA_ByteString temp; + temp.length = (size_t) length; + temp.data = derData; + UA_ByteString_copy(&temp, target); + OPENSSL_free(derData); return UA_STATUSCODE_GOOD; } diff --git a/src/opcua/configure.cmake b/src/opcua/configure.cmake index cf54680..1777211 100644 --- a/src/opcua/configure.cmake +++ b/src/opcua/configure.cmake @@ -13,34 +13,12 @@ set_property(CACHE INPUT_open62541 PROPERTY STRINGS undefined no qt system) if (INPUT_open62541 STREQUAL "system") qt_find_package(Open62541 PROVIDED_TARGETS open62541) endif() -qt_find_package(Mbedtls PROVIDED_TARGETS mbedtls) qt_find_package(Uacpp PROVIDED_TARGETS uacpp) find_package(WrapOpenSSL 1.1) # special case end #### Tests -# special case begin -qt_config_compile_test(mbedtls - LABEL "mbedTLS support" - LIBRARIES - mbedtls - CODE -"#include <mbedtls/x509.h> -#include <mbedtls/x509_crt.h> - -int main(int argc, char *argv[]) -{ - mbedtls_pk_context pk; - mbedtls_pk_init( &pk ); - - mbedtls_x509_crt remoteCertificate; - mbedtls_x509_crt_init(&remoteCertificate); - - return 0; -} -") -# special case end # special case begin if (INPUT_open62541 STREQUAL "system") @@ -106,6 +84,11 @@ int main(int /*argc*/, char ** /*argv*/) }") # special case end +# Find out if the system open62541 is built with encryption support +include(CheckSymbolExists) +if (Open62541_FOUND) + check_symbol_exists(UA_ENABLE_ENCRYPTION ${Open62541_INCLUDE_DIRS}/open62541.h OPEN62541_SYSTEM_ENCRYPTION) +endif() #### Features @@ -127,10 +110,12 @@ qt_feature("uacpp" PRIVATE LABEL "Unified Automation C++ SDK" CONDITION TEST_uacpp # special case ) -qt_feature("mbedtls" PRIVATE - LABEL "mbedtls" - CONDITION Mbedtls_FOUND AND TEST_mbedtls # special case -) +# special case begin +#qt_feature("mbedtls" PRIVATE +# LABEL "mbedtls" +# CONDITION Mbedtls_FOUND AND TEST_mbedtls # special case +#) +# special case end qt_feature("ns0idnames" PRIVATE LABEL "Support for namespace 0 NodeId names" PURPOSE "Provides names for the QOpcUa::NodeIds::Namespace0 enum." @@ -145,12 +130,19 @@ qt_feature("gds" PUBLIC PRIVATE PURPOSE "Enables QOpcUaClient to interact with a global discovery server" CONDITION WrapOpenSSL_FOUND # special case ) +# special case begin +qt_feature("open62541-security" PUBLIC PRIVATE + LABEL "Open62541 security support" + PURPOSE "Enables the open62541 plugin to connect to servers with signing and encryption" + CONDITION (WrapOpenSSL_FOUND AND QT_FEATURE_open62541 AND NOT QT_FEATURE_system_open62541) OR OPEN62541_SYSTEM_ENCRYPTION +) +# special case end qt_feature_definition("gds" "QT_NO_GDS" NEGATE VALUE "1") qt_configure_add_summary_section(NAME "Qt Opcua") qt_configure_add_summary_entry(ARGS "open62541") qt_configure_add_summary_entry(ARGS "uacpp") qt_configure_add_summary_entry(ARGS "ns0idnames") qt_configure_add_summary_entry(ARGS "ns0idgenerator") -qt_configure_add_summary_entry(ARGS "mbedtls") +qt_configure_add_summary_entry(ARGS "open62541-security") # special case qt_configure_add_summary_entry(ARGS "gds") qt_configure_end_summary_section() # end of "Qt Opcua" section diff --git a/src/opcua/doc/src/qtopcua.qdoc b/src/opcua/doc/src/qtopcua.qdoc index d8eda07..977d9c9 100644 --- a/src/opcua/doc/src/qtopcua.qdoc +++ b/src/opcua/doc/src/qtopcua.qdoc @@ -399,6 +399,10 @@ The Open62541 plugin is available under the same licenses as Qt OPC UA. The Open62541 library itself is licensed under \l {https://open62541}{Mozilla Public License v2.0}. + The security support is provided by the OpenSSL plugins of the open62541 library. + If the open62541 plugin is built with security support and OpenSSL is not available + on the target system, the open62541 plugin will fail to load. + \section2 UA CPP The UA CPP plugin is available under commercial licenses from \l{The Qt Company}. diff --git a/src/plugins/opcua/open62541/CMakeLists.txt b/src/plugins/opcua/open62541/CMakeLists.txt index 59c4dfc..3e97746 100644 --- a/src/plugins/opcua/open62541/CMakeLists.txt +++ b/src/plugins/opcua/open62541/CMakeLists.txt @@ -40,13 +40,29 @@ qt_extend_target(QOpen62541Plugin CONDITION QT_FEATURE_open62541 AND NOT QT_FEAT ../../../3rdparty/open62541 ) -qt_extend_target(QOpen62541Plugin CONDITION QT_FEATURE_mbedtls AND QT_FEATURE_open62541 AND NOT QT_FEATURE_system_open62541 +# special case begin +#qt_extend_target(QOpen62541Plugin CONDITION QT_FEATURE_mbedtls AND QT_FEATURE_open62541 AND NOT QT_FEATURE_system_open62541 +# DEFINES +# UA_ENABLE_ENCRYPTION +# UA_ENABLE_ENCRYPTION_MBEDTLS +# LIBRARIES +# mbedtls +#) +#special case end + +# special case begin +if (QT_FEATURE_open62541_security AND NOT QT_FEATURE_system_open62541) + find_package(WrapOpenSSL 1.1) +endif() + +qt_extend_target(QOpen62541Plugin CONDITION QT_FEATURE_open62541_security AND WrapOpenSSL_FOUND AND QT_FEATURE_open62541 AND NOT QT_FEATURE_system_open62541 DEFINES UA_ENABLE_ENCRYPTION - UA_ENABLE_ENCRYPTION_MBEDTLS + UA_ENABLE_ENCRYPTION_OPENSSL LIBRARIES - mbedtls + WrapOpenSSL::WrapOpenSSL ) +# special case end qt_extend_target(QOpen62541Plugin CONDITION QT_FEATURE_open62541 AND WIN32 AND MSVC AND NOT QT_FEATURE_system_open62541 # special case PUBLIC_LIBRARIES diff --git a/src/plugins/opcua/open62541/qopen62541node.h b/src/plugins/opcua/open62541/qopen62541node.h index f5e5133..ba96d85 100644 --- a/src/plugins/opcua/open62541/qopen62541node.h +++ b/src/plugins/opcua/open62541/qopen62541node.h @@ -54,7 +54,7 @@ public: bool enableMonitoring(QOpcUa::NodeAttributes attr, const QOpcUaMonitoringParameters &settings) override; bool disableMonitoring(QOpcUa::NodeAttributes attr) override; bool modifyMonitoring(QOpcUa::NodeAttribute attr, QOpcUaMonitoringParameters::Parameter item, const QVariant &value) override; - bool browse(const QOpcUaBrowseRequest &request); + bool browse(const QOpcUaBrowseRequest &request) override; QString nodeId() const override; bool writeAttribute(QOpcUa::NodeAttribute attribute, const QVariant &value, QOpcUa::Types type, const QString &indexRange) override; |