1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 01:09:47 +01:00
RIOT/examples/dtls-echo
2024-07-29 11:45:58 +02:00
..
dtls-client.c examples: Use size_t print format specifier 2023-12-21 12:02:34 +01:00
dtls-server.c treewide: remove THREAD_CREATE_STACKTEST from thread creation 2024-07-29 11:45:58 +02:00
main.c treewide: Remove excessive newlines 2021-08-13 19:50:38 +02:00
Makefile examples,tests: replace deprecated module names by new names 2022-09-16 13:15:46 +02:00
Makefile.ci boards/weact-g030f6: add new board 2024-02-05 00:45:42 +01:00
README.md pkg/tinydtls: Move configurations to 'CONFIG_' namespace 2020-03-05 19:11:38 +01:00
tinydtls_keys.h pkg/tinydtls: Move configurations to 'CONFIG_' namespace 2020-03-05 19:11:38 +01:00

dtls_echo example

This example shows how to use TinyDTLS with sock_udp.

SOCK vs. Socket

This example is configured to use socks instead of sockets (over GNRC). It's possible to use sockets, which give a more similar approach to the original Linux version of TinyDTLS. However, this is not tested yet.

Fast configuration (Between RIOT instances):

Preparing the logical interfaces:

sudo ./../../dist/tools/tapsetup/tapsetup --create 2

For the server instance:

make all; PORT=tap1 make term
dtlss start
ifconfig

Do not forget to copy the IPv6 addresses!

For the client:

PORT=tap0 make term
dtlsc <IPv6's server address[%netif]> "DATA to send under encrypted channel!"

Testings

Boards

Boards that do not support the ../gnrc_networking example are included in the BOARD_INSUFFICIENT_MEMORY, plus the board cc2650stk.

The code has been tested in the FIT IOT-LAB tesbed with the remote iotlab-m3 and iotlab-a8-m3 boards and with local samr21-xpro boards.

Handling the static memory allocation

TinyDTLS for RIOT is using the sys/memarray module and therefore there are certain limits. Said resources are defined in tinydtls/platform-specific/riot_boards.h, but can be overwritten at compile time. Their default values are considered for having two DTLS contexts (for purpose of DTLS renegotiation).

The resources handled by memarray are:

  • CONFIG_DTLS_CONTEXT_MAX (default 2) The maximum number of DTLS context at the same time.
  • CONFIG_DTLS_PEER_MAX (default 1) The maximum number DTLS peers (i.e. sessions).
  • CONFIG_DTLS_HANDSHAKE_MAX (default 1) The maximum number of concurrent DTLS handshakes.
  • DTLS_SECURITY_MAX (the sum of the previous two) The maximum number of concurrently used cipher keys.
  • DTLS_HASH_MAX (Default: 3 * CONFIG_DTLS_PEER_MAX) The maximum number of hash functions that can be used in parallel.

Handling retransmissions

By default, the number of transmissions of any DTLS record is settled to just one. This can be handled by DTLS_DEFAULT_MAX_RETRANSMIT (defined in tinydtls/platform-specific/riot_boards.h).