Skip to content

Commit

Permalink
Restyled by clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
restyled-commits authored and mburshteyn1 committed Aug 24, 2022
1 parent 855fb96 commit cc99e18
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/darwin/Framework/CHIP/MTRCertificates.mm
Original file line number Diff line number Diff line change
Expand Up @@ -197,19 +197,21 @@ + (nullable NSData *)generateCertificateSigningRequest:(id<MTRKeypair>)keypair
return nil;
}

+ (nullable NSData *)convertToCHIPCertFromX509Cert:(NSData *)x509Certificate {
+ (nullable NSData *)convertToCHIPCertFromX509Cert:(NSData *)x509Certificate
{

chip::ByteSpan x509CertBytes = chip::ByteSpan((uint8_t *) x509Certificate.bytes, x509Certificate.length);
chip::ByteSpan x509CertBytes = chip::ByteSpan((uint8_t *) x509Certificate.bytes, x509Certificate.length);

NSMutableData * chipCertBuffer = [[NSMutableData alloc] initWithLength:chip::Credentials::kMaxCHIPCertLength];
chip::MutableByteSpan chipCertBytes((uint8_t *) chipCertBuffer.mutableBytes, chip::Credentials::kMaxCHIPCertLength);
NSMutableData * chipCertBuffer = [[NSMutableData alloc] initWithLength:chip::Credentials::kMaxCHIPCertLength];
chip::MutableByteSpan chipCertBytes((uint8_t *) chipCertBuffer.mutableBytes, chip::Credentials::kMaxCHIPCertLength);

CHIP_ERROR errorCode = chip::Credentials::ConvertX509CertToChipCert(x509CertBytes, chipCertBytes);
MTR_LOG_ERROR("ConvertX509CertToChipCert: %{public}s", chip::ErrorStr(errorCode));
CHIP_ERROR errorCode = chip::Credentials::ConvertX509CertToChipCert(x509CertBytes, chipCertBytes);
MTR_LOG_ERROR("ConvertX509CertToChipCert: %{public}s", chip::ErrorStr(errorCode));

if (errorCode != CHIP_NO_ERROR) return nil;
if (errorCode != CHIP_NO_ERROR)
return nil;

return [NSData dataWithBytes:chipCertBytes.data() length:chipCertBytes.size()];
return [NSData dataWithBytes:chipCertBytes.data() length:chipCertBytes.size()];
}

@end

0 comments on commit cc99e18

Please sign in to comment.