From 682b4e05609c27e2e02a6ec779abafa82b7f8cc6 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Tue, 17 May 2022 06:31:15 -0400 Subject: [PATCH] Allow actually initializing a controller with an external keypair. (#18500) The boolean had not been added to Controller::SetupParams, so could not be passed through to controller startup via the controller factory. --- src/controller/CHIPDeviceController.h | 2 +- src/controller/CHIPDeviceControllerFactory.cpp | 11 ++++++----- src/controller/CHIPDeviceControllerFactory.h | 8 ++++++++ 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/controller/CHIPDeviceController.h b/src/controller/CHIPDeviceController.h index c23fc1d10fcdc6..0684b37b4c7f3e 100644 --- a/src/controller/CHIPDeviceController.h +++ b/src/controller/CHIPDeviceController.h @@ -98,7 +98,7 @@ struct ControllerInitParams /** * Controls whether or not the operationalKeypair should be owned by the caller. * By default, this is false, but if the keypair cannot be serialized, then - * setting this to true will allow you to manage this keypair's lifecycle. + * setting this to true will allow the caller to manage this keypair's lifecycle. */ bool hasExternallyOwnedOperationalKeypair = false; diff --git a/src/controller/CHIPDeviceControllerFactory.cpp b/src/controller/CHIPDeviceControllerFactory.cpp index d85a878104e216..430261d037cc1e 100644 --- a/src/controller/CHIPDeviceControllerFactory.cpp +++ b/src/controller/CHIPDeviceControllerFactory.cpp @@ -249,11 +249,12 @@ CHIP_ERROR DeviceControllerFactory::InitSystemState(FactoryInitParams params) void DeviceControllerFactory::PopulateInitParams(ControllerInitParams & controllerParams, const SetupParams & params) { - controllerParams.operationalCredentialsDelegate = params.operationalCredentialsDelegate; - controllerParams.operationalKeypair = params.operationalKeypair; - controllerParams.controllerNOC = params.controllerNOC; - controllerParams.controllerICAC = params.controllerICAC; - controllerParams.controllerRCAC = params.controllerRCAC; + controllerParams.operationalCredentialsDelegate = params.operationalCredentialsDelegate; + controllerParams.operationalKeypair = params.operationalKeypair; + controllerParams.hasExternallyOwnedOperationalKeypair = params.hasExternallyOwnedOperationalKeypair; + controllerParams.controllerNOC = params.controllerNOC; + controllerParams.controllerICAC = params.controllerICAC; + controllerParams.controllerRCAC = params.controllerRCAC; controllerParams.systemState = mSystemState; controllerParams.controllerVendorId = params.controllerVendorId; diff --git a/src/controller/CHIPDeviceControllerFactory.h b/src/controller/CHIPDeviceControllerFactory.h index 0862e48a8dfff1..8c00195453f5aa 100644 --- a/src/controller/CHIPDeviceControllerFactory.h +++ b/src/controller/CHIPDeviceControllerFactory.h @@ -46,6 +46,14 @@ struct SetupParams controllerNOC. It's used by controller to establish CASE sessions with devices */ Crypto::P256Keypair * operationalKeypair = nullptr; + /** + * Controls whether or not the operationalKeypair should be owned by the + * caller. By default, this is false, but if the keypair cannot be + * serialized, then setting this to true will allow the caller to manage + * this keypair's lifecycle. + */ + bool hasExternallyOwnedOperationalKeypair = false; + /* The following certificates must be in x509 DER format */ ByteSpan controllerNOC; ByteSpan controllerICAC;