This commit refactors the `AesCcm` class to simplify its public interface,
decoupling the high-level API from the underlying cryptographic execution.
Key improvements:
- Redesigned the API from a series of procedural method calls
(`Init()`, `Header()`, `Payload()`, `Finalize()`) into a unified,
stateful model. Callers now pre-configure the operation parameters using
dedicated setters (`SetKey()`, `SetNonce()`, `SetAuthData()`,
`SetTagLength()`) and execute the entire cryptographic operation in a
single step via unified `Process()` methods.
- Introduced a nested `Engine` class to encapsulate the low-level AES-CCM
mathematical and cryptographic state. The `Engine` provides clean internal
interfaces for both optimized one-shot (single-part) and multi-part
operations.
- This architectural separation allows the outer `AesCcm` class to focus on
parameter validation, high-level buffer management, and complex `Message`
chunk iterations, while the `Engine` remains focused purely on the
cryptographic core. This also provides a clean extension point to easily
route one-shot operations to platform-specific hardware acceleration APIs
in the future.
- Updated `Mac` and `Mle` modules to use the simplified APIs, reducing
boilerplate code.
- Retained a static `Perform()` wrapper to support the legacy public
`otCrypto` API.
- Updated unit tests to validate the new stateful interfaces, including
robust in-place message chunk processing and separate-buffer
validations.
This commit removes unnecessary `#include` directives in core `cpp`
files that already include `instance.hpp`. The `instance.hpp` header
itself includes all necessary OT core headers and definitions as they
are contained within an `ot::Instance`.
This commit moves the locator `GetProvider::Get<Type>()` and its
related `Timer` and `Tasklet` methods to `instance.hpp`. With this
change we can remove `locator_getters.hpp` header fully thus
simplifying the code.
This commit harmonizes and simplifies the code related to asserting
that the OT API pointer parameters are valid and not `nullptr`.
`OPENTHREAD_CONFIG_ASSERT_CHECK_API_POINTER_PARAM_FOR_NULL` is added
which when used performs assert check on all pointer inputs to APIs.
This is either done within `AsCoreType()` when the pointer is
converted to its related core type, or by a direct call to newly added
macro `AssertPointerIsNotNull()`.
Since enabling assert checks on every API parameter can increase code
size, this config is disabled by default and it is recommended to use
it during debugging only.
This commit adds header file `common/as_core_type.hpp` which adds
helper functions `AsCoreType()` which help convert from a
public C OpenThread type to its corresponding C++ core type (e.g.,
`otIp6Address` to `Ip6::Address`). This commit also adds `MapEnum()`
function to convert between public and core `enum` definitions (e.g.,
`otMacFilterAddressMode` and `Mac::Filter::Mode`). These helper
function act as syntactic sugar helping simplify the implementations
of OT API functions (in `api/{module}_api.cpp` files).
- New format for MAC keys, as a union between literal key and keyrefs.
- Modified key_manager to handle both literal keys or keyrefs.
- Modified MAC and sub_mac modules to handle both Literal Keys or keyrefs.
- Updated Crypto Modules to use abstracted APIs.
- New CLIs to handle networkkey and pskc references.
This commit harmonizes how the feature config checks are done within
OT core modules. In header `.hpp` files, any related `#if` config
check is done immediately after the `"openthread-core-config.h"` is
included. This way the rest of definitions are skipped over if the
feature is not being used. In `cpp` source files the `#if` check is
done immediately after including the related header file.
- add a new enumeration type `Mode` to indicate the encryption vs.
decryption mode in `AesCcm::Payload()` method.
- add `GetTagLength()` method and simplify `Finalize()`.
- change `AesCcm::Init()` to assert on bad tag length input param
instead of returning `OT_ERROR_INVALID_ARGS`.
- reorder AesCcm member variable to help with alignments
- use CHAR_BIT
- remove check of tag length from Finalize
- use `memcpy`/`memset` to copy/clear buffers
This commit adds a new OpenThread specific `OT_ASSERT()` macro along
with a new config OPENTHREAD_CONFIG_ASSERT_ENABLE option which allows
the assert to be enabled or disabled. This allows a release build to
consider disabling the assert reducing code size. This commit also
adds a new travis (simulation platform) build with asserts disabled.
This commit changes how the objects in OpenThread access each other.
It adds a template `Get<Type>()` method in `InstanceLocator`. This
method returns a reference to a given `Type` object belonging to the
OpenThread instance (e.g. `Get<MeshForwarder>()` returns a reference
to `MeshForwarder` object on the OpenThread instance). The
`InstanceLocator` is used as base class of all OpenThread classes so
every class can easily access any other object. This commit also
changes how the main instance is retrieved in `InstanceLocator` for
the single-instance case. The method `GetInstance()` directly uses the
raw buffer `gInstanceRaw`. This change helps make the `GetInstance()`
and in turn all `Get<Type>()` methods in-line. This commit also
removes the existing getters across all classes to use the new
`Get<Type>()` model.
This commit simplifies the config header files includes in
OpenThread core and non-public source files. With this change the
"openthread-core-config.h" becomes the main config header file. This
header file includes all other config ones:
1) The `configure` generated `<openthread/config.h>;
2) The project specific one by `OPENTHREAD_PROJECT_CORE_CONFIG_FILE`;
3) The "openthread-core-default-config.h" defining default settings.
With the change in this commit, all header files include "openthread-
core-config.h" as the first `#include`, and in `.cpp` files, the first
`#include` continues to be the unit's corresponding header file. The
new model ensures that the configuration settings are visible and
consistent in all the source files. This commit also updates the
style guide document accordingly.
* Add dhcp6 client define, and update openthred-config include scheme
* #1663 - update include to use quotes instead of angle brackets
* #1663 - update file to use underscore instead of dash
* #1663 - remove extra space
* #1663 - update location of new header file and update files to point to it
* #1663 - update location of new header file and update files to point to it
* #1663 update makefile.am to include new header
* update for make pretty changes
* more pretty fixes
* cleanup, and remove automatic mbedtls change
* remove debugging change
* #1663 - Remove extra space, and change include to use angle brackets instead of quotes.
* rename the enable defines file to openthred_config
* #1663 clean up for code review
* #1663 - clean up last nits
* #1663 - missed merge conflicts - file openthread-config.h -> openthread/openthread_config.h