Commit Graph
1306 Commits
Author SHA1 Message Date
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
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 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
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 be107f0229 coap_proxy.c: Fix memory leak 2026-05-30 10:10:23 +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 56ad791cc4 wolfssl.c: Update not needed assert() 2026-05-18 12:03:53 +01:00
Jon Shallow 3d6b603672 coap_pdu.c: Handle extended token checking with small PDUs
Handle errors reported by sanitize checks.
2026-05-16 16:32:23 +01:00
Jon Shallow 9f14450a7e coap_subscribe.c: Fix issue found by oss-fuzz 2026-05-14 15:51:32 +01:00
Jon Shallow c1147eb096 coap_pdu.c: Support checking for extended tokens when large pdu created
Picked up by oss-fuzz
2026-05-13 10:29:30 +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 df90dfd7b1 coap_subscribe.c: Sanity check persist startup logic 2026-05-11 18:08:55 +01:00
Jon Shallow 382e16cc7f coap_ws.c: Fix potential OOB on read headers 2026-05-07 17:09:22 +01:00
Jon Shallow 54faa02565 coap_resource.c: Fix inverted error introduced in #1927 2026-05-07 16:22:21 +01:00
Magdalena Szumny a77c2c64fe Use Zephyr allocators for Zephyr targets 2026-05-06 13:52:06 +01:00
OwenSanzas 34cee6ef76 coap_resource.c: harden coap_print_wellknown_lkd against zero-length query-pattern
When a Uri-Query filter ends in '=' with no value bytes (e.g. "rt="),
the filter parser computes resource_param.length == query_filter->length - 1
and query_pattern.length == 0, but then unconditionally dereferences
query_pattern.s[0] to test for a leading '/'. With the current allocator
strategy in coap_new_string() (which over-allocates by 1 byte for a NUL
terminator) this read lands on the NUL slot and is harmless; ASan does
not flag it on the dispatch path.

However, coap_print_wellknown is a public, exported COAP_API. A caller
passing a tightly-allocated coap_string_t (length == alloc_size, no
trailing slack) hits a 1-byte heap-buffer-overflow read at
src/coap_resource.c:178. The man page does not document any required
allocation slack, so this is an API-contract footgun rather than only an
internal invariant violation.

Mirror the existing guard already in place for the trailing '*' check
(line 183) by guarding the leading '/' check on query_pattern.length > 0.

Reproducer (clang + ASan, against HEAD e3f8cd0):

  uint8_t *filter = malloc(3);
  memcpy(filter, "rt=", 3);
  coap_string_t qf = { .length = 3, .s = filter };
  coap_print_wellknown(ctx, out, &out_buflen, 0, &qf);
  /* AddressSanitizer: heap-buffer-overflow READ of size 1
   *   #0 coap_print_wellknown_lkd src/coap_resource.c:178
   *   #1 coap_print_wellknown    src/coap_resource.c:110             */

After the fix the PoC exits cleanly; the sanity case "rt=x" (length>0)
continues to work unchanged.

Signed-off-by: OwenSanzas <zesheng@tamu.edu>
2026-05-05 09:24:36 +01:00
Jon Shallow de54053789 Q-Block: Reference track coap_lg_srcv_t and coap_lg_crcv_t 2026-05-04 17:46:59 +01:00
Jon Shallow 8402c3bb8c OSS-FUZZ: Fix issues found 2026-04-22 21:03:50 +01:00
Jon Shallow 244b0c2be4 OSS-FUZZ: Fix issues found 2026-04-22 10:07:44 +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
Jon Shallow e4297c9c89 OSS-FUZZ: Fix issues found 2026-04-18 11:56:32 +01:00
Jon Shallow b197807b54 ASN1: Add in limit check for recursive tags 2026-04-18 11:36:49 +01:00
Jon Shallow edc146d9f1 KeepAlive: Make sure sessions timeout after ping failures
Currently set to 3 concurrent ping failures.
2026-04-18 10:44:44 +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 5d76f75c24 ThreadSafe: Fix CVE 1670700 thread number logging 2026-04-16 13:10:43 +01:00
Jon Shallow 77929465d3 OSCORE: Support complex sender and recipient configurations
Also supports silent_server configuration for recipient definitions.
2026-04-14 10:42:41 +01:00
Jon Shallow 2c8cceb997 coap_net.c: Move prepend_508_ip out of coap_send_internal 2026-04-11 20:21:08 +01:00
Jon Shallow 707d08ed44 DTLS: Do not call coap_session_disconnected_lkd() for writes
Let the upper calling layer do the coap_session_disconnected_lkd()
on detection of write error.
2026-04-11 14:33:05 +01:00
Jon Shallow 414900ecc3 coap_threadsafe.c: Support multiple use of coap_io_process_configure_threads()
Support for multiple libcoap contexts.
2026-04-08 16:00:01 +01:00
Jon Shallow 17a0c692fe OSS-FUZZ: Reduce unnecessary logging during runs
No need to log socket or OSCORE issues at critical level.
2026-04-08 12:48:44 +01:00
Jon Shallow bdd05e726f coap_threadsafe.c: Provide internal SIGINT handler for closing down threads 2026-04-04 16:56:00 +01:00
Jon Shallow 912cae62d7 CBOR: Be more rigorous in boundary checking 2026-04-04 09:23:58 +01:00
Jon Shallow 9366f8333e OSCORE: Be more rigorous in boundary checking 2026-04-02 10:37:52 +01:00
Jon Shallow 5010974814 coap_io_posix.c: Make coap_io_process_remove_threads() thread protected.
Don't report

WARN coap_socket_accept_tcp: accept: Resource temporarily unavailable

when multiple threads are trying to process the same incoming TCP connection.
2026-04-01 15:58:42 +01:00
Jon Shallow f0533d32b1 LwIP: Handle PDUs with max size of 0 (unlimited) 2026-03-28 10:45:50 +00:00