1 // Copyright 2021 The Pigweed Authors 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); you may not 4 // use this file except in compliance with the License. You may obtain a copy of 5 // the License at 6 // 7 // https://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 // License for the specific language governing permissions and limitations under 13 // the License. 14 #pragma once 15 16 // The size of the buffer to create on stack for streaming manifest data from 17 // the bundle reader. 18 #define WRITE_MANIFEST_STREAM_PIPE_BUFFER_SIZE 8 19 20 // The maximum allowed length of a target name. 21 #define MAX_TARGET_NAME_LENGTH 32 22 23 // The maximum allowed payload size in bytes. This is used to mitigate DoS 24 // attacks. 25 #ifndef PW_SOFTWARE_UPDATE_MAX_TARGET_PAYLOAD_SIZE 26 #define PW_SOFTWARE_UPDATE_MAX_TARGET_PAYLOAD_SIZE (100 * 1024 * 1024) 27 #endif // PW_SOFTWARE_UPDATE_MAX_TARGET_PAYLOAD_SIZE 28 29 // Not recommended. Disable compilation of bundle verification. 30 #ifndef PW_SOFTWARE_UPDATE_DISABLE_BUNDLE_VERIFICATION 31 #define PW_SOFTWARE_UPDATE_DISABLE_BUNDLE_VERIFICATION (false) 32 #endif // PW_SOFTWARE_UPDATE_DISABLE_BUNDLE_VERIFICATION 33 34 // Whether to support bundle "personalization", which is a feature that 35 // strips some or all target files that a device claims to already have from an 36 // incoming bundle in order to improve performance. 37 #ifndef PW_SOFTWARE_UPDATE_WITH_PERSONALIZATION 38 #define PW_SOFTWARE_UPDATE_WITH_PERSONALIZATION (true) 39 #endif // PW_SOFTWARE_UPDATE_WITH_PERSONALIZATION 40 41 // Whether to support root metadata rotation. 42 // 43 // Root metadata rotation is recommended to mitigate potential signing key 44 // vulnerabilities, e.g.: 45 // 1. Voluntary refresh of any / all signing keys on a regular schedule -- trust 46 // has an expiration date. 47 // 2. Revoke compromised keys. 48 // 3. Recover from fast-forward attacks. 49 // 50 // See more rational at: https://theupdateframework.io/security/ 51 #ifndef PW_SOFTWARE_UPDATE_WITH_ROOT_ROTATION 52 // WARNING: (false) case NOT covered by unit tests (nontrivial to add), 53 // use at your own risk! 54 #define PW_SOFTWARE_UPDATE_WITH_ROOT_ROTATION (true) 55 #endif // PW_SOFTWARE_UPDATE_WITH_ROOT_ROTATION 56