1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

Merge pull request #20434 from benpicco/DTLS_MAX_BUF-fix

coap: ensure DTLS buffer is at least 200 bytes
This commit is contained in:
Teufelchen 2024-04-05 08:22:11 +00:00 committed by GitHub
commit b5f9772292
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 2 deletions

View File

@ -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 )))

View File

@ -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