Commit Graph
738 Commits
Author SHA1 Message Date
Jon Shallow 892aa2036f Ubuntu 26.04.1: Fix scan-build warnings
Getting ready for CI builds using Ubuntu 26.04.
2026-10-14 10:49:16 +01:00
Jon Shallow c3b6709029 RIOT: Fix example server build against latest RIOT code 2026-10-14 10:29:01 +01:00
Jon Shallow 75a532c1f7 Ubuntu 26.04.1: Fix new compiler warnings
Update pre-commit versions as well.
2026-10-02 12:38:54 +01:00
Jon Shallow dad3028d6f Zephyr: Make it easier to change Zephyr base branch 2026-09-28 17:19:51 +01:00
Jon Shallow 79e52246d6 Contiki-NG: Update to release/v5.2 2026-09-23 15:04:23 +01:00
Jon Shallow 2b1ec9f270 coap-client: Always define a token when doing a subscribe
Some servers insist there being a token when a subscription
Observe is initiated.
2026-09-22 20:27:57 +01:00
Jon Shallow 93694e6c24 RIOT: Add in TCP support
Need to make use of LwIP interface for TCP.
2026-09-16 15:03:45 +02:00
Jon Shallow fcbd803828 Q-Block: Better recovery for lossy networks
Following the principles laid out in RFC9177.
2026-09-02 08:50:49 +01:00
Jon Shallow 9cb8f45f4f PSK: Support keys in hex notation in matching files
coap-server options
-i match_identiity_file
-s match_psk_sni_file

coap-client option
-h match_hint_file
2026-09-01 11:29:49 +01:00
Jon Shallow 850748ca14 Recovery: Support dropping incoming packets for testing 2026-08-20 09:56:09 +01:00
Jon Shallow dfd55459d7 NoTLS: Use SHA1 for digest computations
Removed:
include/coap3/coap_hashkey_internal.h
src/coap_hashkey.c
2026-08-15 15:20:12 +01:00
Jon Shallow 98805f70a5 Documentation tidy up
Add in codespell to pre-commit to help fix documentation errors.
2026-08-08 12:05:03 +01:00
Jon Shallow 1394e9833d CI: Cache Contiki/LwIP/Zephyr downloads 2026-08-06 09:55:09 +01:00
Jon Shallow 7cdc58da69 RIOT: Update Makefile.ci for supported boards 2026-07-30 12:51:48 +01:00
Jon Shallow c056e91ddb tls_backend_testcases.sh: Fix 2.05 code matching time in error 2026-07-25 13:08:46 +01:00
Jon Shallow 54537a38c5 Typos: Fix documentation typos
Includes minor code tidy up.
2026-07-25 12:49:31 +01:00
Jon Shallow 0befa05f48 RIOT: Code tidy following review 2026-07-21 12:30:28 +01:00
Jon Shallow 94bacc8939 Duplicate MIDs: If repeat MID request, send back previous response
Clean up duplicate MID handling, and just send back last response if MID
matches.

Removed COAP_BLOCK_CACHE_RESPONSE as no longer required for duplicate MID
handling, and so no need to send an Empty ACK response for a subsequent
Separate response as a referenced copy of the last PDU respponse is now kept
for a session.

Note that if a request is sent by a proxy to an upstream server, this always
converts the upstream server's response into a Separate response back to the
client as the upstream server may take time to respond, do any error recovery
etc.
2026-07-14 09:56:34 +01:00
Jon Shallow 72978e9fc6 PKI: Add in PKI wildcard and multiple SANs support 2026-07-11 10:28:31 +01:00
Jon Shallow ec038499d8 TinyDTLS: Update to the latest version 2026-07-10 15:11:48 +01:00
Jon Shallow 34b1d8c167 coap-server.c: Remove default hint for PSK
This allows (D)TLS1.3 to be negotiated when using PSK.

If '-i match_identity_file' is being used, the hint is taken from the first
entry if not otherwise defined by '-h hint'.
2026-07-09 15:39:29 +01:00
Jon Shallow f2d301e9c5 TLS: Fix interoperability issues raised by examples/tls_backend_testcases.sh 2026-06-30 12:32:36 +01:00
tlhc 2bea51aaf5 coap_openhitls.c: prefer SAN before CN for certificate names 2026-06-29 11:32:03 +01:00
Jon Shallow 6c5a0bcb4f TLS: Support client checking sent SNI to received server's PKI CN
For coap-client, if either -R or -C options are specified, then allowing
self-signed certificates is now disabled.
2026-06-27 12:20:00 +01:00
tlhc aa68d5f7e3 feat: add openHiTLS backend support
- Add openHiTLS DTLS/TLS backend
- Integrate openHiTLS crypto into libcoap (D)TLS and OSCORE paths.
- Extend TLS tests and add interop validation script.
2026-06-27 11:18:22 +01:00
Dmytro Bagrii 77b4714604 examples: server: Fix const qualifier discard
Compiling with gcc-16.1.1 and glibc-2.43 yields warnings: "initialization
discards ‘const’ qualifier from pointer target type".

Indeed, pointer passed to strchr() is `const char *` and memory pointed by
return value of strchr() is never modified, so variable to assign return
value should be `const char *`.
2026-06-22 09:57:21 +01:00
Jon Shallow 46e505c430 OSCORE: Support using MbedTLS for OSCORE only (not (D)TLS)
New ./configure option

 --with-mbedtls-oscore

If --disable-dtls is set, then MbedTLS is used as the OSCORE backend, otherwise
the MbedTLS library is used for both (D)TLS and OSCORE.

New cmake option

 -DOSCORE_BACKEND=mbedtls

If -DENABLE_DTLS=OFF is set, then MbedTLS is used as the OSCORE backend, otherwise
the MbedTLS library is used for both (D)TLS and OSCORE.

New Zephyr option

 config MBEDTLS_OSCORE

If set to y and CONFIG_LIBCOAP_OSCORE_SUPPORT is set to y, then the Zephyr MbedTLS
backend will get used for the OSCORE backend (no (D)TLS).
2026-06-10 11:56:44 +01:00
Jon Shallow 7370fcf6ad LwIP: Add in support for MEM_USE_POOLS for COAP_STRING malloc()s
If both MEMP_USE_CUSTOM_POOLS and MEM_USE_POOLS are defined in
lwipopts.h and there is a suitable
LWIP_MALLOC_MEMPOOL_START .. LWIP_MALLOC_MEMPOOL_END
definition in lwippools.h, then any coap_malloc_type(COAP_STRING, ..) will
make use of the defined pools.

A new src/coap_mem_lwip.c file has been added.
2026-05-27 06:32:11 +01:00
Lucien Zuercher 855d53ef10 oscore: enable external credential storage and safe recipient cleanup
Add reference counting to recipient contexts so they can be safely removed
while still in use by active sessions. Expose callback hooks for credential
lookup, echo, and sequence storage to allow custom backends.
Expand example server to demonstrate the external storage via a simple
file based database. Expand coap_oscore_rcp_conf_t to enable settings
preconfigured echo value, sequence counter and window value as uint64
Enable temporary credentials returned by the find function and are destroyed
after use.
2026-05-20 13:09:24 +01:00
Jon Shallow 48559f0016 RIOT: Add help documentation
General documentation tidy up.
2026-05-20 10:20:22 +01:00
Jon Shallow 13139e7be9 Options: Check Uri-Path and Location-Path options for . or ..
Check incoming Uri-Path and Location-Path options for just . or .. (or %2e
hex encoded variants) and treat as being invalid.

Stop insertion of Uri-Path and Location-Path options that contain just
. or .. (or %2e hex encoded variants).
2026-05-11 19:41:17 +01:00
Jon Shallow b1b60fe159 RIOT: Handle ints being 16 bits 2026-04-22 09:04:00 +01:00
Jon Shallow 86b778167a RIOT: Implement RIOT's coding standards 2026-04-20 21:28:45 +01:00
Jon Shallow 783b5317ca Uri-Path-Abbrev: Initial IETF Draft support
https://datatracker.ietf.org/doc/html/draft-ietf-core-uri-path-abbrev-04
2026-04-18 12:05:48 +01:00
Ernestas Kulik 766b852849 Implement support for LLC sockets
Useful in embedded contexts, where devices might only have a link-layer
connection, but still need to exchange information.
2026-04-18 09:11:19 +01:00
Jon Shallow 3f4d08f964 RateLimit: Support rate limiting NON packets
New coap_context_rate_limit_ppm() function added.

Useful for 6TiSCH type environments.
2026-04-16 13:11:27 +01:00
Jon Shallow c50ea5bb37 RIOT: Update to latest 2026-04-16 12:27:38 +01:00
Jon Shallow e766f053c2 Debugging: Add examples support for causing network failures
Add -Z option to coap-client and coap-server.
2026-04-13 17:02:39 +01:00
Jon Shallow c46c64bca3 tinydtls: Update to latest version 2026-04-02 12:30:03 +01:00
Ernestas Kulik 4c6a8f10a4 examples: server: Fix builds without proxy support
d33b7fa571 adds a call to setup_cpsk(),
which is only defined with COAP_PROXY_SUPPORT defined. This commit
enables said function if COAP_CLIENT_SUPPORT is enabled as well.
2026-04-02 09:42:51 +01:00
Jon Shallow 80c37b7bc6 Coverity: Fix CID 1483550, 1670422-1670425
CID 1594475 is a false positive as multiple threads cannot execute in the same
code as global_lock is set.
2026-03-26 09:24:44 +00:00
Jon Shallow 39b79e23b4 multi-threading: Lock resource structure when calling request handlers
If an app request call-back modifies any data associated with a resource,
then multiple threads can attempt to unsafely modify the data at the same time.

Lock the resource when calling the app request handler (as global_lock is
unlocked) to prevent concurrent changes to the resource information.

If the app request handler is definately known to not modify the resource
information, then COAP_RESOURCE_SAFE_REQUEST_HANDLER can be set in the flags
for coap_resource_init().  Usually if there is a PUT, POST, PATCH or IPATCH
handler it is unsafe to set this. Setting this will reduce lock contention.
2026-03-23 19:01:53 +00:00
Jon Shallow e817ec85dd coap_resource.c: Fix 2 threads doing a DELETE on the same resource 2026-03-20 13:47:55 +00:00
Jon Shallow 9d5d063331 RIOT: Fix building against the latest RIOT code 2026-02-21 10:56:44 +00:00
Jon Shallow 152f6a8a58 Includes: Remove unnecessary include files
Include common system header files in coap_internal.h based on HAVE_*H
definitions.

Remove these system header files from include/*/*.h.

Add in system header files where appropriate in various apps.
2026-02-02 10:09:17 +00:00
Marco Casaroli a90916a4fe zephyr: mbedlts improvements
Add some improvements to make secure coap work on Zephyr 4.3.0
with mbedtls (not using Zephyr TLS protocol options).

We now set the build options to zephyr, so we make use of the
internal mbedtl in zephyr, so we do not require a specific header
file anymore.

In older versions of Zephyr, where mbedtls does not expose the
configuration, we can force-set the macro in the C flags, so that
mbedtls will have our required function.

This way, we do not need to change the mbedtls included in Zephyr,
while still supporting a few older versions.
2026-01-30 16:18:34 +00:00
Jon Shallow b7e538c4f3 Zephyr: Default to zephyr v4.3.0 for builds
Update to next version when the main branch becomes stable and a new release is out..
2026-01-30 10:08:57 +00:00
Jon Shallow 07c7a7aa57 body_size: Support configuration of max supported body size for RFC7959
Function coap_context_set_max_body_size() added.

For servers, if body size is too large, a 4.13 response is generated.

For clients, if the body size is too large, the server gets a RST and
no date is passed to the application.  A new event COAP_EVENT_BLOCK_ISSUE
is generated.
2026-01-29 09:53:52 +00:00
Jon Shallow 37334b120f Proxy: Add in support for previously set up upstream servers
Add in new coap_proxy_fwd_add_client_session() function to define the
upstream servers from previously set up sessions (i.e. from call-home).
2026-01-21 15:23:48 +00:00
Jon Shallow d80fa1497d Client: Remove (D)TLS / WebSocket startup call-back timing window
Add in new functions
  coap_new_client_session3()
  coap_new_client_session_pki3()
  coap_new_client_session_psk3()
  coap_new_client_session_oscore3()
  coap_new_client_session_oscore_pki3()
  coap_new_client_session_oscore_psk3()
which effectively does coap_session_set_app_data2() and
coap_ws_set_host_request() early on in the session set up cycle.
2026-01-08 17:51:10 +00:00