diff options
author | Ali Zhang <alizhang@google.com> | 2022-03-29 16:37:01 -0700 |
---|---|---|
committer | CQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-03-30 00:28:29 +0000 |
commit | 80f0c24495aa505f02e81525b930e275de66d89c (patch) | |
tree | 7c5af19867c9279a09186ee84de71dcf07678e7c | |
parent | a6af061a2fdd1198d6214fe03a4e2afaecbf3f55 (diff) | |
download | pigweed-80f0c24495aa505f02e81525b930e275de66d89c.tar.gz |
pw_software_update: Make personalization optional
Change-Id: I23dff3cbddbad8c854b8840338911b1cf37d65c5
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/89321
Pigweed-Auto-Submit: Ali Zhang <alizhang@google.com>
Reviewed-by: David Rogers <davidrogers@google.com>
Commit-Queue: Ali Zhang <alizhang@google.com>
-rw-r--r-- | pw_software_update/public/pw_software_update/config.h | 7 | ||||
-rw-r--r-- | pw_software_update/update_bundle_accessor.cc | 5 |
2 files changed, 12 insertions, 0 deletions
diff --git a/pw_software_update/public/pw_software_update/config.h b/pw_software_update/public/pw_software_update/config.h index 73c9bd195..5e72dcfc0 100644 --- a/pw_software_update/public/pw_software_update/config.h +++ b/pw_software_update/public/pw_software_update/config.h @@ -36,3 +36,10 @@ #ifndef PW_SOFTWARE_UPDATE_DISABLE_BUNDLE_VERIFICATION #define PW_SOFTWARE_UPDATE_DISABLE_BUNDLE_VERIFICATION (false) #endif // PW_SOFTWARE_UPDATE_DISABLE_BUNDLE_VERIFICATION + +// Whether to support bundle "personalization", which is a feature that +// strips some or all target files that a device claims to already have from an +// incoming bundle in order to improve performance. +#ifndef PW_SOFTWARE_UPDATE_WITH_PERSONALIZATION +#define PW_SOFTWARE_UPDATE_WITH_PERSONALIZATION (true) +#endif // PW_SOFTWARE_UPDATE_WITH_PERSONALIZATION
\ No newline at end of file diff --git a/pw_software_update/update_bundle_accessor.cc b/pw_software_update/update_bundle_accessor.cc index c835756ad..70050fbf3 100644 --- a/pw_software_update/update_bundle_accessor.cc +++ b/pw_software_update/update_bundle_accessor.cc @@ -704,6 +704,7 @@ Status UpdateBundleAccessor::VerifyOutOfBundleTargetPayload( std::string_view target_name, protobuf::Uint64 expected_length, protobuf::Bytes expected_sha256) { +#if PW_SOFTWARE_UPDATE_WITH_PERSONALIZATION // The target payload is "personalized out". We we can't take a measurement // without backend help. For now we will check against the device manifest // which contains a cached measurement of the last software update. @@ -757,6 +758,10 @@ Status UpdateBundleAccessor::VerifyOutOfBundleTargetPayload( } return OkStatus(); +#else + PW_LOG_ERROR("Target file %s not found in bundle", target_name); + return Status::Unauthenticated(); +#endif // PW_SOFTWARE_UPDATE_WITH_PERSONALIZATION } Status UpdateBundleAccessor::VerifyInBundleTargetPayload( |