Commit Graph
3026 Commits
Author SHA1 Message Date
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
Mahavir Jain 1c26ef352a feat(mbedtls): add support for PSA crypto interface
This change adds in the compatibility with the mbedtls-4.0 release.
This release has deprecated the classic mbedtls crypto APIs in favour
of standardized PSA crypto APIs.

For more information please refer to:
https://github.com/Mbed-TLS/mbedtls/releases/tag/mbedtls-4.0.0
2026-01-09 09:49:11 +00:00
Jon Shallow 4e42d0f297 Proxy: Fix Reverse proxy 2025-12-30 10:54:33 +00:00
Jon Shallow 191499fda9 coap_uri.c: Fix off by one checking error 2025-12-30 10:44:26 +00:00
Jon Shallow 95406a27f3 configure.ac: Fix observe-persist support 2025-12-06 16:04:43 +00:00
Jon Shallow 53d2a8f95c multi-threading: Fix no_recursive_check issue 2025-12-06 16:04:18 +00:00
Jon Shallow e3fdcdcfbd ChangeLog: Update with fixed CVEs v4.3.5a 2025-11-26 11:47:47 +00:00
Jon Shallow 6634b334e8 coap_wolfssl.c: Do more error checking 2025-11-26 11:47:47 +00:00
Jon Shallow 2d260b9301 coap_mbedtls.c: Add in more error checks 2025-11-26 10:01:51 +00:00
Jon Shallow 31d79475b0 coap_gnutls.c: Properly handle error conditions 2025-11-26 10:01:45 +00:00
Jon Shallow d9a600edb9 Bug fix update to 4.3.5a 2025-11-25 16:12:20 +00:00
Jon Shallow 079fbbcaba coap_io.c: Cleanup MinGW builds
Move the MinGW #if tests to after where mswsock.h is included.

Tidy up documentation.

Tested against MSYS2 UCRT64, CLANG64, MINGW32 and MINGW64 on Windows 11.
Fixed a couple of minor build issues found.
2025-11-25 16:12:20 +00:00
Jon Shallow f3133e87f6 coap_io.c: Support MinGW build with _WIN32_WINNT == 0x0a00 2025-11-25 16:12:20 +00:00
Jon Shallow b2e10d1d1b MinGW: Fix latest MinGW support build 2025-11-25 16:12:20 +00:00
Jon Shallow 923a1a8f93 coap_uri.c: Fix sending Uri-Host option
Ipv6 Hosts with %interface suffix were incorrectly getting sent
with a Uri-Host option which included the &interface as well.
2025-11-25 10:29:50 +00:00
Jon Shallow 285eb02671 coap-rd.c: Sanity check POST query lengths 2025-11-25 10:29:50 +00:00
Patryk Jarosz 9d9b941c40 fixed memory leak coap_send 2025-11-25 10:29:36 +00:00
Jon Shallow bdbcf29bd1 coap_session.c: Fix GCC array bounds warning for memcpy
Note assert() added from #1209 has now been removed as not needed by #1628,
and if NDEBUG is defined then the assert() would have been a noop anyway.
2025-11-25 09:59:39 +00:00
Jon Shallow 054a55cbd6 coap_openssl.c: Check return values in case internal OpenSSL issue
And other other OpenSSL updates.
2025-09-27 15:24:42 +01:00
Jon Shallow 5fdd219118 testdriver: Suppress log Warning when error detecting 2025-09-20 14:04:03 +01:00
Jon Shallow 88f8c2e01f CI: Fix CI windows-2025 ms-build image build 2025-09-20 14:04:03 +01:00