Commit Graph
2921 Commits
Author SHA1 Message Date
Jon Shallow aa46177e8e Coverity: Fix CID 1382579, CID 1502425, CID 1594471 and CID 1594475 2024-07-11 13:03:32 +01:00
Jon Shallow 7d5e5f3b8c coap-mbedtls.c: Support 3.6.0 Mbed TLS
TLS1.3 is enabled by default in 3.6.0. This PR fixes the supported
encryption algorithms as well as handling a new session ticket
indication for coaps+tcp://.

However, if client certificates are not defined, then MbedTLS fails with
no certificate CA, even if the CA Cert is presented along with the Server
Cert during the processing of the server certificate and fails with
"SSL - No CA Chain is set, but required to operate"
when coaps+tcp:// is used.

Workaround (with examples/coap-client) is to set the -R options (when the
-c option is not set), or to programmatically call
coap_context_set_pki_root_cas();
2024-07-11 12:51:58 +01:00
Hugo Hakim Damer 2ae46c9da2 configure.ac: use MbedTLS pkg-config if available
Additionally, this change allows overriding the MbedTLS compiler and
linker flags (just like with the other DTLS libraries).
2024-07-10 17:46:17 +01:00
Mario Kicherer 72045d89bd coap-debug.c: remove quotation when printing Unix domain socket paths, see #1460 2024-07-10 17:45:51 +01:00
kkrentz a1a16f3f5a Contiki-NG: Fix compilation error "unknown type name 'u_char'" 2024-07-04 10:59:01 +01:00
Jon Shallow cab876aa5d Zephyr: Support Mbed TLS 3.6.0 2024-07-02 21:29:40 +01:00
Jon Shallow f16e019e9d Zephyr: Support later Mbed TLS versions 2024-07-01 19:32:55 +01:00
Jon Shallow e5b7b98681 RIOT: Fix file name typo 2024-07-01 19:31:26 +01:00
Jon Shallow 15576ed6c3 RIOT: Pick up any uncommited changes when doing a local RIOT build 2024-06-29 08:16:03 +01:00
Jon Shallow 8157d0452f coap-client.c: Add in correct Uri-Host / Uri-Port for proxy 2024-06-29 08:11:09 +01:00
Jon Shallow 319ffb02c1 coap_net.c: Stop unnecessary coap_lg_crcv_t generation 2024-06-28 10:02:24 +01:00
Jon Shallow 3c720f232f release 4.3.5rc2: Release candidate 2 for 4.3.5 v4.3.5-rc2 2024-06-25 09:31:27 +01:00
Jon Shallow eff1f38f9f path_query parsing: Remove need to define scratch buffer
Create new options coap_uri_into_optlist(), coap_path_into_optlist() and
coap_query_into_optlist() to be used instead of coap_uri_into_options(),
coap_split_path() and coap_split_query() functions so the requirement
for a scratch buffer is not needed.

Getting the minimum size for a scratch buffer is not straight forward and
potential for unexpected boundary condition errors to occurif too small.

Correct parsing and stripping out of "%2E%2E" ("..") and "%2E" (".")
path segments.  ".." now removes the previous segment (if it exists).

Update documentation and unit testcases.

Update examples to use new options.
2024-06-25 08:23:33 +01:00
Jon Shallow 63c5077cf0 coap_cleanup: Support multiple usage 2024-06-21 16:08:41 +01:00
Jon Shallow b1d305c842 dtls_writes: Handle write errors 2024-06-21 15:29:06 +01:00
Jon Shallow 5fbbd27765 coap_resource.c: Remove debug test statement. 2024-06-17 09:53:15 +01:00
Jon Shallow 0fbe59fc55 block: Handle separate responses that then are followed with Block2
Set up lg_crcv if separate ACK response received for a coap_send() CON
request to be able to handle Block2 responses.

Handle Block1 request getting back a Block2 request that has an initial
separate response once the Block1 has completed by adjusting the stateless
token counter.

Separate response is typical for proxy support (OSCORE previously handled)..
2024-06-14 11:43:18 +01:00
kkrentz ea3d1ac17e OSCORE: Fix typo in comment 2024-06-12 09:54:25 +01:00
Jon Shallow f54686039b coap-client.c: Fix SNI generation
Move requirements for client to determine how to set up the SNI for
PSK/PKI encrypted communications down into libcoap. The client just
needs to indicate the host to connect to in the client_sni field of
coap_dtls_cpsk_t or coap_dtls_pki_t.

New internal function coap_sanitize_client_sni() makes sure that
the SNI sent follows RFC 6066.  As per
https://datatracker.ietf.org/doc/html/rfc6066#section-3

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

all IPv4 and IPv6 addresses are dropped for the SNI, and so no SNI is
sent.  DNS hostnames will get transmitted as the SNI.
2024-06-10 09:18:25 +01:00
Jon Shallow e095d5e03a RIOT: libcoap Release 4.3.5rc1 v4.3.5-rc1 2024-06-06 15:12:08 +01:00
Jon Shallow 0392d02217 release 4.3.5rc1: Release candidate 1 for 4.3.5
LIBCOAP_VERSION and LIBCOAP_PACKAGE_BASE are unchanged until
4.3.5 is released.
2024-06-06 10:07:50 +01:00
Jon Shallow ed178be577 coap-client: Correct Usage documentation 2024-06-06 10:04:42 +01:00
Jon Shallow 0223c1a3d4 Block1: Handle large FETCH with large blocked request and Observe
Handle Observe cancellation with large blocked FETCH that needs to use
diffferent tokens when there is packet loss by checking the cache-key
if the token is not found (Q-Block1).

Let FETCH with Q-Block1 use NON now that cache-key is getting checked
if token mismatch.

Handle getting an unsolicited Observe response in the middle of
sending the FETCH blocks that ultimately will be doing the Observe
cancellation following re-assembly. (The unsolicited Observe token will
be the same token that is used to respond to the observe cancellation).
2024-06-06 09:44:15 +01:00
Jon Shallow dec13f94f1 locking: Add missing COAP_API 2024-06-05 08:33:39 +01:00
Jon Shallow 782e607879 reverse-proxy: Support for .well-known/core being passed
Move get_wkc_len() into hnd_get_wellknown_lkd() to simply document how
hnd_get_wellknown() should be done.

Revert out coap_register_print_wellknown_callback() changes as no
longer needed.
2024-06-05 07:43:37 +01:00
Mario Kicherer 7c33808271 enable application control over .well-known/core responses 2024-05-31 18:07:45 +01:00
Jon Shallow 70469f24b0 examples-code-check.c: Report on missing defined function return types 2024-05-30 14:49:42 +01:00
Jon Shallow c830c15551 proxy: Handle Uri-Host correctly when using Proxy-Scheme
Updated documentation at the same time.
2024-05-29 10:20:57 +01:00
Jon Shallow 5171694d09 LwIP: NO_SYS == 0 support 2024-05-29 10:19:31 +01:00
kkrentz b7cbb64793 coap_net: Fix preprocessor guard 2024-05-28 14:20:13 +01:00
Jon Shallow f00f13831a locking: app call-backs when coap_free_context() called
Attempt to simplify locking to prevent Coverity issues being
generated.
2024-05-28 10:01:31 +01:00
Jon Shallow 520f054b5b Coverity: Fix 1588815 and 1588818 2024-05-28 09:37:09 +01:00
Jon Shallow cb20c482b2 locking: Simplify maintenance / debugging /documentation
Update the Public API equivalent of the libcoap functions that need to be
called when locked with a name suffix of _lkd.

Move matching Public API functions out of coap_threadsafe.c to be coded
just ahead of the newly renamed _lkd function.

Properly define the _lkd function in the appropriate _internal.h file for
documentation, removing the #defines from coap_threadsafe_internal.h.

Tag all the Public API functions that have a _lkd function with COAP_API.
COAP_API can then be defined as to what should be done for that function.

Check libcoap library does not call the original Public API function when
it should be calling the _lkd function by marking the Public API not _lkd
functions as deprecated during the libcoap library build.
[Done by the new COAP_API being defined as __attribute__((deprecated)).]

Work in progress for all the functions that need to be multi-thread safe.
2024-05-24 09:09:49 +01:00
Jon Shallow 948697e4b2 locking: Simplify maintenance / debugging /documentation
Update the Public API equivalent of the libcoap functions that need to be
called when locked with a name suffix of _lkd.

Move matching Public API functions out of coap_threadsafe.c to be coded
just ahead of the newly renamed _lkd function.

Properly define the _lkd function in the appropriate _internal.h file for
documentation, removing the #defines from coap_threadsafe_internal.h.

Tag all the Public API functions that have a _lkd function with COAP_API.
COAP_API can then be defined as to what should be done for that function.

Check libcoap library does not call the original Public API function when
it should be calling the _lkd function by marking the Public API not _lkd
functions as deprecated during the libcoap library build.
[Done by the new COAP_API being defined as __attribute__((deprecated)).]

Work in progress for all the functions that need to be multi-thread safe.
2024-05-23 08:30:11 +01:00
Jon Shallow e363d0a5c4 Binary PSK: Add in support for examples coap-client and coap-server
If the PSK is defined with a leading 0x, then the hex representation
of the following bytes is converted to a binary PSK.
2024-05-23 08:29:03 +01:00
Jon Shallow 91d8fad663 locking: Simplify maintenance / debugging /documentation
Update the Public API equivalent of the libcoap functions that need to be
called when locked with a name suffix of _lkd.

Move matching Public API functions out of coap_threadsafe.c to be coded
just ahead of the newly renamed _lkd function.

Properly define the _lkd function in the appropriate _internal.h file for
documentation, removing the #defines from coap_threadsafe_internal.h.

Tag all the Public API functions that have a _lkd function with COAP_API.
COAP_API can then be defined as to what should be done for that function.

Check libcoap library does not call the original Public API function when
it should be calling the _lkd function by marking the Public API not _lkd
functions as deprecated during the libcoap library build.
[Done by the new COAP_API being defined as __attribute__((deprecated)).]

Work in progress for all the functions that need to be multi-thread safe.
2024-05-22 11:40:44 +01:00
Jon Shallow e8e44bf6aa esp-idf: Support multi-threading 2024-05-22 10:09:52 +01:00
Krzysztof Gongolewski 180e8220d4 fix lwip memory leak 2024-05-22 10:09:30 +01:00
Jon Shallow d2d4a81374 locking: Simplify maintenance / debugging /documentation
Update the Public API equivalent of the libcoap functions that need to be
called when locked with a name suffix of _lkd.

Move matching Public API functions out of coap_threadsafe.c to be coded
just ahead of the newly renamed _lkd function.

Properly define the _lkd function in the appropriate _internal.h file for
documentation, removing the #defines from coap_threadsafe_internal.h.

Tag all the Public API functions that have a _lkd function with COAP_API.
COAP_API can then be defined as to what should be done for that function.

Check libcoap library does not call the original Public API function when
it should be calling the _lkd function by marking the Public API not _lkd
functions as deprecated during the libcoap library build.
[Done by the new COAP_API being defined as __attribute__((deprecated)).]

Work in progress for all the functions that need to be multi-thread safe.
2024-05-21 14:51:51 +01:00
Jon Shallow 6e68baa0f7 coap_update_token: Make sure corrected PDU headers are presented to the app 2024-05-21 09:34:11 +01:00
Jon Shallow cbfb491b1d coap_libcoap_build.h: Add in specific library build header
Gives the ability to add in additional library build checks through
the use of #define etc. that is not available to applications or
other host o/s support.

Preparatory work for further locking checks.
2024-05-20 15:39:40 +01:00
Jon Shallow 485a7c4570 check-missing-updates.sh: Clarify what needs to be done when there is an issue 2024-05-20 15:31:03 +01:00
Jon Shallow c4d0a42f97 doc: Refer to DTLS1.3 and request non-standard TLS library configurations 2024-05-18 13:39:48 +01:00
Jon Shallow 628fc3673f locking: After coap_free_context(), handle API calls from call-backs 2024-05-18 13:28:25 +01:00
Jon Shallow fb6b09ee31 coap_wolfssl.c: Fix PKI for different wolfSSL build options 2024-05-18 13:14:17 +01:00
Jon Shallow c029eedca1 nits: Tidy up documentation 2024-05-18 10:54:13 +01:00
Jon Shallow d58bd90238 checks: Check for missing file updates 2024-05-17 15:33:44 +01:00
kkrentz 280b723a73 Contiki-NG: Fix compilation error "implicit declaration of strncasecmp" 2024-05-17 11:47:12 +01:00
fj-blanco 3c72266d81 Fix to cmake build for wolfssl dtls backend
The change to cmake_coap_config.h.in solves the
following issue: when building with cmake the
functions at coap_notls.c were being compiled.

Apply fix to CMakeLists.txt.in for wolfSSL DTLS backend
2024-05-17 10:08:09 +01:00
Jon Shallow ecb588e2c3 coap_wolfssl.c: Fix DTLS MTU support 2024-05-16 12:18:50 +01:00