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.
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.
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
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.
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.
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.
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.
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.