Commit Graph
3046 Commits
Author SHA1 Message Date
Jon Shallow 2dae53cede OSS-FUZZ: Fix reported errors 2026-06-13 21:03:51 +01:00
Jon Shallow 142bc98aba RIOT: Fix build against latest version 2026-06-13 20:29:27 +01:00
Jon Shallow 99f9f421e3 OSS-FUZZ: Add in i386 build for fuzzing 2026-06-13 20:15:27 +01:00
Jon Shallow d96002f710 OSS-FUZZ: Fix found memory leak 2026-06-13 12:00:25 +01:00
Jon Shallow b16ed7ab2a OSS-FUZZ: Support different architectures and engines 2026-06-12 21:44:20 +01:00
Jon Shallow 588045e18c OSS-FUZZ: Add further tests 2026-06-10 22:24:06 +01:00
Jon Shallow b70c271905 Copyright: Update examples to 2026 2026-06-10 22:23:59 +01:00
Jon Shallow a5294122b3 Trust Certs: Load in the PKI trust store for peer cert checking
Load in the PKI trust store with a new function
  coap_context_load_pki_trust_store()

By default, make the client and server applications do this unless
explicitely disabled.

This enables clients doing (D)TLS to not need to be provided with specific
certificates but can validate trust in the server provided certificates.

Note: A default trust store is not supported across all platform types or
some TLS libraries (version dependent).
2026-06-10 13:17:37 +01:00
Jon Shallow b710ccdd54 coap_pdu.c: Handle extended token checking with small PDUs
Handle errors reported by sanitize checks.
2026-06-10 12:15:00 +01:00
Jon Shallow b55a3b7058 Contiki: Fix heapmem_free() warning
heapmem_free() warns if ptr is NULL.
2026-06-07 15:58:28 +01:00
Jon Shallow 97e74fbfe4 OpenSSL: Merge in develop branch fixes 2026-06-05 16:17:54 +01:00
Jon Shallow bc4619557c 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:54:39 +01:00
Peter Harper a8a72eb024 coap_threadsafe_internal.h: Fix coap_lock_invert.
This code fails to compile if COAP_THREAD_SAFE is false as the macro
parameter is "alt_lock" not "func".
2026-06-04 16:45:17 +01:00
Jon Shallow 966f73999f coap_openssl.c: Support clients alternating betweek PKI and PSK 2026-06-01 15:19:49 +01:00
Jon Shallow 1096aeedf8 coap_oscore.c: Fix replay protection 2026-06-01 09:22:58 +01:00
Jon Shallow 0f97e5cd1c coap_ws.c: Fix potential OOB on read headers 2026-05-07 17:12:22 +01:00
Jon Shallow d9b4031ee6 ASN1: Add in limit check for recursive tags 2026-04-18 11:38:53 +01:00
Jon Shallow 067400fa91 ChangeLog: Include released CVE-2026-29013 2026-04-18 09:04:32 +01:00
Jon Shallow 851533c3cf 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.
v4.3.5b
2026-04-11 14:38:16 +01:00
Jon Shallow 6439f40885 CBOR: Be more rigorous in boundary checking 2026-04-04 09:26:06 +01:00
Jon Shallow 3bb703f4ea tinydtls: Update to latest version 2026-04-02 14:08:09 +01:00
Jon Shallow a89ae8ea7c OSCORE: Be more rigorous in boundary checking 2026-04-02 10:59:06 +01:00
Jon Shallow 4f98e799b2 coap_tcp.c: Remove multi-threads warnings on TCP accept() 2026-04-02 10:59:01 +01:00
shruti gunwant aab990ce86 oscore: fix OSCORE replay window validation for out-of-order sequence numbers 2026-03-27 14:07:05 +00:00
Jon Shallow 2788ba8d2b coap_net.c: Fix CI build errors 2026-03-27 13:23:10 +00:00
Jon Shallow 096a683147 Bug fix update to 4.3.5b 2026-03-27 09:37:53 +00:00
Jon Shallow c63cde29b0 Backport some develop work to fix issues highligted during testing
Add reference count checks for coap_pdu_t usage.

Make coap_delete_pdu thread safe.

Fix a proxy referencing stale data.

Corrrectly replace Proxy-Uri with appropriate Uri-* options when directly
forwarding a PDU to a specified server and COAP_PROXY_DIRECT_STRIP is set.
2026-03-27 09:37:47 +00:00
Jon Shallow 7cf476bc23 oss-fuzz: Fix complaint about memcpy() 2026-03-26 09:59:04 +00:00
Jon Shallow 784d0d083d coap_oscore.c: Process queued OSCORE Observe responses after de-registration
If an Observe is de-registered, but an unsolicited Observe response is received
before the de-register response is received, then the unsolicited response
failed to get decrypted.
2026-03-26 09:50:00 +00:00
Jon Shallow 008cff1d51 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:44:34 +00:00
rohit.patil b0a58b6da1 coap_net: skip Content-Format check for OSCORE FETCH
When a FETCH request is OSCORE-protected the Content-Format option is
an inner (encrypted) option per RFC 8613 §4.1.3.1 and is legitimately
absent from the outer CoAP message.  The existing RFC 8132 §2.3.1
check unconditionally rejects such requests with 4.15 (Unsupported
Content-Format) even when COAP_OSCORE_SUPPORT is disabled and the
application uses its own OSCORE stack.

Only enforce the Content-Format presence rule when no OSCORE option
is present in the outer request.

Fixes: https://github.com/obgm/libcoap/issues/1936
2026-03-26 09:44:34 +00:00
Jon Shallow a2c67ec8fb OSS-FUZZ: Fix discovered issues 2026-03-25 08:53:41 +00:00
Jon Shallow b7847c4dbb sanitizer: Fix reported issues
coap_new_cache_entry() does not correctly check for no PDU data when called
with COAP_CACHE_RECORD_PDU. No current libcoap code (examples and library)
call coap_new_cache_entry() with COAP_CACHE_RECORD_PDU set.

Internal function coap_pdu_resize() can be used to reduce a PDU size,
creating current options confusion.  Fix is not to reduce PDU if new
size is smaller than the current used size. No current libcoap code calls
coap_pdu_resize() to reduce the size.

If there is an issue with the PDU options where the maximum used option
value is larger than the last defined option value, an assert() is triggered.

All of the coap_*_option() functions correctly manage pdu->max_opt, but
this issue could occur if coap_pdu_resize() was called to reduce the PDU size
below that of pdu->used_size.
2026-03-25 08:53:41 +00:00
Jon Shallow 37ee78a8c2 Sanitizer: Fix issues raised by ASan and UBSan when testing 2026-03-25 08:53:41 +00:00
Jon Shallow d7b1827287 Sanitizer: Add in build environment support
configure --enable-sanitizer
cmake -DENABLE_SANITIZER=ON
2026-03-25 08:53:41 +00:00
Jon Shallow 0cd597ab82 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-25 08:53:34 +00:00
Jon Shallow 712f70d913 coap_openssl.c: Fix coap_dgram_destroy() 2026-03-24 17:22:07 +00:00
Jon Shallow c024cc8e0e fix: OSCORE ACK retransmission handling 2026-03-24 17:22:07 +00:00
Lucien Zuercher 22ffdb0702 fix: do not override sequence counter after window processing 2026-03-24 17:22:07 +00:00
Jon Shallow 60545f2d72 configure.ac: Fix disabling IPv4 or IPv6 builds 2026-03-16 17:08:41 +00:00
Jon Shallow 6c1d51dd59 main.yml: Use actions/checkout@v6
Fixes future Node.js 20 deprecation for github workflows.

There are still some other actions that continue to use Node.js 20 which will
need to be updated when they have also been ugraded to stop CI Action run warnings.
2026-03-16 17:01:50 +00:00
Jon Shallow e985e09542 coap_debug.c: Fix coap_debug_set_packet_loss("100%") 2026-03-16 16:52:24 +00:00
Jon Shallow b68a10be1b coap_resource.c: Fix reference to deleted Observe after transmit failure 2026-03-16 16:08:58 +00:00
Lucien Zuercher f1b778352f fix: memory leak if client receives ACK response via OSCORE 2026-03-16 16:06:24 +00:00
Jon Shallow 4f38c3dfac ASN1: Check for buffer overflows when determining tags and length
Include oss-fuzzer checks.
2026-03-16 16:05:39 +00:00
Jon Shallow 5829f02f70 oscore.c: Boundary check oscore_generate_nonce() parameters
Follows https://datatracker.ietf.org/doc/html/rfc8613#section-5.2 and Figure 8.
2026-03-16 16:04:11 +00:00
Jon Shallow eba20a41eb RIOT: Fix building against the latest RIOT code 2026-03-16 16:03:42 +00:00
Jon Shallow f6e40a713c coap_oscore.c: Fix coap_parse_oscore_conf_mem() memory leak 2026-03-16 16:00:55 +00:00
Jon Shallow f538e7ee12 configure.ac: Abstract WARNINGs from config.log for summary report
Aids troubleshooting.
2026-03-16 16:00:00 +00:00
Jon Shallow 2f0d9c7457 ChangeLog: Include CVE fixed in 4.3.5a 2026-03-16 15:54:26 +00:00