Fix warnings during unit testing of BACnet secure connect node. (#1182)

This commit is contained in:
Steve Karg
2025-12-09 09:34:28 -06:00
committed by GitHub
parent b1c6a0e74b
commit 95cdec459e
39 changed files with 3206 additions and 36179 deletions
+13 -28
View File
@@ -24,7 +24,6 @@
#include <bacnet/datalink/bsc/bsc-hub-function.h>
unsigned char ca_key[] = {
/* certificate authority key for testing */
0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x42, 0x45, 0x47, 0x49, 0x4e, 0x20, 0x52,
0x53, 0x41, 0x20, 0x50, 0x52, 0x49, 0x56, 0x41, 0x54, 0x45, 0x20, 0x4b,
0x45, 0x59, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x0a, 0x4d, 0x49, 0x49, 0x45,
@@ -164,12 +163,10 @@ unsigned char ca_key[] = {
0x4d, 0x4e, 0x69, 0x6c, 0x49, 0x6a, 0x31, 0x6d, 0x71, 0x44, 0x4d, 0x3d,
0x0a, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x45, 0x4e, 0x44, 0x20, 0x52, 0x53,
0x41, 0x20, 0x50, 0x52, 0x49, 0x56, 0x41, 0x54, 0x45, 0x20, 0x4b, 0x45,
0x59, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x0a
0x59, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x0a,
};
/* clang-format off */
unsigned char ca_cert[] = {
/* certificate authority certificate for testing */
0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x42, 0x45, 0x47, 0x49, 0x4e, 0x20, 0x43,
0x45, 0x52, 0x54, 0x49, 0x46, 0x49, 0x43, 0x41, 0x54, 0x45, 0x2d, 0x2d,
0x2d, 0x2d, 0x2d, 0x0a, 0x4d, 0x49, 0x49, 0x44, 0x48, 0x44, 0x43, 0x43,
@@ -264,16 +261,13 @@ unsigned char ca_cert[] = {
0x48, 0x6d, 0x34, 0x53, 0x69, 0x64, 0x67, 0x4f, 0x78, 0x4c, 0x66, 0x31,
0x46, 0x78, 0x31, 0x64, 0x32, 0x76, 0x34, 0x3d, 0x0a, 0x2d, 0x2d, 0x2d,
0x2d, 0x2d, 0x45, 0x4e, 0x44, 0x20, 0x43, 0x45, 0x52, 0x54, 0x49, 0x46,
0x49, 0x43, 0x41, 0x54, 0x45, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x0a
0x49, 0x43, 0x41, 0x54, 0x45, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x0a,
#ifdef CONFIG_MBEDTLS
,
0x00
0x00,
#endif
};
/* clang-format on */
unsigned char client_key[] = {
/* client key for testing BACnet secure connect */
0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x42, 0x45, 0x47, 0x49, 0x4e, 0x20, 0x52,
0x53, 0x41, 0x20, 0x50, 0x52, 0x49, 0x56, 0x41, 0x54, 0x45, 0x20, 0x4b,
0x45, 0x59, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x0a, 0x4d, 0x49, 0x49, 0x4a,
@@ -544,11 +538,10 @@ unsigned char client_key[] = {
0x77, 0x4f, 0x49, 0x35, 0x52, 0x49, 0x2f, 0x78, 0x0a, 0x2d, 0x2d, 0x2d,
0x2d, 0x2d, 0x45, 0x4e, 0x44, 0x20, 0x52, 0x53, 0x41, 0x20, 0x50, 0x52,
0x49, 0x56, 0x41, 0x54, 0x45, 0x20, 0x4b, 0x45, 0x59, 0x2d, 0x2d, 0x2d,
0x2d, 0x2d, 0x0a
0x2d, 0x2d, 0x0a,
};
unsigned char client_key_der[] = {
/* client key for testing BACnet data-expecting-reply DER */
0x30, 0x82, 0x09, 0x29, 0x02, 0x01, 0x00, 0x02, 0x82, 0x02, 0x01, 0x00,
0xAF, 0x04, 0xB2, 0x36, 0x78, 0x5F, 0xBC, 0x38, 0x9C, 0x18, 0x93, 0x81,
0x7D, 0x44, 0x0B, 0x18, 0x4A, 0x4A, 0x0B, 0x6F, 0xCD, 0xDB, 0x94, 0xE8,
@@ -744,12 +737,10 @@ unsigned char client_key_der[] = {
0x72, 0xC7, 0x08, 0x2C, 0x2F, 0x1A, 0x88, 0x95, 0x45, 0x39, 0x26, 0x67,
0x36, 0x32, 0xBF, 0x7E, 0x5A, 0x2B, 0xC6, 0xD4, 0xCE, 0x0C, 0x3F, 0x48,
0x1B, 0x78, 0x07, 0x7F, 0x14, 0xD1, 0xD6, 0xC7, 0xDA, 0x2E, 0xFE, 0x73,
0x09, 0x07, 0xFD, 0xC0, 0xE2, 0x39, 0x44, 0x8F, 0xF1
0x09, 0x07, 0xFD, 0xC0, 0xE2, 0x39, 0x44, 0x8F, 0xF1,
};
/* clang-format off */
unsigned char client_cert[] = {
/* client certificate for testing BACnet secure connect */
0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x42, 0x45, 0x47, 0x49, 0x4e, 0x20, 0x43,
0x45, 0x52, 0x54, 0x49, 0x46, 0x49, 0x43, 0x41, 0x54, 0x45, 0x2d, 0x2d,
0x2d, 0x2d, 0x2d, 0x0a, 0x4d, 0x49, 0x49, 0x45, 0x47, 0x44, 0x43, 0x43,
@@ -873,17 +864,13 @@ unsigned char client_cert[] = {
0x53, 0x43, 0x55, 0x55, 0x61, 0x58, 0x5a, 0x73, 0x2f, 0x2b, 0x51, 0x41,
0x3d, 0x0a, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x45, 0x4e, 0x44, 0x20, 0x43,
0x45, 0x52, 0x54, 0x49, 0x46, 0x49, 0x43, 0x41, 0x54, 0x45, 0x2d, 0x2d,
0x2d, 0x2d, 0x2d, 0x0a
0x2d, 0x2d, 0x2d, 0x0a,
#ifdef CONFIG_MBEDTLS
,
0x00
0x00,
#endif
};
/* clang-format on */
/* clang-format off */
unsigned char server_key[] = {
/* server key for testing BACnet secure connect */
0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x42, 0x45, 0x47, 0x49, 0x4e, 0x20, 0x52,
0x53, 0x41, 0x20, 0x50, 0x52, 0x49, 0x56, 0x41, 0x54, 0x45, 0x20, 0x4b,
0x45, 0x59, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x0a, 0x4d, 0x49, 0x49, 0x4a,
@@ -1154,16 +1141,12 @@ unsigned char server_key[] = {
0x68, 0x69, 0x61, 0x51, 0x34, 0x69, 0x67, 0x3d, 0x0a, 0x2d, 0x2d, 0x2d,
0x2d, 0x2d, 0x45, 0x4e, 0x44, 0x20, 0x52, 0x53, 0x41, 0x20, 0x50, 0x52,
0x49, 0x56, 0x41, 0x54, 0x45, 0x20, 0x4b, 0x45, 0x59, 0x2d, 0x2d, 0x2d,
0x2d, 0x2d, 0x0a
0x2d, 0x2d, 0x0a,
#ifdef CONFIG_MBEDTLS
, 0x00
0x00,
#endif
};
/* clang-format on */
/* clang-format off */
unsigned char server_cert[] = {
/* server certificate for testing BACnet secure connect */
0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x42, 0x45, 0x47, 0x49, 0x4e, 0x20, 0x43,
0x45, 0x52, 0x54, 0x49, 0x46, 0x49, 0x43, 0x41, 0x54, 0x45, 0x2d, 0x2d,
0x2d, 0x2d, 0x2d, 0x0a, 0x4d, 0x49, 0x49, 0x45, 0x47, 0x7a, 0x43, 0x43,
@@ -1287,9 +1270,9 @@ unsigned char server_cert[] = {
0x67, 0x4c, 0x31, 0x4a, 0x59, 0x58, 0x5a, 0x37, 0x45, 0x4a, 0x39, 0x79,
0x6a, 0x50, 0x64, 0x77, 0x3d, 0x0a, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x45,
0x4e, 0x44, 0x20, 0x43, 0x45, 0x52, 0x54, 0x49, 0x46, 0x49, 0x43, 0x41,
0x54, 0x45, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x0a
0x54, 0x45, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x0a,
#ifdef CONFIG_MBEDTLS
, 0x00
0x00,
#endif
};
/* clang-format on */
@@ -2329,6 +2312,7 @@ static void test_hub_function_duplicated_uuid(void)
static void *suite_setup(void)
{
setbuf(stdout, NULL);
lws_set_log_level(0, NULL);
return NULL;
}
@@ -2344,6 +2328,7 @@ ZTEST_SUITE(hub_test_8, NULL, suite_setup, NULL, NULL, NULL);
void test_main(void)
{
// setbuf(stdout, NULL);
lws_set_log_level(0, NULL);
// Tests must not be run in parallel threads!
// Thats why tests functions are in different suites.
ztest_test_suite(