Skip to content

Commit 07a2f21

Browse files
bzbarsky-applepull[bot]
authored andcommitted
Stop using the "cd", "paa", "certs" abbreviations in Darwin APIs. (#23937)
Fixes #23915
1 parent 1532a68 commit 07a2f21

File tree

3 files changed

+44
-13
lines changed

3 files changed

+44
-13
lines changed

examples/darwin-framework-tool/commands/common/CHIPCommandBridge.mm

+1-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@
124124
NSArray<NSData *> * paaCertResults;
125125
ReturnLogErrorOnFailure(GetPAACertsFromFolder(&paaCertResults));
126126
if ([paaCertResults count] > 0) {
127-
params.paaCerts = paaCertResults;
127+
params.productAttestationAuthorityCertificates = paaCertResults;
128128
}
129129

130130
NSError * error;

src/darwin/Framework/CHIP/MTRDeviceControllerFactory.h

+16-6
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
*/
2222

2323
#import <Foundation/Foundation.h>
24+
#import <Matter/MTRCertificates.h>
2425

2526
NS_ASSUME_NONNULL_BEGIN
2627

@@ -52,16 +53,21 @@ MTR_NEWLY_AVAILABLE
5253

5354
/*
5455
* The Product Attestation Authority certificates that are trusted to sign
55-
* device attestation information. Defaults to nil.
56+
* device attestation information (and in particular to sign Product Attestation
57+
* Intermediate certificates, which then sign Device Attestation Certificates).
5658
*
59+
* Defaults to nil.
5760
*/
58-
@property (nonatomic, copy, nullable) NSArray<NSData *> * paaCerts;
61+
@property (nonatomic, copy, nullable) NSArray<MTRCertificateDERBytes> * productAttestationAuthorityCertificates;
5962
/*
60-
* The Certificate Declaration certificates that are trusted to sign
61-
* device attestation information. Defaults to nil.
63+
* The Certification Declaration certificates whose public keys correspond to
64+
* private keys that are trusted to sign certification declarations. Defaults
65+
* to nil.
6266
*
67+
* These certificates are used in addition to, not replacing, the default set of
68+
* well-known certification declaration signing keys.
6369
*/
64-
@property (nonatomic, copy, nullable) NSArray<NSData *> * cdCerts;
70+
@property (nonatomic, copy, nullable) NSArray<MTRCertificateDERBytes> * certificationDeclarationCertificates;
6571
/*
6672
* The network port to bind to. If not specified, an ephemeral port will be
6773
* used.
@@ -145,7 +151,11 @@ MTR_NEWLY_DEPRECATED("Please use MTRDeviceControllerFactoryParams")
145151
@interface MTRControllerFactoryParams : MTRDeviceControllerFactoryParams
146152
@property (nonatomic, strong, readonly) id<MTRPersistentStorageDelegate> storageDelegate MTR_NEWLY_DEPRECATED(
147153
"Please use the storage property");
148-
@property (nonatomic, assign) BOOL startServer;
154+
@property (nonatomic, assign) BOOL startServer MTR_NEWLY_DEPRECATED("Please use shouldStartServer");
155+
@property (nonatomic, copy, nullable)
156+
NSArray<NSData *> * paaCerts MTR_NEWLY_DEPRECATED("Please use productAttestationAuthorityCertificates");
157+
@property (nonatomic, copy, nullable)
158+
NSArray<NSData *> * cdCerts MTR_NEWLY_DEPRECATED("Please use certificationDeclarationCertificates");
149159
@end
150160

151161
MTR_NEWLY_DEPRECATED("Please use MTRDeviceControllerFactory")

src/darwin/Framework/CHIP/MTRDeviceControllerFactory.mm

+27-6
Original file line numberDiff line numberDiff line change
@@ -324,8 +324,9 @@ - (BOOL)startControllerFactory:(MTRDeviceControllerFactoryParams *)startupParams
324324

325325
// Initialize device attestation verifier
326326
const Credentials::AttestationTrustStore * trustStore;
327-
if (startupParams.paaCerts) {
328-
_attestationTrustStoreBridge = new MTRAttestationTrustStoreBridge(startupParams.paaCerts);
327+
if (startupParams.productAttestationAuthorityCertificates) {
328+
_attestationTrustStoreBridge
329+
= new MTRAttestationTrustStoreBridge(startupParams.productAttestationAuthorityCertificates);
329330
if (_attestationTrustStoreBridge == nullptr) {
330331
MTR_LOG_ERROR("Error: %@", kErrorAttestationTrustStoreInit);
331332
errorCode = CHIP_ERROR_NO_MEMORY;
@@ -343,15 +344,15 @@ - (BOOL)startControllerFactory:(MTRDeviceControllerFactoryParams *)startupParams
343344
return;
344345
}
345346

346-
if (startupParams.cdCerts) {
347+
if (startupParams.certificationDeclarationCertificates) {
347348
auto cdTrustStore = _deviceAttestationVerifier->GetCertificationDeclarationTrustStore();
348349
if (cdTrustStore == nullptr) {
349350
MTR_LOG_ERROR("Error: %@", kErrorCDCertStoreInit);
350351
errorCode = CHIP_ERROR_INCORRECT_STATE;
351352
return;
352353
}
353354

354-
for (NSData * cdSigningCert in startupParams.cdCerts) {
355+
for (NSData * cdSigningCert in startupParams.certificationDeclarationCertificates) {
355356
errorCode = cdTrustStore->AddTrustedKey(AsByteSpan(cdSigningCert));
356357
if (errorCode != CHIP_NO_ERROR) {
357358
MTR_LOG_ERROR("Error: %@", kErrorCDCertStoreInit);
@@ -771,8 +772,8 @@ - (instancetype)initWithStorage:(id<MTRStorage>)storage
771772

772773
_storage = storage;
773774
_otaProviderDelegate = nil;
774-
_paaCerts = nil;
775-
_cdCerts = nil;
775+
_productAttestationAuthorityCertificates = nil;
776+
_certificationDeclarationCertificates = nil;
776777
_port = nil;
777778
_shouldStartServer = NO;
778779

@@ -845,4 +846,24 @@ - (void)setStartServer:(BOOL)startServer
845846
self.shouldStartServer = startServer;
846847
}
847848

849+
- (nullable NSArray<NSData *> *)paaCerts
850+
{
851+
return self.productAttestationAuthorityCertificates;
852+
}
853+
854+
- (void)setPaaCerts:(nullable NSArray<NSData *> *)paaCerts
855+
{
856+
self.productAttestationAuthorityCertificates = paaCerts;
857+
}
858+
859+
- (nullable NSArray<NSData *> *)cdCerts
860+
{
861+
return self.certificationDeclarationCertificates;
862+
}
863+
864+
- (void)setCdCerts:(nullable NSArray<NSData *> *)cdCerts
865+
{
866+
self.certificationDeclarationCertificates = cdCerts;
867+
}
868+
848869
@end

0 commit comments

Comments
 (0)