No description
  • C 93.9%
  • Makefile 1.9%
  • CMake 1.9%
  • Perl 1.6%
  • M4 0.6%
Find a file
Achim Kraus 6f4f6045e9
Some checks are pending
Build Tests / build-linux-autotools (clang) (push) Waiting to run
Build Tests / build-linux-autotools (gcc) (push) Waiting to run
Build Tests / Build for Linux using CMake (push) Waiting to run
Build Tests / Build for macOS using CMake (push) Waiting to run
Build Tests / Build for Windows using CMake (push) Waiting to run
Remove double DEL_PEER.
Fixes issue #269

Signed-off-by: Achim Kraus <achim.kraus@cloudcoap.net>
2026-05-29 08:40:56 +02:00
.github/workflows CMake: Force all Warnings to Errors when doing github actions 2022-09-28 13:53:04 +02:00
aes github: Add in build and test workflow 2022-08-08 09:55:21 +02:00
doc doc/Makefile.in: Update Doxyfile to latest version before use 2026-03-18 15:51:53 +01:00
ecc Add Windows support 2022-09-27 14:31:54 +02:00
platform-specific Fix includes for zephyr 3.2.99. 2023-08-07 14:55:38 +02:00
sha2 CMake: Force all Warnings to Errors when doing github actions 2022-09-28 13:53:04 +02:00
tests sigint: Handle SIGINT cleanups cleanly 2025-01-18 14:03:21 +01:00
zephyr Fix cmake warnings of zephyr builds. 2022-09-28 14:27:46 +02:00
.gitignore Add Windows support 2022-09-27 14:31:54 +02:00
ABOUT.md New initial commit 2016-02-02 18:39:21 +01:00
alert.h dtls.c: remove rudiments of renegotiation. 2023-07-12 16:53:27 +02:00
AutoConf.cmake dtls_prng_posix.c: fail for posix without HAVE_GETRANDOM nor 2023-02-25 14:34:25 +01:00
autogen.sh autogen.sh: add tinydtls.pc 2022-01-14 18:16:10 +01:00
ccm.c ccm.c: Remove documentation erroneous return statement for void function 2023-07-12 11:31:12 +02:00
ccm.h doc: Correct Doxygen information 2022-10-05 11:00:50 +02:00
CMakeLists.txt Fix MSVC compilation (CMake-based) 2025-10-07 09:14:43 +02:00
configure.ac dtls_prng_posix.c: fail for posix without HAVE_GETRANDOM nor 2023-02-25 14:34:25 +01:00
CONTRIBUTING.md Amend source formatting with rule for function definitions with multiple 2023-04-24 13:21:08 +02:00
crypto.c crypto.c: Support -O3 compiler builds 2023-09-13 12:56:29 +02:00
crypto.h crypto.h: use DTLS_EC_KEY_SIZE for dtls_handshake_parameters_ecdsa_t. 2024-08-27 18:39:35 +02:00
dtls.c Remove double DEL_PEER. 2026-05-29 08:40:56 +02:00
dtls.h dtls.c: add callback for peer specific selection of parameters as cipher 2023-04-17 14:07:10 +02:00
dtls_config.h.cmake.in dtls_prng_posix.c: fail for posix without HAVE_GETRANDOM nor 2023-02-25 14:34:25 +01:00
dtls_debug.c dtls_debug.c: only enable _GNU_SOURCE for MinGW builds. 2024-05-13 10:17:15 +01:00
dtls_debug.h dtls_debug.h: explicitly cast macro parameter to size_t. 2024-03-18 11:18:31 +00:00
dtls_mutex.h Add Windows support 2022-09-27 14:31:54 +02:00
dtls_prng.c LwIP: Support LwIP builds when NO_SYS = 1 2022-10-21 16:30:16 +02:00
dtls_prng.h doc: Correct Doxygen information 2022-10-05 11:00:50 +02:00
dtls_time.c LwIP: Support LwIP builds when NO_SYS = 1 2022-10-21 16:30:16 +02:00
dtls_time.h Fix includes for zephyr 3.2.99. 2023-08-07 14:55:38 +02:00
global.h dtls.c: add RFC5746 minimal version implementation. 2023-07-27 15:47:12 +02:00
hmac.c crypto: remove unnecessary usage of malloc()/dtls_hmac_new() 2022-05-23 10:29:01 +02:00
hmac.h crypto: remove unnecessary usage of malloc()/dtls_hmac_new() 2022-05-23 10:29:01 +02:00
LICENSE New initial commit 2016-02-02 18:39:21 +01:00
Makefile.in dtls_prng_posix.c: Fix random() only support 2023-04-24 11:31:29 +02:00
Makefile.riot RIOT: remove redundant CFLAGS 2023-01-21 11:13:28 +01:00
Makefile.tinydtls Separate out rijndael.c into primary and wrapper functions 2019-04-26 09:53:33 +01:00
netq.c Support zephyr. 2022-07-08 14:51:05 +02:00
netq.h dtls.c: Fix waiting without timeout in DTLS_STATE_CLOSING after Alert. 2022-02-25 15:34:31 +01:00
numeric.h New initial commit 2016-02-02 18:39:21 +01:00
peer.c peer.c: Include <string.h> to fix memcpy() warning 2023-07-27 13:28:15 +02:00
peer.h dtls.c: Check for optional handshake messages 2021-12-08 10:11:06 +01:00
README.md README.md: add some details and references. 2024-05-13 10:17:40 +01:00
session.c session.h: Move inclusion of string.h into .c files 2023-07-22 15:19:13 +02:00
session.h session.h: Support building with LwIP, but LWIP_IPV4 / LWIP_IPV6 not set 2025-11-19 20:58:54 +01:00
state.h Fix processing received records of wrong epoch. 2021-10-04 21:05:54 +02:00
tinydtls.h windows: move _CRT_RAND_S to tinydtls.h 2022-11-29 14:29:03 +01:00
tinydtls.pc.in autotools: Generate and install pkg-config file on build 2021-12-29 06:52:58 +01:00
uthash.h update to latest version of uthash 2017-12-08 11:50:57 +01:00
utlist.h update to latest version of uthash 2017-12-08 11:50:57 +01:00

About tinydtls

tinydtls is a library for Datagram Transport Layer Security (DTLS 1.2 RFC 6347) covering both the client and the server state machine. It is implemented in C and provides support for a minimal set of cipher suites suitable for the Internet of Things.

This library contains functions and structures that can help constructing a single-threaded UDP server with DTLS support in C99. The following components are available:

  • dtls Basic support for DTLS with pre-shared key mode and RPK mode with ECC.

  • tests The subdirectory tests contains test programs that show how each component is used.

BUILDING

tinydtls supports multiple platforms, including both Real-time and general-purpose Operating Systems. Below you find build instructions for all supported environments.

POSIX-oriented Operating Systems

When using the code from the git repository at GitHub, invoke

$ ./autogen.sh
$ ./configure

to re-create the configure script.

Contiki

On Contiki, place the tinydtls library into the apps folder. After configuration, invoke make to build the library and associated test programs. To add tinydtls as Contiki application, drop it into the apps directory and add the following line to your Makefile:

APPS += tinydtls/aes tinydtls/sha2 tinydtls/ecc tinydtls

RIOT

On RIOT, you need to add the line USEPKG += tinydtls. You can use RIOT/examples/dtls-echo/ as a guide for integrating tinyDTLS to your application.

Also, if you need a specific commit of tinyDTLS you can modify RIOT/pkg/tinydtls/Makefile.

CMake

The current cmake support is experimental. Don't hesitate to report issues and/or provided fixes for it. For general and more details on using CMake, please consider CMake - help.

Usage:

mkdir tinydtls_build
cd tinydtls_build
cmake -Dmake_tests=ON <path-to-tinydtls>
cmake --build .

Available options:

Option Description Default
BUILD_SHARED_LIBS build shared libraries instead of static link library OFF
make_tests build tests including the examples OFF
DTLS_ECC enable/disable ECDHE_ECDSA cipher suites ON
DTLS_PSK enable/disable PSK cipher suites ON

Windows

Using CMake, you can also build on and for Windows using either GCC or Visual Studio. Note, however, that the make_tests option is currently not supported when compiling with Visual Studio, as parts of the tests rely on POSIX APIs.

For Visual Studio, you can apply the CMake instructions outlined above from the command line or use the CMake GUI application.

In order to be able to use GCC, you need to specify a different generator than the default. For instance, you can use the Unix Makefiles generator, which creates a Makefile for controlling the build process using GCC. The example below leads to the output of a shared library file libtinydtls.dll.

cmake -G "Unix Makefiles" -DBUILD_SHARED_LIBS=ON .
make

Using MinGW64, you can also cross compile from a POSIX-oriented platform for Windows using Autotools by providing a corresponding --host argument:

./autogen.sh
./configure --host x86_64-w64-mingw32
make
mv libtinydtls.so libtinydtls.dll # Apply Windows file extension

Implemented Cipher Suites

Name ID RFC
TLS_PSK_WITH_AES_128_CCM 0xC0A4 RFC 6655
TLS_PSK_WITH_AES_128_CCM_8 0xC0A8 RFC 6655
TLS_ECDHE_ECDSA_WITH_AES_128_CCM 0xC0AC RFC 7251
TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8 0xC0AE RFC 7251

Supported TLS Extensions

Name RFC
Pre Shared Key (PSK) RFC 4279
TLS Renegotiation Indication (minimal version) RFC 5746
Raw Public Key (RPK) RFC 7250
Extended Master Secret RFC 7627
DTLS 1.2 Connection ID (client only, feature branch) RFC 9146

License

Copyright (c) 20112022 Olaf Bergmann (TZI) and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 which accompanies this distribution.

The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php.