Skip to content

Commit

Permalink
Allocating partialDacVerifier in initWithFactory and checking if allo…
Browse files Browse the repository at this point in the history
…cation failed
  • Loading branch information
sharadb-amazon committed Aug 27, 2022
1 parent 38fb9dc commit 6723226
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/darwin/Framework/CHIP/MTRDeviceController.mm
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
static NSString * const kErrorOperationalCredentialsInit = @"Init failure while creating operational credentials delegate";
static NSString * const kErrorOperationalKeypairInit = @"Init failure while creating operational keypair bridge";
static NSString * const kErrorPairingInit = @"Init failure while creating a pairing delegate";
static NSString * const kErrorPartialDacVerifierInit = @"Init failure while creating a partial DAC verifier";
static NSString * const kErrorPairDevice = @"Failure while pairing the device";
static NSString * const kErrorUnpairDevice = @"Failure while unpairing the device";
static NSString * const kErrorStopPairing = @"Failure while trying to stop the pairing process";
Expand Down Expand Up @@ -104,6 +105,11 @@ - (instancetype)initWithFactory:(MTRControllerFactory *)factory queue:(dispatch_
return nil;
}

_partialDACVerifier = new chip::Credentials::PartialDACVerifier();
if ([self checkForInitError:(_partialDACVerifier != nullptr) logMsg:kErrorPartialDacVerifierInit]) {
return nil;
}

_operationalCredentialsDelegate = new MTROperationalCredentialsDelegate();
if ([self checkForInitError:(_operationalCredentialsDelegate != nullptr) logMsg:kErrorOperationalCredentialsInit]) {
return nil;
Expand Down Expand Up @@ -239,8 +245,6 @@ - (BOOL)startup:(MTRDeviceControllerStartupParamsInternal *)startupParams

_operationalCredentialsDelegate->SetDeviceCommissioner(_cppCommissioner);

_partialDACVerifier = new chip::Credentials::PartialDACVerifier();

commissionerParams.operationalCredentialsDelegate = _operationalCredentialsDelegate;

commissionerParams.controllerRCAC = _operationalCredentialsDelegate->RootCertSpan();
Expand Down

0 comments on commit 6723226

Please sign in to comment.