crypto: config: config-coap: add CONFIG for setting max content length

The CoAP samples use an MBEDTLS config "config-coap.h" which could be
re-used by the LwM2M sample, except that most servers use a larger
maximum content length setting of 1500 bytes.

Let's add a CONFIG to set this for users of the CoAP lib and set the
CONFIG value for the samples to the 256 size currently used.

Signed-off-by: Michael Scott <michael@opensourcefoundries.com>
This commit is contained in:
Michael Scott 2017-12-04 21:55:16 -08:00 committed by Anas Nashif
parent 1d3c1150f0
commit 2fc554b8fc
4 changed files with 17 additions and 1 deletions

View File

@ -95,7 +95,11 @@
* both ends of the connection! (See comments in "mbedtls/ssl.h".)
* The optimal size here depends on the typical size of records.
*/
#define MBEDTLS_SSL_MAX_CONTENT_LEN 256
#ifndef CONFIG_COAP_MBEDTLS_SSL_MAX_CONTENT_LEN
#define MBEDTLS_SSL_MAX_CONTENT_LEN 1500
#else
#define MBEDTLS_SSL_MAX_CONTENT_LEN CONFIG_COAP_MBEDTLS_SSL_MAX_CONTENT_LEN
#endif
#include "mbedtls/check_config.h"

View File

@ -21,6 +21,7 @@ CONFIG_MBEDTLS_BUILTIN=y
CONFIG_MBEDTLS_CFG_FILE="config-coap.h"
CONFIG_COAP=y
CONFIG_COAP_MBEDTLS_SSL_MAX_CONTENT_LEN=256
CONFIG_NET_APP_SETTINGS=y
CONFIG_NET_APP_MY_IPV6_ADDR="2001:db8::3"

View File

@ -17,6 +17,7 @@ CONFIG_NET_IF_MCAST_IPV6_ADDR_COUNT=5
CONFIG_NET_MAX_CONTEXTS=10
CONFIG_COAP=y
CONFIG_COAP_MBEDTLS_SSL_MAX_CONTENT_LEN=256
CONFIG_MBEDTLS=y
CONFIG_MBEDTLS_BUILTIN=y

View File

@ -62,6 +62,16 @@ config COAP_EXTENDED_OPTIONS_LEN_VALUE
COAP_EXTENDED_OPTIONS_LEN is enabled. Define the value according to
user requirement.
config COAP_MBEDTLS_SSL_MAX_CONTENT_LEN
int "CoAP MBEDTLS maximum content length value"
default 1500
range 256 16384
depends on MBEDTLS
help
This option sets the value of the MBEDTLS_SSL_MAX_CONTENT_LEN option
in ext/lib/crypto/mbedtls/configs/config-coap.h For client/server
communication to work these values need to be the same on both sides.
config NET_DEBUG_COAP
bool "Debug COAP"
default n