From a06578dabf292718a266968190d09310853dda5d Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Wed, 24 Aug 2022 02:48:23 +0000 Subject: [PATCH] Restyled by clang-format --- .../Framework/CHIP/MTRDeviceController.h | 4 +- .../Framework/CHIP/MTRDeviceController.mm | 50 +++++++++---------- 2 files changed, 24 insertions(+), 30 deletions(-) diff --git a/src/darwin/Framework/CHIP/MTRDeviceController.h b/src/darwin/Framework/CHIP/MTRDeviceController.h index 1b02d115ecd699..eb5d4533ec2d37 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceController.h +++ b/src/darwin/Framework/CHIP/MTRDeviceController.h @@ -137,9 +137,7 @@ typedef void (^MTRDeviceConnectionCallback)(MTRBaseDevice * _Nullable device, NS * @param[in] iterations The number of iterations to use when generating the verifier * @param[in] salt The 16-byte salt for verifier computation */ -- (nullable NSData *)computePaseVerifier:(uint32_t)setupPincode - iterations:(uint32_t)iterations - salt:(NSData *)salt; +- (nullable NSData *)computePaseVerifier:(uint32_t)setupPincode iterations:(uint32_t)iterations salt:(NSData *)salt; /** * Shutdown the controller. Calls to shutdown after the first one are NO-OPs. diff --git a/src/darwin/Framework/CHIP/MTRDeviceController.mm b/src/darwin/Framework/CHIP/MTRDeviceController.mm index 0e765e1edf5806..ef05d683cde84e 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceController.mm +++ b/src/darwin/Framework/CHIP/MTRDeviceController.mm @@ -668,36 +668,32 @@ - (void)setNocChainIssuer:(id)nocChainIssuer queue:(dispatch_ }); } -- (nullable NSData *)computePaseVerifier:(uint32_t)setupPincode - iterations:(uint32_t)iterations - salt:(NSData *)salt { - __block CHIP_ERROR errorCode = CHIP_ERROR_INCORRECT_STATE; - if (![self isRunning]) { - [self checkForError:errorCode logMsg:kErrorNotRunning error:nil]; - return nil; - } - - __block NSData *result; - __block chip::Spake2pVerifier paseVerifier; - __block chip::ByteSpan saltByteSpan = - chip::ByteSpan(static_cast(salt.bytes), salt.length); - - dispatch_sync(_chipWorkQueue, ^{ - if ([self isRunning]) { - errorCode = self.cppCommissioner->ComputePASEVerifier(iterations, setupPincode, saltByteSpan, - paseVerifier); - MTR_LOG_ERROR("ComputePaseVerifier: %s", chip::ErrorStr(errorCode)); +- (nullable NSData *)computePaseVerifier:(uint32_t)setupPincode iterations:(uint32_t)iterations salt:(NSData *)salt +{ + __block CHIP_ERROR errorCode = CHIP_ERROR_INCORRECT_STATE; + if (![self isRunning]) { + [self checkForError:errorCode logMsg:kErrorNotRunning error:nil]; + return nil; + } - uint8_t serializedVerifier[sizeof(paseVerifier.mW0) + sizeof(paseVerifier.mL)]; - memcpy(serializedVerifier, paseVerifier.mW0, chip::kSpake2p_WS_Length); - memcpy(&serializedVerifier[sizeof(paseVerifier.mW0)], paseVerifier.mL, - sizeof(paseVerifier.mL)); + __block NSData * result; + __block chip::Spake2pVerifier paseVerifier; + __block chip::ByteSpan saltByteSpan = chip::ByteSpan(static_cast(salt.bytes), salt.length); - result = [NSData dataWithBytes:serializedVerifier length:sizeof(serializedVerifier)]; - } - }); + dispatch_sync(_chipWorkQueue, ^{ + if ([self isRunning]) { + errorCode = self.cppCommissioner->ComputePASEVerifier(iterations, setupPincode, saltByteSpan, paseVerifier); + MTR_LOG_ERROR("ComputePaseVerifier: %s", chip::ErrorStr(errorCode)); + + uint8_t serializedVerifier[sizeof(paseVerifier.mW0) + sizeof(paseVerifier.mL)]; + memcpy(serializedVerifier, paseVerifier.mW0, chip::kSpake2p_WS_Length); + memcpy(&serializedVerifier[sizeof(paseVerifier.mW0)], paseVerifier.mL, sizeof(paseVerifier.mL)); + + result = [NSData dataWithBytes:serializedVerifier length:sizeof(serializedVerifier)]; + } + }); - return result; + return result; } - (BOOL)checkForInitError:(BOOL)condition logMsg:(NSString *)logMsg