Skip to content

Commit

Permalink
Enable TLS for WiFi WebSockets
Browse files Browse the repository at this point in the history
  • Loading branch information
martinjaeger committed Oct 2, 2023
1 parent 53985b4 commit 846b8af
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
working-directory: thingset-zephyr-sdk
run: |
west build -p -b olimex_lora_stm32wl_devkit samples/counter -- -DOVERLAY_CONFIG=lorawan.conf
west build -p -b esp32c3_devkitm samples/counter
west build -p -b esp32c3_devkitm samples/counter -- -DOVERLAY_CONFIG=ble.conf
west build -p -b esp32c3_devkitm samples/counter -- -DOVERLAY_CONFIG=wifi_websocket.conf
west build -p -b native_posix samples/counter
west build -p -b nucleo_l073rz samples/counter -- -DOVERLAY_CONFIG=serial.conf
Expand Down
13 changes: 0 additions & 13 deletions samples/counter/boards/esp32c3_devkitm.conf
Original file line number Diff line number Diff line change
@@ -1,19 +1,6 @@
# Copyright (c) The ThingSet Project Contributors
# SPDX-License-Identifier: Apache-2.0

CONFIG_BT=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_DEVICE_NAME="ThingSetNode"
CONFIG_BT_DEVICE_NAME_DYNAMIC=y
CONFIG_BT_GATT_CLIENT=y

# Increase buffer sizes to allow long ATT values
CONFIG_BT_BUF_ACL_RX_SIZE=251
CONFIG_BT_BUF_ACL_TX_SIZE=251
CONFIG_BT_L2CAP_TX_MTU=251

CONFIG_THINGSET_BLE=y

CONFIG_MPU_ALLOW_FLASH_WRITE=y
CONFIG_FLASH=y
CONFIG_FLASH_PAGE_LAYOUT=y
Expand Down
4 changes: 4 additions & 0 deletions samples/counter/boards/esp32c3_devkitm.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

&wifi {
status = "okay";
};
21 changes: 21 additions & 0 deletions samples/counter/wifi_websocket.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
# Below settings enable the shell for easier debugging of WiFi connection. Make sure to use
# different serial for ThingSet serial or enable CONFIG_THINGSET_SHELL.

# with larger size heap we can't fit mbedtls anymore
CONFIG_HEAP_MEM_POOL_SIZE=40960

CONFIG_EARLY_CONSOLE=y

CONFIG_NETWORKING=y
Expand All @@ -12,6 +15,8 @@ CONFIG_TEST_RANDOM_GENERATOR=y
CONFIG_NET_TX_STACK_SIZE=2048
CONFIG_NET_RX_STACK_SIZE=2048

CONFIG_NET_TCP_WORKQ_STACK_SIZE=4096

CONFIG_NET_PKT_RX_COUNT=10
CONFIG_NET_PKT_TX_COUNT=10
CONFIG_NET_BUF_RX_COUNT=20
Expand All @@ -36,6 +41,22 @@ CONFIG_NET_STATISTICS_PERIODIC_OUTPUT=n
CONFIG_WIFI=y
CONFIG_WIFI_LOG_LEVEL_ERR=y

# Sockets
CONFIG_NET_SOCKETS=y
CONFIG_NET_SOCKETS_POLL_MAX=4
CONFIG_NET_SOCKETS_SOCKOPT_TLS=y
CONFIG_NET_SOCKETS_TLS_MAX_CONTEXTS=6

# TLS configuration
CONFIG_MBEDTLS=y
CONFIG_MBEDTLS_BUILTIN=y
CONFIG_MBEDTLS_ENABLE_HEAP=y
CONFIG_MBEDTLS_HEAP_SIZE=40960
# 4096 was too small and the buffer ran full during testing
CONFIG_MBEDTLS_SSL_MAX_CONTENT_LEN=8192
# required for servers with reverse proxies
CONFIG_MBEDTLS_SERVER_NAME_INDICATION=y

# DNS
CONFIG_DNS_RESOLVER=y
CONFIG_DNS_RESOLVER_ADDITIONAL_BUF_CTR=5
Expand Down

0 comments on commit 846b8af

Please sign in to comment.