Fixed BACnet/SC secure connect VMAC, UUID, and initialization sequence (#1142)
* Refactored the BACnet/SC datalink initialization order by moving certificate file checks and hub connection registration to occur after datalink initialization * Replaced stdlib rand() with platform-specific cryptographically secure random functions (RtlGenRandom for Windows, getrandom for Linux, arc4random_buf for BSD) to generate UUID and VMAC addresses, preventing duplicates that broke connections * Enabled conditional debug output in BACnet/SC components when BUILD=debug is specified
This commit is contained in:
@@ -35,6 +35,7 @@ add_compile_definitions(
|
||||
BACNET_SC_DIRECT_ACCEPT_URI_MAX=6
|
||||
MAX_TSM_TRANSACTIONS=0
|
||||
BSC_CONF_TX_PRE=0
|
||||
BACFILE=1
|
||||
)
|
||||
|
||||
include_directories(
|
||||
|
||||
@@ -10169,7 +10169,7 @@ static void test_sc_datalink(void)
|
||||
|
||||
init_node_ev(&node_ev2);
|
||||
init_node_ev(&node_ev3);
|
||||
zassert_equal(bsc_cert_files_check(), true, NULL);
|
||||
zassert_equal(bsc_cert_files_check(SC_DATALINK_INSTANCE), true, NULL);
|
||||
zassert_equal(bsc_init(NULL), true, NULL);
|
||||
zassert_equal(bsc_init(NULL), false, NULL);
|
||||
memset(broadcast, 0xFF, sizeof(broadcast));
|
||||
@@ -10432,7 +10432,7 @@ static void test_sc_datalink_properties(void)
|
||||
init_node_ev(&node_ev2);
|
||||
init_node_ev(&node_ev3);
|
||||
init_node_ev(&node_ev4);
|
||||
zassert_equal(bsc_cert_files_check(), true, NULL);
|
||||
zassert_equal(bsc_cert_files_check(SC_DATALINK_INSTANCE), true, NULL);
|
||||
zassert_equal(bsc_init(NULL), true, NULL);
|
||||
|
||||
conf2.ca_cert_chain = ca_cert;
|
||||
|
||||
Reference in New Issue
Block a user