mirror of
https://github.com/espressif/openthread.git
synced 2026-08-18 00:19:52 +00:00
[srp] simplify crypto ReadOrGenerateKey in srp client (#9764)
In method `ReadOrGenerateKey` removing call to `GetPublicKey` which was unnecessary operation (value was't used afterward).
This commit is contained in:
@@ -961,19 +961,16 @@ Error Client::ReadOrGenerateKey(Crypto::Ecdsa::P256::KeyPairAsRef &aKeyRef)
|
||||
|
||||
if (error == kErrorNone)
|
||||
{
|
||||
Crypto::Ecdsa::P256::PublicKey publicKey;
|
||||
|
||||
if (keyPair.GetPublicKey(publicKey) == kErrorNone)
|
||||
if (aKeyRef.ImportKeyPair(keyPair) != kErrorNone)
|
||||
{
|
||||
SuccessOrExit(error = aKeyRef.ImportKeyPair(keyPair));
|
||||
IgnoreError(Get<Settings>().Delete<Settings::SrpEcdsaKey>());
|
||||
ExitNow();
|
||||
SuccessOrExit(error = aKeyRef.Generate());
|
||||
}
|
||||
IgnoreError(Get<Settings>().Delete<Settings::SrpEcdsaKey>());
|
||||
}
|
||||
|
||||
error = aKeyRef.Generate();
|
||||
|
||||
else
|
||||
{
|
||||
SuccessOrExit(error = aKeyRef.Generate());
|
||||
}
|
||||
exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user