Commit Graph
3349 Commits
Author SHA1 Message Date
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 05a946c878 configure.ac: Move forward with releases following semver.org format 2026-07-10 11:46:48 +01:00
Jon Shallow bc708771c8 coap_net.c: Redo mcast large token fix
Drop sending 4.00 or RST response if large token size support is not available
and request is a multicast request.

Fixes #2063.
2026-07-10 09:22:24 +01:00
Jon Shallow 8a7375700f coap_net.c: Revert out mcast large token fix as it breaks OSCORE
Revert out #2078 as it causes issues with OSCORE when determining
if large token support size is available.
2026-07-10 09:22:24 +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 f9734a55fc configure.ac: Remove space after -I option
pkg-config --cflags gets confused by the space.
2026-07-06 17:44:34 +01:00
Jon Shallow eadd400b62 oscore_cbor.c: Fix coap_persist_observe_add() boundary checks 2026-07-06 10:44:45 +01:00
David Korczynski e2463f007f Add OSCORE CBOR fuzz harness to be consumed by OSS-Fuzz
The goal is to increase code coverage of the OSCORE CBOR reader in
src/oscore/oscore_cbor.c, which decodes attacker-reachable data (the
persisted observe/OSCORE association blob in coap_subscribe.c and the
OSCORE option kid_context in coap_oscore.c) but is currently largely
unexercised:
https://storage.googleapis.com/oss-fuzz-coverage/libcoap/reports/20260702/linux/src/libcoap/src/oscore/report.html

Signed-off-by: David Korczynski <david@adalogics.com>
2026-07-03 07:36:09 +01:00
Jon Shallow ce032db273 oscore_cbor.c: Fix handling large negative integers
Exclude OSS-FUZZ seed corpus files from pre-commit hooks.
2026-07-02 19:54:48 +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 7c9cadb57c pkg-config: Include cmake and sanitize support for .pc files 2026-06-29 09:07:35 +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
Jon Shallow 6c01c83272 coap_proxy.c: Decrement MAX_AGE when returning cached entry 2026-06-27 11:25:19 +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
Jon Shallow 261dc9b58c WebSockets: Handle large reads 2026-06-25 15:42:04 +01:00
Jon Shallow d354a693a7 CMakeLists.txt: Better handle OSCORE only back-ends 2026-06-25 09:34:58 +01:00
Jon Shallow 92d58d1115 TLS: Compatability tidy up 2026-06-25 09:24:37 +01:00
Jon Shallow f4a8fe1d12 Extended Tokens: Fix multicast responses 2026-06-24 13:32:30 +01:00
Jon Shallow abde6a513a Proxy: Cleanup proxy associations
Handles situation where the event handler is not defined.
2026-06-24 13:29:26 +01:00
Jon Shallow 2e995218f3 SendQueue: Match Mid and Token (if given) to remove entry from queue
For Empty ACK and RST do not do a token match.
2026-06-22 13:48:44 +01:00
Jon Shallow c65dcb16df coap_wolfssl.c: Fix Identity Hint, PEM_BUF and timeouts 2026-06-22 13:47:38 +01:00
Jon Shallow 83a71af102 coap-gnutls.c: Fix CN, establised state and timeouts 2026-06-22 13:45:53 +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
Mario Kicherer 3891726e17 coap_openssl.c: unify tls_client_hello_call_back for PSK and PKI to fix simultaneous operation 2026-06-20 12:53:01 +01:00
Jon Shallow 0869dea655 coap_mbedtls.c: Fix checking PKI Common Name and Connected Event 2026-06-18 13:16:24 +01:00
Jon Shallow 3035cfd751 OSS-FUZZ: Add in i386 build for fuzzing 2026-06-13 20:12:26 +01:00
Jon Shallow 4c3f4af1c0 OSS-FUZZ: Support different architectures and engines 2026-06-12 21:08:45 +01:00
Jon Shallow 46e34175b8 RIOT: Fix build against latest version 2026-06-12 17:21:21 +01:00
Jon Shallow 888ba34ece Q-Block: Better timing / recovering when rate limiting
Make use of an outstanding list of blocks to transmit to remove duplicates
and only send one at a time if rate-limiting.
2026-06-10 12:01:10 +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 5ea8b7d5e9 OpenSSL: Support 4.0 and later buids
Remove all references to ENGINE_*() as support has been removed in 4.0.

There currently is no tested Provider support for PKCS11.
2026-06-05 15:51:01 +01:00
Jon Shallow 193ec26ead Proxy: Check for non-safe options
Generally re-organize option handling, making use of enums etc.

This also updates critical options checks, and well as repeatable options.
2026-06-05 15:22:38 +01:00
Michiel De Witte b4de71ee24 Fix data race in coap_resolve_address_info() 2026-06-02 09:57:30 +01:00
David Korczynski bd47692407 Add proxy fuzz harness to be consumed by OSS-Fuzz
The goal is to increase code coverage of coap_proxy.c logic,
which currently stands at less than 2%:
https://storage.googleapis.com/oss-fuzz-coverage/libcoap/reports/20260518/linux/src/libcoap/src/report.html

Signed-off-by: David Korczynski <david@adalogics.com>
2026-06-01 16:05:55 +01:00
Jon Shallow f669cf5e24 coap_openssl.c: Support clients alternating betweek PKI and PSK 2026-06-01 15:16:19 +01:00
Jon Shallow c4e651ae70 LwIP: Allocate semaphores per context for NO_SYS == 0
Each LwIP coap_context_t must now periodically call coap_io_process().
2026-06-01 09:55:31 +01:00
Jon Shallow d32d298333 coap_oscore.c: Fix replay protection 2026-06-01 09:18:10 +01:00
Jon Shallow eb73b10e64 oss-fuzz: Further support for running with threading support 2026-05-30 14:15:54 +01:00
Jon Shallow be107f0229 coap_proxy.c: Fix memory leak 2026-05-30 10:10:23 +01:00
David Korczynski c28f8f5e7a fix lint
Signed-off-by: David Korczynski <david@adalogics.com>
2026-05-30 09:47:56 +01:00
David Korczynski 0e03abc99c Adds extended coap_cache fuzzer to be consumed by OSS-Fuzz
The goal is to extend code coverage of libcoap. Can confirm from local
runs this provides a significant boost to coap_cache.c coverage.

Signed-off-by: David Korczynski <david@adalogics.com>
2026-05-30 09:47:56 +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
David Korczynski e909ff5dd5 Adds extended uri fuzzer to be consumed by OSS-Fuzz
Extends on the code coverage of the coap_uri.c module, which currently
has the code coverage:
https://storage.googleapis.com/oss-fuzz-coverage/libcoap/reports/20260512/linux/src/libcoap/src/coap_uri.c.html

Signed-off-by: David Korczynski <david@adalogics.com>
2026-05-25 11:39:43 +01:00
David Korczynski 574332f6e3 Add ws_frame fuzzer to be consumed by OSS-Fuzz
Signed-off-by: David Korczynski <david@adalogics.com>
2026-05-20 14:26:02 +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
Fabian Hüßler db7b7e8207 coap_config.h.riot: add CONFIG_LIBCOAP_MAX_STRINGS 2026-05-19 14:53:42 +01:00