Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: project-chip/connectedhomeip
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 489bcf9e52bf3284ee9aa1598acd2e2a1706401b
Choose a base ref
..
head repository: project-chip/connectedhomeip
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: f62606e28968044074ee941133b2944b70cc774f
Choose a head ref
Showing with 12 additions and 6 deletions.
  1. +4 −1 src/darwin/Framework/CHIP/MTRDeviceController.h
  2. +8 −5 src/darwin/Framework/CHIP/MTRDeviceController.mm
5 changes: 4 additions & 1 deletion src/darwin/Framework/CHIP/MTRDeviceController.h
Original file line number Diff line number Diff line change
@@ -143,7 +143,10 @@ NS_ASSUME_NONNULL_BEGIN
* Returns nil on errors (e.g. salt has the wrong size), otherwise the computed
* verifier bytes.
*/
+ (nullable NSData *)computePASEVerifierForSetupPasscode:(NSNumber *)setupPasscode iterations:(NSNumber *)iterations salt:(NSData *)salt error:(NSError * __autoreleasing *)error;
+ (nullable NSData *)computePASEVerifierForSetupPasscode:(NSNumber *)setupPasscode
iterations:(NSNumber *)iterations
salt:(NSData *)salt
error:(NSError * __autoreleasing *)error;

/**
* Shut down the controller. Calls to shutdown after the first one are NO-OPs.
13 changes: 8 additions & 5 deletions src/darwin/Framework/CHIP/MTRDeviceController.mm
Original file line number Diff line number Diff line change
@@ -552,21 +552,24 @@ - (void)setNocChainIssuer:(id<MTRNOCChainIssuer>)nocChainIssuer queue:(dispatch_
});
}

+ (nullable NSData *)computePASEVerifierForSetupPasscode:(NSNumber *)setupPasscode iterations:(NSNumber *)iterations salt:(NSData *)salt error:(NSError * __autoreleasing *)error
+ (nullable NSData *)computePASEVerifierForSetupPasscode:(NSNumber *)setupPasscode
iterations:(NSNumber *)iterations
salt:(NSData *)salt
error:(NSError * __autoreleasing *)error
{
// Spake2pVerifier::Generate takes the passcode by non-const reference for some reason.
uint32_t unboxedSetupPasscode = [setupPasscode unsignedIntValue];
// Spake2pVerifier::Generate takes the passcode by non-const reference for some reason.
uint32_t unboxedSetupPasscode = [setupPasscode unsignedIntValue];
chip::Spake2pVerifier verifier;
CHIP_ERROR err = verifier.Generate([iterations unsignedIntValue], AsByteSpan(salt), unboxedSetupPasscode);
if ([MTRDeviceController checkForError:err logMsg:kErrorSpake2pVerifierGenerationFailed error:error]) {
return nil;
return nil;
}

uint8_t serializedBuffer[chip::Crypto::kSpake2p_VerifierSerialized_Length];
chip::MutableByteSpan serializedBytes(serializedBuffer);
err = verifier.Serialize(serializedBytes);
if ([MTRDeviceController checkForError:err logMsg:kErrorSpake2pVerifierSerializationFailed error:error]) {
return nil;
return nil;
}

return AsData(serializedBytes);