Commit Graph
3011 Commits
Author SHA1 Message Date
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
Jon Shallow d2d9bd2b6d coap_uri.c: Fix parsing Unix Domains 2025-09-20 14:04:03 +01:00
Jon Shallow cc9aba6e01 coap_address.c: Validate length of provided host name
Host names larger than 255 bytes will cause an internal buffer overflow.

Hostnames provided to coap_resolve_address_info() now have their length validated.

Discovered by SecMate (https://secmate.dev).

Sanity check host lengths when parsing a CoAP URI when using the coap_split_uri()
function.
2025-09-16 11:41:41 +01:00
Jon Shallow af54b3d826 coap_session.c Fix CID update check 2025-09-16 11:41:41 +01:00
Jon Shallow 84d2b94421 CMakeLists.txt: Remove need for deprecated CMP0115 2025-09-16 11:41:41 +01:00
Jon Shallow d56fb48bff OSCORE: Fix OSCORE configuration file parsing issue
With a large boolean parameter value, (longer than "false"), memory
would be read past the "true" or "false" string boundaries in the ".rodata"
section when doing a memcmp(), potetially causing the application to crash
when calling coap_new_oscore_conf() with a specially crafted configuration
file.

It also can provide a mechanism to determine the byte values following the
"true" or "false" string boundaries which could lead to accessing sensitive
information. The standard libcoap library does not have defined keys or
certificates. This can only be done by a specially crafted local application.

Discovered by SecMate (https://secmate.dev).

Now fixed.
2025-09-16 11:41:41 +01:00
Jon Shallow 216802874b coap_block.c: Stop premature deletion of lg_srcv 2025-09-16 11:41:41 +01:00
Jon Shallow 959a0ba746 coap_mbedtls.c: Fix SNI hostname definition if not provided
MbedTLS based PKI clients may report

SSL - Attempt to verify a certificate without an expected hostname.
This is usually insecure.  In TLS clients, when a client authenticates a
server through its certificate, the client normally checks three things: ....

The application provided client_sni may have been removed as per
https://datatracker.ietf.org/doc/html/rfc6066#section-3

   Literal IPv4 and IPv6 addresses are not permitted in "HostName".

and so MbedTLS is now explicitly told that therw is no hostname.
2025-09-16 11:41:41 +01:00
Jon Shallow 33ad2707ab coap_session_mfree: Check for lg_crcv all cleared out if failure
Call to coap_cancel_observe_lkd() may cause session->lg_crcv to be cleared
out if transmission failure.
2025-09-16 11:41:41 +01:00
Jon Shallow bcf7d62342 RIOT: Fix building RIOT with RIOT's utlist.h change 2025-09-16 11:41:41 +01:00
Jon Shallow e2c57e1857 RIOT: Move examples to new directory structures 2025-09-16 11:41:41 +01:00
Jon Shallow 528402312e RIOT: Fix examples client issue
Bring the code up to the latest libcoap spec.
2025-09-16 11:41:41 +01:00
Jon Shallow f7cae1614a client code: Make sure static variables are re-initialized if needed
For embedded applications that can call the 'main()' function multiple
times, they  need to have any statically (globally) defined variables
reset to their default values.
2025-09-16 11:41:41 +01:00
Jon Shallow 993c12ac92 Copyright: Update to 2025 where appropriate 2025-09-16 11:41:41 +01:00
Jon Shallow b1ae24d4ce CIFuzz: Make sure libcoap is running when calling coap_delete_pdu() 2025-09-16 11:41:41 +01:00
Jon Shallow eb119c6ddb coap_block.c: Handle missing Size1 option when using Block1 2025-09-16 11:41:41 +01:00