497 Commits
Author SHA1 Message Date
Jörg Schüler-Maroldt 55f486e2f5 fix(plugins): Two security fixes for OpenSSL uncovered by MSVC (#6009)
* In UA_CertificateVerification_VerifyApplicationURI()
set initial subjectURI to UA_STRING_NULL, may be no urn entry in certificate

* Fix problem, if UA_OpenSSL_LoadCertificate() fails in UA_ChannelModule_New_Context()
2023-09-11 13:21:29 +02:00
Julius Pfrommer b6ab8d3b71 fix(plugin): Disable padding by OpenSSL (is done internally)
This lead to OpenSSL mistakenly writing behind the buffer length in some
cases.
2022-11-14 07:28:49 +01:00
Julius Pfrommer 106cd61ad9 fix(plugin): Reject all certificates for empty trust-list 2022-11-14 07:28:49 +01:00
Julius Pfrommer 1d6aa03333 fix(plugin): Fix warning for use of OPENSSL_API_COMPAT 2022-11-14 07:28:49 +01:00
Bin Lan 3a7067a174 feat(plugin): Add OpenSSL 3.0 support (#5349)
* Add OpenSSL3.0 support

This change set adds a new function UA_OpenSSL_RSA_Key_Size() to get
the RSA key size, re-writes the function
UA_Openssl_RSA_Private_Decrypt() by using the high level APIs of
OpenSSL3.0, add a new function UA_RSA_Generate_Key() to generate
a RSA key.

No build warning with OpenSSL3.0 and OpenSSL1.1.1f.

* Build & Test with OpenSSL3.0 in Ubuntu22.04
2022-11-14 07:28:49 +01:00
Julius Pfrommer 825d847b31 fix(plugin): Fix crash in OpenSSL when loaded with an empty certificate 2022-11-14 07:28:49 +01:00
Julius Pfrommer b79db1ac78 fix(plugin): Add default limits for chunks and message size
Based on a reported DoS vulnerability reported by Team82 (Claroty
Research).
2022-06-04 15:09:28 +02:00
Julius Pfrommer bb1abfc881 fix(plugin): Remove assert about the key length in ua_openssl_basic256sha256.c 2021-12-01 01:11:38 +01:00
Julius Pfrommer ecf5a70378 fix(plugin): Signature keylength can be > 256bit 2021-05-12 07:38:36 +02:00
Keerthivasan Alagarsamy Senthilkumaran 4038a31895 fix(pubsub): Send ethernet packets of ethertype 0xb62c
- Changed ethertype from LLC to ETHERTYPE_UADP(0xb62c)
   according to pubsub specification
 - Handled the padding bytes in the src file

Signed-off-by: Keerthivasan Alagarsamy Senthilkumaran <keerthivasan.as@kalycito.com>
Change-Id: I0785cc259a595cad259273c844ca78942c5ae70c
2021-04-13 10:35:12 +02:00
Julius Pfrommer 4b9f4b71e9 fix(plugins): Make ua_pki_mbedtls.c clang-analyzer clean 2021-02-28 07:05:05 +01:00
Julius Pfrommer cc3a3d396b refactor(plugins): Clean up whitespace in securitypolicy_openssl_common.c 2021-02-24 15:03:21 +01:00
Julius Pfrommer 4c8bda46be fix(plugins): Fix OpenSSL build if OPENSSL_API_COMPAT undefined 2021-02-24 15:03:21 +01:00
heandJulius Pfrommer 511fc259ba fix(sec): fix OpenSSL V1.1 API incompatibility for Windows 32 build (#4187)
* Fixed build for Embarcdero C++Builder 10.4/clang

* Fix invalid order of parameters for gmtime_s in arch/win32/ua_clock.c

* Update ua_architecture.h

Fix MS build (again)...

* Fix parameter order of gmtime_s() for CodeGear and MSVC

* Fix OpenSSL V1.1 API compatibility

Co-authored-by: Julius Pfrommer <jpfr@users.noreply.github.com>
2021-02-16 18:27:26 +01:00
Opcua_Tsn_Team_KalycitoandJulius Pfrommer 72af2b1efd fix(plugin): Add additional checks for OpenSSL SecurityPolicies
- Resolved 9 failure test cases in server_ctt running with OpenSSL
   security policy
 - Resolved 002.js, 010.js, 029.js, 042.js, 043.js, 044.js, 045.js and
   047.js test cases in Security Certificate Validation Conformance Unit
 - Resolved Err-003.js test case in Session Base Conformance Unit

Signed-off-by: divyaprasanth <divyaprasanth@kalycito.com>
Change-Id: I4bd0e6c744229e1ce1a83a95a1a9a403875bf687

Co-authored-by: Julius Pfrommer <jpfr@users.noreply.github.com>
2021-02-13 21:27:32 +01:00
Heiko Thiery cbb9b58507 fix build warnings about uninitialized retval (#4061) 2021-02-12 13:06:54 +01:00
basyskom-jvoe f4270cebb2 fix(plugin): PEM support for Aes128_Sha256_RsaOaep (#4171)
* Add PEM test case for Aes128_Sha256_RsaOaep

* Fix PEM support for Aes128_Sha256_RsaOaep
2021-02-09 12:21:37 +01:00
Yabing Liu 8f54803aed fix(ex): align VxWorks TSN publisher example with v1.2 2021-01-14 09:09:52 +08:00
Julius Pfrommer 7f56f90490 refactor(plugin): Dereference into union instead of casting in nodestore 2020-12-27 14:06:32 +01:00
StalderT 6c8d387b15 fix(plugin): keyLen may be used uninitialized (#4093) 2020-12-23 23:29:49 +01:00
Martina Felber 36bc7da4b6 fix(plugin): use of uninitialized value
UA_PubSubChannelEthernet_receive() returns an uninitialized value
(retval), if  there is more data available than fits into the
message buffer.

Control flow in case of the error:

Receive buffer size is 4096 - see UA_ReaderGroup_subscribeCallback.
timeout > 0
select resultsize > 0
recvmsg datalen > 0
remainingMessageLength >= 1496 -> false -> there is still more data
2020-12-23 01:17:18 +01:00
Yabing Liu fa4679d1d8 feat(ex): Add a VxWorks TSN publisher example
This publisher is a complement to pubsub_interrupt_publish.c. It is a VxWorks
specific implementation with VxWorks-native TSN features and can be applied to
hard realtime scenarios.
2020-12-22 11:10:30 +01:00
Tim Gates 0c9cf43bf9 fix(doc): fix simple typo, endpoit -> endpoint (#4036)
There is a small typo in include/open62541/plugin/securitypolicy.h, plugins/crypto/openssl/ua_openssl_aes128sha256rsaoaep.c, plugins/crypto/openssl/ua_openssl_basic256.c, plugins/crypto/openssl/ua_openssl_basic256sha256.c.

Should read `endpoint` rather than `endpoit`.
2020-12-06 10:37:18 +01:00
Michael Walle 18f798cfc3 fix(PubSub): fix snprintf buffer length
GCC-10 reports the following error:
In function ‘snprintf’,
    inlined from ‘UA_PubSubChannelEthernetETF_open’ at /root/open62541/plugins/ua_pubsub_ethernet_etf.c:195:5,
    inlined from ‘TransportLayerEthernetETF_addChannel’ at /root/open62541/plugins/ua_pubsub_ethernet_etf.c:638:40:
/usr/include/bits/stdio2.h:67:10: warning: ‘__builtin___snprintf_chk’ specified bound 40 exceeds destination size 16 [-Wstringop-overflow=]

The same is true for the XDP version. Fix it.

Signed-off-by: Michael Walle <michael.walle@kontron.com>
2020-12-06 03:25:31 +01:00
Julius Pfrommer b36a1739e1 fix(server): Remove unused nThreads config option 2020-11-28 18:09:20 +01:00
Julius Pfrommer 5a82eb2c87 feat(server): Remove option relaxEmptyValueConstraint; less verbose ns0 bootstrap
Since we now generate matching values, relaxing the empty values
constraint is now obsolete.
2020-11-28 18:09:20 +01:00
Julius Pfrommer 5b7a3a14c3 Merge remote-tracking branch 'origin/1.1' into master 2020-11-15 23:18:48 +01:00
Julius Pfrommer f85adb7b55 refactor(plugin): Cosmetic improvement in ua_config_default.c 2020-11-07 15:25:52 +01:00
Julius Pfrommer 4026a665f7 refactor(arch): Network-layer takes the logger only at startup
This gives us more flexibility to configure the logger after the initial
config has been set up.
2020-11-07 15:25:52 +01:00
basyskom-jvoe bdf840f276 fix(plugin): Fix memory issues in the historical data plugins (#3992)
* Fix memory leak in UA_HistoryDataBackend_Memory

* Fix uninitialized memory in the default history data gathering plugin

After extending the memory block with realloc, the additional memory is
not initialized with null bytes.
2020-11-06 13:26:26 +01:00
basyskom-jvoe bdae55012d fix(core): PEM certificate handling for SecurityPolicy None (#3976)
If UA_ENABLE_ENCRYPTION_MBEDTLS is set, SecurityPolicy None will still
just copy the certificate data. If the input is PEM, the trailing null
byte is not added and mbedTLS will fail to parse the data.
This breaks the application URI check on server start.

In case of UA_ENABLE_ENCRYPTION_OPENSSL, there is a similar problem
if the PEM data is just copied into the local certificate byte string.
2020-10-28 15:48:07 +01:00
Julius Pfrommer 7e6c6c97f6 refactor(pubsub): Sane include order for PubSub definitions
The plugin header is freestanding. The server_pubsub.h adds definitions
on top of server.h.
2020-10-22 14:38:05 +02:00
Julius Pfrommer c203430d16 refactor(plugins): Use _clear instead of _deleteMembers 2020-10-18 15:21:40 +02:00
Julius Pfrommer ad610bea77 refactor(server): Remove AccessControl indirection
Today we have access to the server config. Directly use that instead.
2020-10-18 15:21:40 +02:00
Julius Pfrommer b23ebe5a4f fix(plugin): Fix double-cleanup of the hashmap nodestore 2020-10-13 08:39:14 +02:00
Martin Lang b26c8d1998 fix(core): Remove double ";" at end of line (#3938) 2020-10-06 10:47:07 +02:00
Julius Pfrommer e7b15e06b3 refactor(arch): Simplify client networking API
Accept const loggers. Don't forward pointer to the client.
2020-10-04 10:39:23 +02:00
demike 5dea0e3898 feat(core): Add support for WebSocket Secure (wss) (#3779)
* fix: websocket not disconnecting

* feat: allow official opcua proto opcua+uacp/+json

* fix: disable opcua+json protocol for now

* feat: initial commit

* feat: add wss support + example

* fix: wrong condition + memory leak

* fix: typo
2020-09-13 11:25:43 +02:00
basyskom-jvoe e941fc23b0 fix(plugin): Fix crash in OpenSSL security policy clear on Windows (MinGW) (#3876) 2020-09-09 11:26:52 +02:00
Suriya Narayanan Parthasarathi Vimala 227352823b fix(pubsub): Handle multiple receive handling in XDP
- XDP plugin modified to support multiple receive handling

Signed-off-by: Suriya Narayanan Parthasarathi Vimala <suriyanarayanan.pv@kalycito.com>
Change-Id: Ic780109cac051218c30a2d5268864132f66ea32c

Signed-off-by: Keerthivasan Alagarsamy Senthilkumaran <keerthivasan.as@kalycito.com>
Change-Id: I3f11ce0bd453b10cb7a10e1195206be830d54c07
2020-08-28 14:16:37 +02:00
Keerthivasan Alagarsamy Senthilkumaran 5450352dfa fix(PubSub): UDP plugin file handling
- For Multiple receive implementation
 - Tested using tutorial pubsub
 - Unit test cases for multiple receive

Signed-off-by: Keerthivasan Alagarsamy Senthilkumaran <keerthivasan.as@kalycito.com>
Change-Id: I0164487f4c6ae03cf910c970847e6314dd21491a
2020-08-28 14:16:37 +02:00
Keerthivasan Alagarsamy Senthilkumaran 10fcfa2a98 fix(PubSub): Multiple receive message handling
- Handled multiple receive message for
   ua_pubsub_ethernet_etf.c
 - Handle for other plugins
   and example files
 - Memory bug fix and added missed files
 - Fix bugs for multiple receive
 - Handled for ua_pubsub_ethernet.c
 - Address review comments

Signed-off-by: Keerthivasan Alagarsamy Senthilkumaran <keerthivasan.as@kalycito.com>
Change-Id: I734c52862ea30960ee0d32b2860d78a64bda6884
2020-08-28 14:16:37 +02:00
Keerthivasan Alagarsamy Senthilkumaran d11b2ee5d0 feat(PubSub): Implementation for 802.3 packets
- Handled send and receive api of ethernet
   for 802.3 packets

Signed-off-by: Keerthivasan Alagarsamy Senthilkumaran <keerthivasan.as@kalycito.com>
Change-Id: I4f9edb91839836ebe8c3ff64b07f91ca85c56706
2020-08-28 14:16:37 +02:00
cochicde c1a4397e4e fix(server): Fix memleak in node management uncovered by malloc instrumentation (#3859) 2020-08-27 19:06:03 +02:00
basyskom-jvoe 4492548ee3 fix(plugin): Improve PEM support for mbedTLS and add tests (#3856)
* Add null terminator before parsing certificates and keys

mbedTLS expects PEM data to be null terminated, the length
parameter must include the null terminator.

By adding the null terminator inside open62541, an application
doesn't have to care what type of certificate or key is used.

* Extend encryption tests

- Add test for security policy Basic256
- Add test with PEM encoded certificate and key

* Fix amalgamation build for ua_pki_default.c

Including securitypolicy_mbedtls_common.h is not possible because
it is added to the amalgamation after ua_pki_default.c
2020-08-27 17:23:47 +02:00
cochicde 46a618acfb refactor(server): Reset the original configuration in UA_Server_newWithConfig 2020-08-24 18:25:49 +02:00
Julius Pfrommer 3b88100d3d feat(server): Implement TransferSubscriptions service 2020-08-24 18:24:52 +02:00
basyskom-jvoe b9d897ce63 feat(plugin): Add support for PEM encoded local certificates (#3854) 2020-08-20 17:07:41 +02:00
cochicde ee275e7931 [Review] fix(leak): Fix memory leaks from config_default (#3852)
* Fix memory leaks from config_default

* Call the right function to delete the hashMap
2020-08-19 19:10:27 +02:00
basyskom-jvoe 46a9c0671c feat(plugin): OpenSSL PEM support (#3846)
* Add PEM support for the OpenSSL plugins

PEM is permitted for
- Private key
- CRL
- Trusted certificates
- Issuer certificates

* OpenSSL: Load the private key in a central place in the security policies

This is a preparation for the support of password protected private keys.
2020-08-19 16:37:51 +02:00