Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call DRBG_get_bytes() For Subscription Id Generation. #9995

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions src/app/ReadHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
#include <app/MessageDef/SubscribeResponse.h>
#include <app/ReadHandler.h>
#include <app/reporting/Engine.h>
#include <lib/support/RandUtils.h>

namespace chip {
namespace app {
Expand Down Expand Up @@ -545,11 +544,7 @@ CHIP_ERROR ReadHandler::ProcessSubscribeRequest(System::PacketBufferHandle && aP
ReturnLogErrorOnFailure(subscribeRequestParser.GetMinIntervalSeconds(&mMinIntervalFloorSeconds));
ReturnLogErrorOnFailure(subscribeRequestParser.GetMaxIntervalSeconds(&mMaxIntervalCeilingSeconds));

// TODO: Use GetSecureRandomData to generate subscription id
// it needs #include <support/crypto/CHIPRNG.h>, but somehow CHIPRNG.h is missing
// err = Platform::Security::GetSecureRandomData((uint8_t *) &mSubscriptionId, sizeof(mSubscriptionId));
// SuccessOrExit(err);
mSubscriptionId = GetRandU64();
ReturnLogErrorOnFailure(Crypto::DRBG_get_bytes(reinterpret_cast<uint8_t *>(&mSubscriptionId), sizeof(mSubscriptionId)));
emargolis marked this conversation as resolved.
Show resolved Hide resolved

MoveToState(HandlerState::GeneratingReports);

Expand Down
2 changes: 1 addition & 1 deletion src/lib/support/RandUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
*
* @note These utility functions do not generate cryptographically strong
* random number. To get cryptographically strong random data use
* chip::Platform::Security::GetSecureRandomData().
* chip::Crypto::DRBG_get_bytes().
*
*/

Expand Down
2 changes: 1 addition & 1 deletion src/lib/support/RandUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
*
* @note These utility functions do not generate cryptographically strong
* random number. To get cryptographically strong random data use
* chip::Platform::Security::GetSecureRandomData().
* chip::Crypto::DRBG_get_bytes().
*
*/

Expand Down