aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhemanth-silabs <50145824+hemanth-silabs@users.noreply.github.com>2021-09-08 22:52:09 +0100
committerGitHub <noreply@github.com>2021-09-08 14:52:09 -0700
commit77e04bf231743d0b5186c934fbb4688abc3a7604 (patch)
tree516afe05177dd1ed06d7f2d288319c15b7232bec /src
parent4249c261c7909be193c21ea5ba4743ee41bc8793 (diff)
downloadot-br-posix-77e04bf231743d0b5186c934fbb4688abc3a7604.tar.gz
[crypto] update otThreadGetNetworkKey and otThreadGetPskc usage (#992)
To align with ARM PSA changes.
Diffstat (limited to 'src')
-rw-r--r--src/agent/border_agent.cpp8
-rw-r--r--src/dbus/server/dbus_thread_object.cpp9
-rw-r--r--src/openwrt/ubus/otubus.cpp16
3 files changed, 20 insertions, 13 deletions
diff --git a/src/agent/border_agent.cpp b/src/agent/border_agent.cpp
index 00dae386..8a252635 100644
--- a/src/agent/border_agent.cpp
+++ b/src/agent/border_agent.cpp
@@ -373,10 +373,12 @@ bool BorderAgent::IsThreadStarted(void) const
bool BorderAgent::IsPskcInitialized(void) const
{
- bool initialized = false;
- const otPskc *pskc = otThreadGetPskc(mNcp.GetInstance());
+ bool initialized = false;
+ otPskc pskc;
- for (uint8_t byte : pskc->m8)
+ otThreadGetPskc(mNcp.GetInstance(), &pskc);
+
+ for (uint8_t byte : pskc.m8)
{
if (byte != 0x00)
{
diff --git a/src/dbus/server/dbus_thread_object.cpp b/src/dbus/server/dbus_thread_object.cpp
index e6adeb67..e1bfa63f 100644
--- a/src/dbus/server/dbus_thread_object.cpp
+++ b/src/dbus/server/dbus_thread_object.cpp
@@ -597,11 +597,12 @@ exit:
otError DBusThreadObject::GetNetworkKeyHandler(DBusMessageIter &aIter)
{
- auto threadHelper = mNcp->GetThreadHelper();
- const otNetworkKey * networkKey = otThreadGetNetworkKey(threadHelper->GetInstance());
- std::vector<uint8_t> keyVal(networkKey->m8, networkKey->m8 + sizeof(networkKey->m8));
- otError error = OT_ERROR_NONE;
+ auto threadHelper = mNcp->GetThreadHelper();
+ otNetworkKey networkKey;
+ otError error = OT_ERROR_NONE;
+ otThreadGetNetworkKey(threadHelper->GetInstance(), &networkKey);
+ std::vector<uint8_t> keyVal(networkKey.m8, networkKey.m8 + sizeof(networkKey.m8));
VerifyOrExit(DBusMessageEncodeToVariant(&aIter, keyVal) == OTBR_ERROR_NONE, error = OT_ERROR_INVALID_ARGS);
exit:
diff --git a/src/openwrt/ubus/otubus.cpp b/src/openwrt/ubus/otubus.cpp
index 9300c778..f0626339 100644
--- a/src/openwrt/ubus/otubus.cpp
+++ b/src/openwrt/ubus/otubus.cpp
@@ -1104,16 +1104,20 @@ int UbusServer::UbusGetInformation(struct ubus_context * aContext,
}
else if (!strcmp(aAction, "networkkey"))
{
- char outputKey[NETWORKKEY_LENGTH] = "";
- const uint8_t *key = reinterpret_cast<const uint8_t *>(otThreadGetNetworkKey(mController->GetInstance()));
- OutputBytes(key, OT_NETWORK_KEY_SIZE, outputKey);
+ char outputKey[NETWORKKEY_LENGTH] = "";
+ otNetworkKey key;
+
+ otThreadGetNetworkKey(mController->GetInstance(), &key);
+ OutputBytes(key.m8, OT_NETWORK_KEY_SIZE, outputKey);
blobmsg_add_string(&mBuf, "Networkkey", outputKey);
}
else if (!strcmp(aAction, "pskc"))
{
- char outputPskc[NETWORKKEY_LENGTH] = "";
- const otPskc *pskc = otThreadGetPskc(mController->GetInstance());
- OutputBytes(pskc->m8, OT_NETWORK_KEY_SIZE, outputPskc);
+ char outputPskc[NETWORKKEY_LENGTH] = "";
+ otPskc pskc;
+
+ otThreadGetPskc(mController->GetInstance(), &pskc);
+ OutputBytes(pskc.m8, OT_PSKC_MAX_SIZE, outputPskc);
blobmsg_add_string(&mBuf, "pskc", outputPskc);
}
else if (!strcmp(aAction, "extpanid"))