oscore_validate_sender_seq() moves the replay window on before the
message has been decrypted, and oscore_roll_back_seq() is meant to undo
that when decryption fails. It only restored last_seq and
sliding_window when the saved values were non zero, and never restored
initial_state. For a recipient context still in its initial state
(rfc8613_b_1_2 false), or one whose last_seq is 0, a single request
with a forged Partial IV and an invalid tag left last_seq at the
sender's chosen value, so the genuine peer's following requests were
rejected as outside the replay window.
The client did not roll back at all when a response failed decryption,
and the server called oscore_update_seq_num_cb() with the new window
before decrypting the request, so credential storage could be updated
with a forged sequence number even when the in memory window was
restored.
Record whether there is a window update to undo and restore
initial_state with it, roll back on response decryption failure as
well, and only call oscore_update_seq_num_cb() once the request has
been decrypted.
Add a unit test.
Add reference counting to recipient contexts so they can be safely removed
while still in use by active sessions. Expose callback hooks for credential
lookup, echo, and sequence storage to allow custom backends.
Expand example server to demonstrate the external storage via a simple
file based database. Expand coap_oscore_rcp_conf_t to enable settings
preconfigured echo value, sequence counter and window value as uint64
Enable temporary credentials returned by the find function and are destroyed
after use.
Include common system header files in coap_internal.h based on HAVE_*H
definitions.
Remove these system header files from include/*/*.h.
Add in system header files where appropriate in various apps.
Some of the Zephyr include files need to be C++, not C based. The 'extern "C"'
wrapper in include/coap3/coap.h means that all #include are treated as being C.
Remove 'extern "C"' wrapper from include/coap3/coap.h and add wrapper to
include files after #include and before any function / structure definitions.
Add in a C++ build test for CI.
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.
Add in optional callbacks for when dynamic resources are setup and deleted.
Add in optional callbacks for when observe subscriptions start and stop.
Add in optional callbacks for when the observe counter is updated (can be
ratelimited) for a resource as well as track when a resource is deleted.
Add is support for new functions
Main functions with libcoap tracking support are
coap_persist_startup()
coap_persist_stop()
coap-server has -t option to track observe information.
UDP sessions supported, as well as OSCORE over UDP.
Documentation updated
libcoap tracking support (as opposed to application tracking) is configurable.
Based on work done in https://gitlab.informatik.uni-bremen.de/obergman/libcoap
New directories with files
include/oscore
src/oscore
New files
include/coap3/coap_oscore.h
include/coap3/coap_crypto_internal.h
include/coap3/coap_oscore_internal.h
man/coap-oscore-conf.txt.in
man/coap_oscore.txt.in
src/coap_oscore.c
tests/test_oscore.c
tests/test_oscore.h
Supported by new option (enabled by default)
./configure --enable-oscore
cmake .. -DENABLE_OSCORE=ON
Requires a TLS library configured to do the OSCORE encryption and hashing.