Skip to content

Commit

Permalink
[Android] Fix Android commissioning complete fail (#20098)
Browse files Browse the repository at this point in the history
* Change to move KeyPair variable

* Add comment
  • Loading branch information
joonhaengHeo authored and pull[bot] committed Oct 5, 2023
1 parent 81e18a9 commit 6011573
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/controller/java/AndroidDeviceControllerWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,9 @@ AndroidDeviceControllerWrapper * AndroidDeviceControllerWrapper::AllocateNew(
}
MutableByteSpan rcacSpan(rcac.Get(), kMaxCHIPDERCertLength);

// The lifetime of the ephemeralKey variable must be kept until SetupParams is saved.
Crypto::P256Keypair ephemeralKey;

if (rootCertificate != nullptr && intermediateCertificate != nullptr && nodeOperationalCertificate != nullptr &&
keypairDelegate != nullptr)
{
Expand All @@ -217,7 +220,6 @@ AndroidDeviceControllerWrapper * AndroidDeviceControllerWrapper::AllocateNew(
}
else
{
Crypto::P256Keypair ephemeralKey;
*errInfoOnFailure = ephemeralKey.Initialize();
if (*errInfoOnFailure != CHIP_NO_ERROR)
{
Expand Down

0 comments on commit 6011573

Please sign in to comment.