From 1f365c940232f6644f9b13cdf7d1ca682ee70db7 Mon Sep 17 00:00:00 2001 From: Jan Masek Date: Tue, 30 Sep 2025 09:06:49 +0200 Subject: [PATCH] testing stm32 chip dico l475 iot1 --- .../samples/logs/boards/disco_l475_iot1.conf | 16 ++++++ zephyr/samples/logs/prj.conf | 18 +++++++ zephyr/src/net/spotflow_certs.h | 49 +++++++++++++++++++ zephyr/src/net/spotflow_tls.c | 9 ++-- 4 files changed, 88 insertions(+), 4 deletions(-) create mode 100644 zephyr/samples/logs/boards/disco_l475_iot1.conf diff --git a/zephyr/samples/logs/boards/disco_l475_iot1.conf b/zephyr/samples/logs/boards/disco_l475_iot1.conf new file mode 100644 index 00000000..958be88e --- /dev/null +++ b/zephyr/samples/logs/boards/disco_l475_iot1.conf @@ -0,0 +1,16 @@ +## disco_l475_iot1 +CONFIG_WIFI_ESWIFI=y +CONFIG_TLS_CREDENTIALS=y + +#CONFIG_MAIN_STACK_SIZE=1024 +#CONFIG_IDLE_STACK_SIZE=256 +#CONFIG_ISR_STACK_SIZE=1024 +#CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=1024 + +CONFIG_MBEDTLS_HEAP_SIZE=16384 +CONFIG_WIFI_LOG_LEVEL_DBG=y +#CONFIG_NET_LOG_LEVEL_DBG=y +CONFIG_NET_PKT_LOG_LEVEL_DBG=y + +#CONFIG_LOG +CONFIG_LOG_MODE_IMMEDIATE=y diff --git a/zephyr/samples/logs/prj.conf b/zephyr/samples/logs/prj.conf index 438f80b3..d58a1c8a 100644 --- a/zephyr/samples/logs/prj.conf +++ b/zephyr/samples/logs/prj.conf @@ -28,3 +28,21 @@ CONFIG_WIFI=y CONFIG_WIFI_NM=y CONFIG_NET_L2_WIFI_MGMT=y +#CONFIG_NETWORKING=y +#CONFIG_NET_IPV4=y +#CONFIG_NET_IPV6=y +#CONFIG_NET_IF_MAX_IPV6_COUNT=3 +CONFIG_NET_IF_MAX_IPV4_COUNT=3 +#CONFIG_NET_DHCPV4=y +CONFIG_NET_SOCKETS=y +CONFIG_POSIX_API=y +#CONFIG_NET_TCP=y +#CONFIG_NET_UDP=y +#CONFIG_NET_L2_WIFI_MGMT=y +CONFIG_NET_TX_STACK_SIZE=2048 +CONFIG_NET_RX_STACK_SIZE=2048 +CONFIG_NET_BUF_RX_COUNT=20 +CONFIG_NET_BUF_TX_COUNT=20 +CONFIG_NET_PKT_RX_COUNT=16 +CONFIG_NET_PKT_TX_COUNT=16 +CONFIG_NET_LOG=y diff --git a/zephyr/src/net/spotflow_certs.h b/zephyr/src/net/spotflow_certs.h index 884276b1..98336346 100644 --- a/zephyr/src/net/spotflow_certs.h +++ b/zephyr/src/net/spotflow_certs.h @@ -111,6 +111,55 @@ unsigned char spotflow_isrgrootx1_der[] = { 0xa2, 0xcd, 0x40, 0x9d, 0x7e, 0x62, 0x22, 0xda, 0xde, 0x18, 0x27 }; +unsigned char spotflow_isrg_root_x2_der[] = { + 0x30, 0x82, 0x02, 0x1b, 0x30, 0x82, 0x01, 0xa1, 0xa0, 0x03, 0x02, 0x01, + 0x02, 0x02, 0x10, 0x41, 0xd2, 0x9d, 0xd1, 0x72, 0xea, 0xee, 0xa7, 0x80, + 0xc1, 0x2c, 0x6c, 0xe9, 0x2f, 0x87, 0x52, 0x30, 0x0a, 0x06, 0x08, 0x2a, + 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x03, 0x30, 0x4f, 0x31, 0x0b, 0x30, + 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x29, + 0x30, 0x27, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x13, 0x20, 0x49, 0x6e, 0x74, + 0x65, 0x72, 0x6e, 0x65, 0x74, 0x20, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, + 0x74, 0x79, 0x20, 0x52, 0x65, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x20, + 0x47, 0x72, 0x6f, 0x75, 0x70, 0x31, 0x15, 0x30, 0x13, 0x06, 0x03, 0x55, + 0x04, 0x03, 0x13, 0x0c, 0x49, 0x53, 0x52, 0x47, 0x20, 0x52, 0x6f, 0x6f, + 0x74, 0x20, 0x58, 0x32, 0x30, 0x1e, 0x17, 0x0d, 0x32, 0x30, 0x30, 0x39, + 0x30, 0x34, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a, 0x17, 0x0d, 0x34, + 0x30, 0x30, 0x39, 0x31, 0x37, 0x31, 0x36, 0x30, 0x30, 0x30, 0x30, 0x5a, + 0x30, 0x4f, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, + 0x02, 0x55, 0x53, 0x31, 0x29, 0x30, 0x27, 0x06, 0x03, 0x55, 0x04, 0x0a, + 0x13, 0x20, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x20, 0x53, + 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x20, 0x52, 0x65, 0x73, 0x65, + 0x61, 0x72, 0x63, 0x68, 0x20, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x31, 0x15, + 0x30, 0x13, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x0c, 0x49, 0x53, 0x52, + 0x47, 0x20, 0x52, 0x6f, 0x6f, 0x74, 0x20, 0x58, 0x32, 0x30, 0x76, 0x30, + 0x10, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02, 0x01, 0x06, 0x05, + 0x2b, 0x81, 0x04, 0x00, 0x22, 0x03, 0x62, 0x00, 0x04, 0xcd, 0x9b, 0xd5, + 0x9f, 0x80, 0x83, 0x0a, 0xec, 0x09, 0x4a, 0xf3, 0x16, 0x4a, 0x3e, 0x5c, + 0xcf, 0x77, 0xac, 0xde, 0x67, 0x05, 0x0d, 0x1d, 0x07, 0xb6, 0xdc, 0x16, + 0xfb, 0x5a, 0x8b, 0x14, 0xdb, 0xe2, 0x71, 0x60, 0xc4, 0xba, 0x45, 0x95, + 0x11, 0x89, 0x8e, 0xea, 0x06, 0xdf, 0xf7, 0x2a, 0x16, 0x1c, 0xa4, 0xb9, + 0xc5, 0xc5, 0x32, 0xe0, 0x03, 0xe0, 0x1e, 0x82, 0x18, 0x38, 0x8b, 0xd7, + 0x45, 0xd8, 0x0a, 0x6a, 0x6e, 0xe6, 0x00, 0x77, 0xfb, 0x02, 0x51, 0x7d, + 0x22, 0xd8, 0x0a, 0x6e, 0x9a, 0x5b, 0x77, 0xdf, 0xf0, 0xfa, 0x41, 0xec, + 0x39, 0xdc, 0x75, 0xca, 0x68, 0x07, 0x0c, 0x1f, 0xea, 0xa3, 0x42, 0x30, + 0x40, 0x30, 0x0e, 0x06, 0x03, 0x55, 0x1d, 0x0f, 0x01, 0x01, 0xff, 0x04, + 0x04, 0x03, 0x02, 0x01, 0x06, 0x30, 0x0f, 0x06, 0x03, 0x55, 0x1d, 0x13, + 0x01, 0x01, 0xff, 0x04, 0x05, 0x30, 0x03, 0x01, 0x01, 0xff, 0x30, 0x1d, + 0x06, 0x03, 0x55, 0x1d, 0x0e, 0x04, 0x16, 0x04, 0x14, 0x7c, 0x42, 0x96, + 0xae, 0xde, 0x4b, 0x48, 0x3b, 0xfa, 0x92, 0xf8, 0x9e, 0x8c, 0xcf, 0x6d, + 0x8b, 0xa9, 0x72, 0x37, 0x95, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, + 0xce, 0x3d, 0x04, 0x03, 0x03, 0x03, 0x68, 0x00, 0x30, 0x65, 0x02, 0x30, + 0x7b, 0x79, 0x4e, 0x46, 0x50, 0x84, 0xc2, 0x44, 0x87, 0x46, 0x1b, 0x45, + 0x70, 0xff, 0x58, 0x99, 0xde, 0xf4, 0xfd, 0xa4, 0xd2, 0x55, 0xa6, 0x20, + 0x2d, 0x74, 0xd6, 0x34, 0xbc, 0x41, 0xa3, 0x50, 0x5f, 0x01, 0x27, 0x56, + 0xb4, 0xbe, 0x27, 0x75, 0x06, 0xaf, 0x12, 0x2e, 0x75, 0x98, 0x8d, 0xfc, + 0x02, 0x31, 0x00, 0x8b, 0xf5, 0x77, 0x6c, 0xd4, 0xc8, 0x65, 0xaa, 0xe0, + 0x0b, 0x2c, 0xee, 0x14, 0x9d, 0x27, 0x37, 0xa4, 0xf9, 0x53, 0xa5, 0x51, + 0xe4, 0x29, 0x83, 0xd7, 0xf8, 0x90, 0x31, 0x5b, 0x42, 0x9f, 0x0a, 0xf5, + 0xfe, 0xae, 0x00, 0x68, 0xe7, 0x8c, 0x49, 0x0f, 0xb6, 0x6f, 0x5b, 0x5b, + 0x15, 0xf2, 0xe7 +}; + #ifdef __cplusplus } #endif diff --git a/zephyr/src/net/spotflow_tls.c b/zephyr/src/net/spotflow_tls.c index a8478110..75d95423 100644 --- a/zephyr/src/net/spotflow_tls.c +++ b/zephyr/src/net/spotflow_tls.c @@ -14,16 +14,17 @@ static sec_tag_t m_sec_tags[] = { APP_CA_ISGROOTX1_CERT_TAG }; void spotflow_tls_configure(const char* hostname, struct mqtt_sec_config* tls_config) { - tls_config->peer_verify = TLS_PEER_VERIFY_REQUIRED; - tls_config->cipher_list = NULL; - tls_config->sec_tag_list = m_sec_tags; - tls_config->sec_tag_count = ARRAY_SIZE(m_sec_tags); + tls_config->peer_verify = TLS_PEER_VERIFY_NONE; + // tls_config->cipher_list = NULL; + // tls_config->sec_tag_list = m_sec_tags; + // tls_config->sec_tag_count = ARRAY_SIZE(m_sec_tags); tls_config->hostname = hostname; } int spotflow_tls_init(void) { LOG_DBG("TLS init"); + return 0; int err = tls_certificate_add(spotflow_isrgrootx1_der, sizeof(spotflow_isrgrootx1_der), APP_CA_ISGROOTX1_CERT_TAG); if (err < 0) {