mirror of
https://github.com/espressif/openthread.git
synced 2026-07-30 23:57:47 +00:00
[border-agent] invoke ephemeral key callback on session connection (#10699)
This commit updates the Border Agent to invoke the ephemeral key callback when a commissioner candidate successfully establishes a secure session using the ephemeral key. This can be identified by checking the state `otBorderAgentGetState()` and matching it with `OT_BORDER_AGENT_STATE_ACTIVE`. This new signal can be used to stop advertising the mDNS service "_meshcop-e._udp" earlier (since the ephemeral key is one-time use).
This commit is contained in:
@@ -257,6 +257,9 @@ bool otBorderAgentIsEphemeralKeyActive(otInstance *aInstance);
|
||||
*
|
||||
* - The Border Agent starts using an ephemeral key.
|
||||
* - Any parameter related to the ephemeral key, such as the port number, changes.
|
||||
* - A commissioner candidate successfully establishes a secure session with the Border Agent using the ephemeral key.
|
||||
* This situation can be identified by `otBorderAgentGetState()` being `OT_BORDER_AGENT_STATE_ACTIVE` (this event
|
||||
* can be used to stop advertising the mDNS service "_meshcop-e._udp").
|
||||
* - The Border Agent stops using the ephemeral key due to:
|
||||
* - A direct call to `otBorderAgentClearEphemeralKey()`.
|
||||
* - The ephemeral key timing out.
|
||||
|
||||
@@ -52,7 +52,7 @@ extern "C" {
|
||||
*
|
||||
* @note This number versions both OpenThread platform and user APIs.
|
||||
*/
|
||||
#define OPENTHREAD_API_VERSION (459)
|
||||
#define OPENTHREAD_API_VERSION (460)
|
||||
|
||||
/**
|
||||
* @addtogroup api-instance
|
||||
|
||||
@@ -655,6 +655,7 @@ void BorderAgent::HandleConnected(SecureTransport::ConnectEvent aEvent)
|
||||
if (mUsingEphemeralKey)
|
||||
{
|
||||
mCounters.mEpskcSecureSessionSuccesses++;
|
||||
mEphemeralKeyTask.Post();
|
||||
}
|
||||
else
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user