Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

coap: ensure DTLS buffer is at least 200 bytes #20434

Merged
merged 2 commits into from
Apr 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion sys/net/application_layer/gcoap/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ ifeq (2, $(words $(filter ipv4 ipv6, $(USEMODULE))))
endif

CONFIG_GCOAP_PDU_BUF_SIZE := $(or $(CONFIG_GCOAP_PDU_BUF_SIZE),128)
DTLS_MAX_BUF ?= ($(CONFIG_GCOAP_PDU_BUF_SIZE) + 36)
# the initial DTLS handshake may exceed the block size
DTLS_MAX_BUF ?= $(shell echo $$(((${CONFIG_GCOAP_PDU_BUF_SIZE} + 36) > 200 ? (${CONFIG_GCOAP_PDU_BUF_SIZE} + 36) : 200 )))
5 changes: 4 additions & 1 deletion sys/net/application_layer/nanocoap/Makefile.include
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
ifneq (,$(filter nanocoap_dtls,$(USEMODULE)))
CONFIG_NANOCOAP_BLOCKSIZE_DEFAULT := $(or $(CONFIG_NANOCOAP_BLOCKSIZE_DEFAULT),2)
DTLS_MAX_BUF ?= ((1 << ($(CONFIG_NANOCOAP_BLOCKSIZE_DEFAULT) + 3)) + 36)
NANOCOAP_BLOCK_FRAME := (1 << ($(CONFIG_NANOCOAP_BLOCKSIZE_DEFAULT) + 4)) + 36
NANOCOAP_BLOCK_FRAME := $(shell echo $$((${NANOCOAP_BLOCK_FRAME})))
# the initial DTLS handshake may exceed the block size
DTLS_MAX_BUF ?= $(shell echo $$((${NANOCOAP_BLOCK_FRAME} > 200 ? ${NANOCOAP_BLOCK_FRAME} : 200 )))
endif
Loading