Commit Graph
2886 Commits
Author SHA1 Message Date
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
Jon Shallow 15bf66c920 pre-commit: Add more trailing spaces and empty line at end of file checks 2024-05-15 16:04:08 +01:00
Jon Shallow 622050a957 locking: Simplify maintenance / debugging /documentation
Update libcoap functions that need to be called locked with a name
suffix of _locked.

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

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

Work in progress for all the functions.

Remove coap_lock_* requirements for testdriver (coap_delete_node()).
2024-05-15 15:50:14 +01:00
Mario Kicherer 6673be3b43 coap_net: add coap_context_set/get_app_data and deprecate coap_set/get_app_data 2024-05-15 15:42:45 +01:00
Jon Shallow 706201539b tinydtls: Update to latest version 2024-05-14 09:40:07 +01:00
Jon Shallow 41ed5aa787 Nits: Tidy up code
Add documentation for coap_get_resource_from_uri_path().

Remove duplicate coap_get_resource_from_uri_path() definition.

Better fix for scan-build issue.

Update RIOT libcoap base version.
2024-05-14 09:31:48 +01:00
Patryk Jarosz 5234f41c2d Fixed missing event for server session removal 2024-05-14 09:14:59 +01:00
Harshit Malpani c17f582dc9 Fix build failures with mbedtls 3.6.0 2024-05-14 09:08:34 +01:00
Jon Shallow 8e05e18511 coap_session.c: Invoke NACK handler in coap_session_disconnected()
Do this for all cases, not just for ICMP issue.
2024-05-14 09:00:54 +01:00
Jon Shallow b4a011a0e9 coap_uri.c: Fix support for app doing CoAP <> HTTP mapping 2024-05-14 08:55:59 +01:00
Jon Shallow e521eab58b coap_openssl.c: Revert out using SSL_use_certificate_chain_file()
Go back to using SSL_use_certificate_file().
Unexpected side effects with CA validation which needs further
troubleshooting to get to root cause.
2024-05-13 08:55:48 +01:00
Jon Shallow 5d77688f2d coap_block.c: Support 16 bit size_t in coap_context_set_max_block_size()
Allows RIOT to compile with 16 bit size_t processors.
2024-05-09 21:02:54 +01:00
Jon Shallow b14521d555 oscore_cbor.c: Fix bad scan-build fix 2024-05-09 21:01:23 +01:00
Jon Shallow e599e25d6e oss-fuzz: Fix issue in coap_pdu_parse_opt() 2024-05-09 13:33:06 +01:00
Jon Shallow dae064c7e8 scan-build: Add scan-build into the workflow testing 2024-05-09 10:57:16 +01:00
Jon Shallow 4a94cc7c80 scan-build: Fix warnings 2024-05-09 10:57:16 +01:00
Jon Shallow d5a0d9c116 PKI: Add in coap_pki_key_define_t support to remaining TLS interfaces 2024-05-09 10:14:33 +01:00
Jon Shallow cec964e0b0 locking: Unlock context when calling request/response handlers
This is to reduce contention on the context lock when a request/response
handler takes time to get / update information.
2024-05-09 10:04:31 +01:00
Jon Shallow cd88fad218 coap_net.c: Silently drop incorrect CoAP version packets
As per https://datatracker.ietf.org/doc/html/rfc7252#section-3

Implementations of this specification MUST set this field to 1
(01 binary). Other values are reserved for future versions. Messages
with unknown version numbers MUST be silently ignored.
2024-05-09 09:58:40 +01:00
Jon Shallow 62a4934b6d coap_block.c: Use /.well-known/core when testing for Q-Block Support
It is possible the server does not support / resource, but does
support Q-Block - and responds with a 4.04, so Q-Block support
cannot be detected.
2024-05-06 10:50:30 +01:00
Jon Shallow a67426c655 coap_net.c: Tidy up Observe cancellation in coap_send()
If Observe cancellation is detected in sending pdu in coap_send()
invoke coap_cancel_observe() to to the necessary work.
2024-05-06 09:46:13 +01:00
Jon Shallow 9f9129cca8 OpenSSL: Add in support for configuring an alternative TLS ENGINE
Two new functions added

coap_tls_engine_configure()
coap_tls_engine_remove()

Added in new PKI key type coap_pki_key_define_t which allows the CA, Public Cert
and Private Key to be different types (e.g. PEM, DER etc.).

Added a new key type ENGINE to make use of the configured tls_engine.

Added in a -q option to coap-server and coap-client for testing ENGINE.

Note: ENGINE is only supported by OpenSSL.
2024-05-06 09:09:58 +01:00
kkrentz 466463304b Contiki-NG: Fix compilation error "unknown type name 'fd_set'" 2024-05-02 12:21:12 +01:00
Jon Shallow 9f1418e87d coap_block.c: Handle Block1 packets with random order block numbers
Add in new COAP_BLOCK_NOT_RANDOM_BLOCK1 option for
coap_context_set_block_mode(). This disables receipt of any Block1
packet (but not Q-BLock1) if the block numbers are not sequentially
received starting with 0.  A 4.08 code is returned for every packet
out of order and its data is ignored.

If COAP_BLOCK_SINGLE_BODY is set in coap_context_set_block_mode(),
but not COAP_BLOCK_NOT_RANDOM_BLOCK1, then all Block1 packets are
assembled in the correct order before passing the body up to the
application.  The receive logic will timeout after MAX_TRANSMIT_WAIT
(93 seconds) if there are any missing blocks, or 10 seconds if the
last block is seen.

If COAP_BLOCK_SINGLE_BODY is not set in coap_context_set_block_mode(),
and not COAP_BLOCK_NOT_RANDOM_BLOCK1, then the random order packets
are passed up to the application layer where it is the application's
responsibility to decide what to do with the randomly ordered packets,
and what response code to send.
2024-04-26 14:41:00 +01:00
Jon Shallow 758a341546 doc: Update coap_session_set_type_client() documentation 2024-04-25 14:52:44 +01:00
Jon Shallow 65f2f408be Build Tests: Fix Contiki build on macOS
Add libtool to the brew setup.
2024-04-25 14:46:07 +01:00
Jon Shallow ae438cb4bb man: Format examples as per CONTRIBUTION guidelines 2024-04-25 14:09:33 +01:00
Jon Shallow 749e16f6f6 Reporting: Encourage people to use github instead of mailing list 2024-04-23 16:43:17 +01:00
Jon Shallow c081bb6ffa doc: Tidy up documentation errors 2024-04-17 14:59:26 +01:00
Jon Shallow e3a662a934 wolfSSL: Set up initial port
Includes some porting ideas from qursa-uc3m libcoap-wolfssl work.

Some common ASN1 code moved from coap_gnutls.c to coap_asn1.c to support RPK.

WolfSSL build
$ ./configure --enable-all --enable-dtls13 CFLAGS="-DBUILD_TLS_PSK_WITH_AES_128_CCM -DHAVE_RPK"

Interoperability requirements

DTLS1.3 downgrade requires
https://github.com/eclipse/tinydtls/pull/230
https://github.com/wolfSSL/wolfssl/pull/7367

TLS1.3 downgrade requires
https://github.com/wolfSSL/wolfssl/pull/7367

(D)TLS1.2 use of RPK requires
https://github.com/wolfSSL/wolfssl/pull/7375

MbedTLS using TLS_ECDHE_PSK_WITH_CHACHA20_POLY1305_SHA256 requires
https://github.com/wolfSSL/wolfssl/pull/7132

GnuTLS using PSK and TLS1.3 requires
https://github.com/wolfSSL/wolfssl/pull/7407
2024-04-16 11:03:24 +01:00
Jon Shallow 04b239f55a main.yml: Fix node.js 16 warnings 2024-04-03 13:32:15 +01:00
Jon Shallow c88c783aea RIOT: Modify Kconfig / app.config to remove dep model 2024-04-02 21:28:57 +01:00
Jon Shallow 214665ac4b coap_pdu.c: Fix UndefinedBehaviorSanitizer: undefined-behavior
This fixes a reported error in coap_update_token() where a size_t
calculation is overflowed (but all ends up with the correct value).

Instead of adding an overflowed size_t, now subtract the reversed
size_t calculation as appropriate.

coap_update_option() and coap_insert_option() similarily updated.
2024-03-26 17:40:43 +00:00
Jon Shallow 0a39b6c03b versioning: Make current configure.ac version available in CMakeLists.txt
Create a CMakeLists.txt.in copy of CMakeLists.txt containing LIBCOAP_*
skeletons where appropriate. When ./configure is run, CMakeLists.txt then
gets updated with the latest versioning ready for distribution and using.

CMake unfortunately does not handle, for example, 4.3.5rc1 (the rc1 suffix)
for the "project (libcoap VERSION xxx)", so this has to end up as 4.3.5
in CMakeLists.txt.
2024-03-20 11:25:29 +00:00
Jon Shallow e3f7dbeec8 doc: Support hyper-linking to defined structures for man pages 2024-03-15 09:04:52 +00:00
Jon Shallow b332a188e5 Coverity: Fix 1584343
Reorganize code in the coap_lock_lock_func().
2024-03-15 09:02:19 +00:00