`struct ieee802154_config config` is a struct containing an
union. Members of `config` were accessed incorrectly in
`otPlatRadioEnableCsl`. Fix by initializing `config` with `0`
and accessing one member at a time.
Signed-off-by: Maciej Baczmanski <maciej.baczmanski@nordicsemi.no>
- In `set_vendor_ie_header_lm`, case when
`link_metrics_data_len == 0` has been ignored.
This commit fixes that by setting `header_ie->length = 0`
before returning.
- current implementation of enh ACK header IE returns
`-ENOTSUP` when `ack_ie.header_ie == NULL` or
`ack_ie.header_ie->length == 0`. This commit fixes that by
refactoring checks in `nrf5_configure`.
Co-authored-by: Przemyslaw Bida <przemyslaw.bida@nordicsemi.no>
Signed-off-by: Maciej Baczmanski <maciej.baczmanski@nordicsemi.no>
According to PSA specification in case of `PSA_KEY_TYPE_ECC_KEY_PAIR`
function `psa_import_key` takes private key from key pair as argument.
This commit adds extraction of Private key from ECDSA key pair.
Also removes not needed `otPlatCryptoEcdsaGetPublicKey`.
Signed-off-by: Przemyslaw Bida <przemyslaw.bida@nordicsemi.no>
Platforms calculate Link Metrics values internally after using
`otPlatRadioConfigureEnhAckProbing`.
Signed-off-by: Eduardo Montoya <eduardo.montoya@nordicsemi.no>
When OpenThread application is built with CONFIG_ASSERT
and CONFIG_ASSERT_NO_MSG_INFO, OT_ASSERT() prints a location
that points to the otPlatAssertFail() function instead of
the code that actually failed an assertion.
This is confusing and CONFIG_ASSERT_NO_MSG_INFO sometimes
cannot be disabled because of flash size limitations.
Make otPlatAssertFail() always print the actual assert
location.
Signed-off-by: Damian Krolik <damian.krolik@nordicsemi.no>
Remove two workarounds in OpenThread's PSA crypto backend
that were required when Zephyr used pre-1.5 TF-M version:
1. psa_open_key() is no longer needed to reference
a persistent key
2. psa_cipher_encrypt() can be used to simplify AES
encryption
Signed-off-by: Damian Krolik <damian.krolik@nordicsemi.no>
This commit adds new types of keys and algorithm to crypto_psa backend
of openthread.
Added options:
- `OT_CRYPTO_KEY_TYPE_ECDSA`
- `OT_CRYPTO_KEY_ALG_ECDSA`
- `OT_CRYPTO_KEY_USAGE_VERIFY_HASH`
Signed-off-by: Przemyslaw Bida <przemyslaw.bida@nordicsemi.no>
This commit implements `otPlatResetToBootloader` in two ways:
- trigger reset to bootloader using boot mode retention API
- trigger reset to bootloader by triggering GPIO pin (applicable
for nRF52840 Dongle)
Signed-off-by: Maciej Baczmanski <maciej.baczmanski@nordicsemi.no>
Added `OT_PLATFORM_POWER_CALIBRATION` and set to always off
as in Zephyr power calibration is handled by Radio Driver.
Signed-off-by: Maciej Baczmanski <maciej.baczmanski@nordicsemi.no>
Remove `IEEE802154_SELECTIVE_TXPOWER` option.
Cache the tx power value in nRF5 driver and make use of it on each
operation.
Signed-off-by: Eduardo Montoya <eduardo.montoya@nordicsemi.no>
Signed-off-by: Jędrzej Ciupis <jedrzej.ciupis@nordicsemi.no>
This commit introduces `kconfig_to_ot_option` to simply fye the way of
adding openthread related kconfigs.
Signed-off-by: Przemyslaw Bida <przemyslaw.bida@nordicsemi.no>
IEEE 802.15.4-2020 defines four possible values for Key Identifier Mode
field of the Auxiliary Security Header. The current ieee802154 driver
API only supports two of them: b00 and b01. This commit adds support for
the two remaining Key Identifier Mode values. It's done by replacing a
field that can only hold Key Index into a field that can holds a pointer
to the entire Key Identifier field.
See IEEE 802.15.4-2020, sections 9.4.2.3 and 9.4.4 for further reference.
Signed-off-by: Jędrzej Ciupis <jedrzej.ciupis@nordicsemi.no>
This commit adds bbtc implementation.
New file in modules/openthread/platform/ble.c
New corresponding kconfig option `OPENTHREAD_BLE_TCAT`.
Co-authored-by: Piotr Jasiński <piotr.jasinski@nordicsemi.no>
Signed-off-by: Przemyslaw Bida <przemyslaw.bida@nordicsemi.no>
Signed-off-by: Piotr Jasiński <piotr.jasinski@nordicsemi.no>
This commit bumps openthread commit to `4ed44bc`
and implements `CONFIG_OPENTHREAD_MULTIPAN_RCP` option.
Signed-off-by: Przemyslaw Bida <przemyslaw.bida@nordicsemi.no>
Regular OpenThread upmerge to commit `75694d2`.
Move CONFIG_OPENTHREAD_PLATFORM_KEY_REFERENCES_ENABLE
from header file to Kconfig.
Signed-off-by: Maciej Baczmanski <maciej.baczmanski@nordicsemi.no>
Fixes an issue whereby a rename of a variable type has been
forgotten in an instance, which now uses the correct type name
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Uart driver for openthread have been waiting for host to start
communicating with coprocessor, during booting of the Zephyr and
by that blocking start os OS. There is no longer a need for
that since the stack will be soft rebooted after host connects
to coprocessor, removing the need to wait on host communication.
Signed-off-by: Przemyslaw Bida <przemyslaw.bida@nordicsemi.no>
This change slightly simplifies the configuration of a CSL receiver and
generalized CSL_RX_TIME to EXPECTED_RX_TIME as a re-usable primitive
across several timing-sensitive IEEE 802.15.4 standard sub-protocols
(namely BE-PANs/DSME/CSL/RIT/TSCH).
This API change is based on the rules outlined in RFC #61227.
Fixes: #62918
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
Improves standard conformance of the IEEE802154_CONFIG_ENH_ACK_HEADER_IE
option and introduces certain "soft MAC" capabilities around header IEs:
* Introduces types and helpers that allow driver maintainers to
represent, parse, write and validate header IEs.
* Introduces helper functions to access non-aligned fields in header
IEs, namely element IDs.
Updates the only existing L2 and driver pair that uses
IEEE802154_CONFIG_ENH_ACK_HEADER_IE: OpenThread platform radio and nRF5
and improves header IE validation in the nRF5 driver.
This change should help further driver maintainers to support
OpenThread's CSL and vendor IE extensions. It is based on the rules
specified in RFC #61227.
It is also a precondition to generically support both, "soft MAC" and
"hard MAC", approaches to header IEs in the TSCH protocol, namely the
time synchronization IE.
Fixes: #62940
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
"Sleeping" has a well defined meaning in Zephyr related to threading and
power management. This differs from OpenThread's definition:
- Deprecates the "SLEEP_TO_TX" capability as it is redundant and
conflicts with all of Zephyr's nomenclature, #61227, RFC 2863, Thread
standard and IEEE 802.15.4. This binds the API to an implementation
detail of OpenThread, instead. See #63670 for the agreed migration path.
- Renames the "SLEEP" event to "RX_OFF" which conforms to the
nomenclature in Zephyr, this API and IEEE 802.15.4.
Fixes: #62995
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
rand32.h does not make much sense, since the random subsystem
provides more APIs than just getting a random 32 bits value.
Rename it to random.h and get consistently with other
subsystems.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
A little refactoring that simplifies dealing with nanosecond timestamp
values in packets and further decouples calling code from PTP:
Benefits:
- simplifies calling code by removing redundant conversions.
- prepares for removing PTP dependencies from net_pkt.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
Code using sys_csrand_get should depend on CONFIG_CSPRNG_ENABLED symbol
and not in ENTROPY_HAS_DRIVER since they are not using the entropy
device directly.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
If asserts are disabled, there is a warning in 'otPlatCryptoInit'
regarding unused variable `err`. This commit fixes that.
Signed-off-by: Maciej Baczmanski <maciej.baczmanski@nordicsemi.no>
Synchronizes with the new upstream RX/TX timestamp definition in
OpenThread based on the standard's SFD.
This change is synchronized with the upstream OpenThread implementation
via west.yml.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
In OpenThread, Settings are initialized after KeyManager by default.
If device uses PSA with emulated TFM, Settings have to be initialized
at the end of otPlatCryptoInit(), to be available before storing
Network Key.
Signed-off-by: Maciej Baczmanski <maciej.baczmanski@nordicsemi.no>
Based on the standard based definitions given in previous commits, the
TX timestamp used for timed TX now refers to the start of PHR. As OT
continues to calculate timestamps based on a "start of SHR" definition,
the duration of the PHY specific SHR is added in the OT adaptation layer
to make up for this OT quirk.
Fixes: #59245
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
Builds upon the newly introduced nrf_802154_phr_timestamp_get() function
to calculate RX timestamps according to the timestamp definitions
introduced in earlier commits and removes the prior workaround to
calculate the start-of-frame message timestamp point.
Fixes: #59245
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
OT does not have 64 bit timestamp support. This is a limitation of OT
and not of the IEEE 802.15.4 driver API. Therefore any workaround
related to such OT idiosyncracies should be encapsulated inside the OT
adapatation layer.
This change moves the OT-specific conversion of OT 32 bit timestamps to
Zephyr 64 bit timestamps into the OT adaptation layer.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
The psa_generate_random function requires the psa_crypto_init call
before the usage. This can be ensured by calling the psa_crypto_init
in otPlatCryptoRandomInitfunction.
Signed-off-by: Arkadiusz Balys <arkadiusz.balys@nordicsemi.no>
The IEEE 802.15.4 API and networking subsystem were using several
inconsistent timestamp resolutions and types. This change defines all
timestamps with nanosecond resolution and reduces the number of
available types to represent timestamps to two:
* `struct net_ptp_time` for PTP timestamps
* `net_time_t` for all other high resolution timestamps
All timestamps (including PTP timestamps) are now referred to a
"virtual" local network subsystem clock source based on the well-defined
types above. It is the responsibility of network subsystem L2/driver
implementations (notably Ethernet and IEEE 802.15.4 L2 stacks) to ensure
consistency of all timestamps and radio timer values exposed by the
driver API to such a network subsystem uptime reference clock
independent of internal implementation details.
The "virtual" network clock source may be implemented based on arbitrary
hardware peripherals (e.g. a coarse low power RTC counter during sleep
time plus a high resolution/high precision radio timer while receiving
or sending). Such implementation details must be hidden from API
clients, as if the driver used a single high resolution clock source
instead.
For IEEE 802.15.4, whenever timestamps refer to packet send or receive
times, they are measured when the end of the IEEE 802.15.4 SFD (message
timestamp point) is present at the local antenna (reference plane).
Due to its limited range of ~290 years, net_time_t timestamps (and
therefore net_pkt timestamps and times) must not be used to represent
absolute points in time referred to an external epoch independent of
system uptime (e.g. UTC, TAI, PTP, NTP, ...).
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
This commit replaces direct entropy device driver class with
`sys_csrand_get`, which is recommended way of getting crypto
secure random buffer.
Signed-off-by: Przemyslaw Bida <przemyslaw.bida@nordicsemi.no>
The IEEE 802.15.4 stack defines radio API helpers that provide
simplified and encapsulated access to radio API features.
These helpers were missing the `_radio_` infix. This infix is introduced
to clearly distinguish between MAC and PHY concerns. While PHY features
may be shared between L2 implementations (including the functions
concerned here), this is not true for MAC features.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>