1*60b67249SAndroid Build Coastguard Worker# Android Profile for DICE 2*60b67249SAndroid Build Coastguard Worker 3*60b67249SAndroid Build Coastguard Worker[TOC] 4*60b67249SAndroid Build Coastguard Worker 5*60b67249SAndroid Build Coastguard Worker## Background 6*60b67249SAndroid Build Coastguard Worker 7*60b67249SAndroid Build Coastguard WorkerThe Android Profile for DICE is a specialization of the [Open Profile for 8*60b67249SAndroid Build Coastguard WorkerDICE](specification.md) that provides additional detail around algorithms, 9*60b67249SAndroid Build Coastguard Workercertificates, and configuration descriptor. The choices are made to meet the 10*60b67249SAndroid Build Coastguard Workerneeds of the Android ecosystem. 11*60b67249SAndroid Build Coastguard Worker 12*60b67249SAndroid Build Coastguard WorkerThis profile is not always a strict refinement of the Open Profile for DICE as 13*60b67249SAndroid Build Coastguard Workerit also forced to address practical concerns such as workarounds for errata in 14*60b67249SAndroid Build Coastguard WorkerROMs that require a relaxation of the base specification. However, the objective 15*60b67249SAndroid Build Coastguard Workeris to avoid these where practical. 16*60b67249SAndroid Build Coastguard Worker 17*60b67249SAndroid Build Coastguard Worker## Cryptographic Algorithms 18*60b67249SAndroid Build Coastguard Worker 19*60b67249SAndroid Build Coastguard WorkerThe choice of algorithm must remain consistent with any given certificate e.g. 20*60b67249SAndroid Build Coastguard Workerif SHA-256 is the hash algorithm used for the code hash then the authority hash, 21*60b67249SAndroid Build Coastguard Workerconfig hash, etc. must also use SHA-256. 22*60b67249SAndroid Build Coastguard Worker 23*60b67249SAndroid Build Coastguard WorkerSee the Open Profile for DICE's [acceptable cryptographic 24*60b67249SAndroid Build Coastguard Workeralgorithms](specification.md#acceptable-cryptographic-algorithms) for more 25*60b67249SAndroid Build Coastguard Workerdetail on specific algorithms. 26*60b67249SAndroid Build Coastguard Worker 27*60b67249SAndroid Build Coastguard Worker### Hash Algorithms 28*60b67249SAndroid Build Coastguard Worker 29*60b67249SAndroid Build Coastguard WorkerAcceptable hash algorithms are: 30*60b67249SAndroid Build Coastguard Worker 31*60b67249SAndroid Build Coastguard Worker* SHA-256, SHA-384, SHA-512 32*60b67249SAndroid Build Coastguard Worker 33*60b67249SAndroid Build Coastguard WorkerUnlike the Open Profile for DICE, digests can be used as DICE inputs at their 34*60b67249SAndroid Build Coastguard Workeroutput size without needing to be resized to 64 bytes. The value that is used as 35*60b67249SAndroid Build Coastguard Workerthe DICE input must be listed in the certificate. E.g. SHA-256 digests can be 36*60b67249SAndroid Build Coastguard Workerused as 32-byte DICE inputs with the same 32 bytes encoded as a byte string in 37*60b67249SAndroid Build Coastguard Workerthe certificate. 38*60b67249SAndroid Build Coastguard Worker 39*60b67249SAndroid Build Coastguard Worker### Key Derivation Functions 40*60b67249SAndroid Build Coastguard Worker 41*60b67249SAndroid Build Coastguard WorkerHKDF with a [supported hash algorithm](#hash-algorithms), or 42*60b67249SAndroid Build Coastguard Worker[CKDF](https://datatracker.ietf.org/doc/html/draft-agl-ckdf-00) for all key 43*60b67249SAndroid Build Coastguard Workerderivation. 44*60b67249SAndroid Build Coastguard Worker 45*60b67249SAndroid Build Coastguard Worker### Digital Signatures 46*60b67249SAndroid Build Coastguard Worker 47*60b67249SAndroid Build Coastguard WorkerEd25519 is recommended for performance and memory usage reasons. ECDSA with 48*60b67249SAndroid Build Coastguard Workercurves P-256 or P-384 are acceptable. 49*60b67249SAndroid Build Coastguard Worker 50*60b67249SAndroid Build Coastguard Worker## Certificate Details 51*60b67249SAndroid Build Coastguard Worker 52*60b67249SAndroid Build Coastguard WorkerOnly CBOR certificates are allowed by this profile. Other certificate types, 53*60b67249SAndroid Build Coastguard Workersuch as X.509, must not be used. 54*60b67249SAndroid Build Coastguard Worker 55*60b67249SAndroid Build Coastguard Worker### Mode 56*60b67249SAndroid Build Coastguard Worker 57*60b67249SAndroid Build Coastguard WorkerA certificate must only set the mode to `normal` when all of the following 58*60b67249SAndroid Build Coastguard Workerconditions are met when loading and verifying the software component that is 59*60b67249SAndroid Build Coastguard Workerbeing described by the certificate: 60*60b67249SAndroid Build Coastguard Worker 61*60b67249SAndroid Build Coastguard Worker* secure/verified boot with anti-rollback protection is enabled 62*60b67249SAndroid Build Coastguard Worker* only the secure/verified boot authorities for production images are enabled 63*60b67249SAndroid Build Coastguard Worker* debug ports, fuses, or other debug facilities are disabled 64*60b67249SAndroid Build Coastguard Worker* device booted software from the normal primary source e.g. internal flash 65*60b67249SAndroid Build Coastguard Worker 66*60b67249SAndroid Build Coastguard WorkerThe mode should never be `not configured`. 67*60b67249SAndroid Build Coastguard Worker 68*60b67249SAndroid Build Coastguard Worker### Configuration descriptor 69*60b67249SAndroid Build Coastguard Worker 70*60b67249SAndroid Build Coastguard WorkerThe configuration descriptor is a CBOR map. Only key values less than -65536 71*60b67249SAndroid Build Coastguard Workerare used as this is conventionally reserved for private use in IANA 72*60b67249SAndroid Build Coastguard Workerassignments. The key value range \[-70000, -70999\] is reserved for use by this 73*60b67249SAndroid Build Coastguard Workerprofile. Implementation-specific fields may be added using key values outside 74*60b67249SAndroid Build Coastguard Workerof the reserved range. 75*60b67249SAndroid Build Coastguard Worker 76*60b67249SAndroid Build Coastguard WorkerUnless explicitly stated as required in the [versions](#versions) section, each 77*60b67249SAndroid Build Coastguard Workerfield is optional. If no fields are relevant, an empty map should be encoded. 78*60b67249SAndroid Build Coastguard Worker 79*60b67249SAndroid Build Coastguard WorkerName | Key | Value type | Meaning 80*60b67249SAndroid Build Coastguard Worker--- | --- | --- | --- 81*60b67249SAndroid Build Coastguard WorkerComponent name | -70002 | tstr | Name of the component 82*60b67249SAndroid Build Coastguard WorkerComponent version | -70003 | int / tstr | Version of the component 83*60b67249SAndroid Build Coastguard WorkerResettable | -70004 | null | If present, key changes on factory reset 84*60b67249SAndroid Build Coastguard WorkerSecurity version | -70005 | uint | Machine-comparable, monotonically increasing version of the component where a greater value indicates a newer version. This value must increment for every update that changes the code hash, for example by using the timestamp of the version's release. 85*60b67249SAndroid Build Coastguard Worker[RKP VM][rkp-vm] marker | -70006 | null | See the [Android HAL documentation][rkp-hal-readme] for precise semantics, as they vary by Android version. 86*60b67249SAndroid Build Coastguard WorkerComponent instance name | -70007 | tstr | When component is meant as a type, class or category, one can further specify the particular instance of that component. 87*60b67249SAndroid Build Coastguard Worker 88*60b67249SAndroid Build Coastguard Worker[rkp-vm]: https://android.googlesource.com/platform/packages/modules/Virtualization/+/main/docs/service_vm.md#rkp-vm-remote-key-provisioning-virtual-machine 89*60b67249SAndroid Build Coastguard Worker[rkp-hal-readme]: https://android.googlesource.com/platform/hardware/interfaces/+/main/security/rkp/README.md 90*60b67249SAndroid Build Coastguard Worker 91*60b67249SAndroid Build Coastguard Worker### Versions 92*60b67249SAndroid Build Coastguard Worker 93*60b67249SAndroid Build Coastguard WorkerAndroid is an evolving ecosystem with compatibility requirements that enable 94*60b67249SAndroid Build Coastguard Workerdevices to continue being updated. Explicit versioning of certificates in the 95*60b67249SAndroid Build Coastguard WorkerDICE chain allows continued compatibility between higher-level software that 96*60b67249SAndroid Build Coastguard Workerupdates and lower-level software (such as ROM) that might not update. 97*60b67249SAndroid Build Coastguard Worker 98*60b67249SAndroid Build Coastguard WorkerVersions of this profile are identified by their profile name which is composed 99*60b67249SAndroid Build Coastguard Workerof the prefix `"android."` followed by the Android version number it aligns 100*60b67249SAndroid Build Coastguard Workerwith. Certificates declare which profile they are following in the `profileName` 101*60b67249SAndroid Build Coastguard Workerfield defined by the [Open Profile for DICE](specification.md). If no profile 102*60b67249SAndroid Build Coastguard Workername is included in the certificate, `"android.14"` is assumed. 103*60b67249SAndroid Build Coastguard Worker 104*60b67249SAndroid Build Coastguard WorkerWithin a DICE chain, the version of the profile used in each certificate must 105*60b67249SAndroid Build Coastguard Workerbe the same or greater than the version used in the previous certificate. This 106*60b67249SAndroid Build Coastguard Workerensures the all certificates are aware of, and can maintain, any chain 107*60b67249SAndroid Build Coastguard Workerinvariants that can be added in any version of the profile. 108*60b67249SAndroid Build Coastguard Worker 109*60b67249SAndroid Build Coastguard WorkerAndroid provides the [`hwtrust`][hwtrust-tool] tool which can validate that 110*60b67249SAndroid Build Coastguard Workercertificate chains conform to this profile and can assist in diagnosing 111*60b67249SAndroid Build Coastguard Workerproblems. 112*60b67249SAndroid Build Coastguard Worker 113*60b67249SAndroid Build Coastguard Worker[hwtrust-tool]: https://cs.android.com/android/platform/superproject/main/+/main:tools/security/remote_provisioning/hwtrust/README.md 114*60b67249SAndroid Build Coastguard Worker 115*60b67249SAndroid Build Coastguard WorkerThe version-specific details listed below are non-cumulative so only apply to 116*60b67249SAndroid Build Coastguard Workerthe version they are listed under. 117*60b67249SAndroid Build Coastguard Worker 118*60b67249SAndroid Build Coastguard Worker#### `"android.14"` 119*60b67249SAndroid Build Coastguard Worker 120*60b67249SAndroid Build Coastguard WorkerThe profile named `"android.14"` aligns with Android 14. 121*60b67249SAndroid Build Coastguard Worker 122*60b67249SAndroid Build Coastguard Worker* Based on the [Open Profile for DICE v2.4][open-dice-v2.4]. 123*60b67249SAndroid Build Coastguard Worker* The `configurationHash` field is permitted to be missing rather than being 124*60b67249SAndroid Build Coastguard Worker required, as specified by the Open Profile for DICE. 125*60b67249SAndroid Build Coastguard Worker* The `mode` field is permitted to be encoded as an integer rather than the 126*60b67249SAndroid Build Coastguard Worker byte string that is specified by the Open Profile for DICE. 127*60b67249SAndroid Build Coastguard Worker* The `keyUsage` field is permitted to be encoded in big-endian byte order as 128*60b67249SAndroid Build Coastguard Worker well as the little-endian byte order that is specified by the Open Profile 129*60b67249SAndroid Build Coastguard Worker for DICE. As a result of this erratum workaround, the value is ambiguous and 130*60b67249SAndroid Build Coastguard Worker verifiers might not be able to rely on this value. 131*60b67249SAndroid Build Coastguard Worker 132*60b67249SAndroid Build Coastguard Worker#### `"android.15"` 133*60b67249SAndroid Build Coastguard Worker 134*60b67249SAndroid Build Coastguard WorkerThe profile named `"android.15"` aligns with Android 15. It is backwards 135*60b67249SAndroid Build Coastguard Workercompatible with the previous versions of the Andorid Profile for DICE. 136*60b67249SAndroid Build Coastguard Worker 137*60b67249SAndroid Build Coastguard Worker* Based on the [Open Profile for DICE v2.5][open-dice-v2.5]. 138*60b67249SAndroid Build Coastguard Worker* The `configurationHash` field is permitted to be missing rather than being 139*60b67249SAndroid Build Coastguard Worker required, as specified by the Open Profile for DICE. 140*60b67249SAndroid Build Coastguard Worker 141*60b67249SAndroid Build Coastguard Worker#### `"android.16"` 142*60b67249SAndroid Build Coastguard Worker 143*60b67249SAndroid Build Coastguard WorkerThe profile named `"android.16"` aligns with Android 16 and is still subject to 144*60b67249SAndroid Build Coastguard Workerchange. It is backwards compatible with the previous versions of the Android 145*60b67249SAndroid Build Coastguard WorkerProfile for DICE. 146*60b67249SAndroid Build Coastguard Worker 147*60b67249SAndroid Build Coastguard Worker* Based on the [Open Profile for DICE v2.5][open-dice-v2.5]. 148*60b67249SAndroid Build Coastguard Worker* The security version field of the [configuration 149*60b67249SAndroid Build Coastguard Worker descriptor](#configuration-descriptor) is required. 150*60b67249SAndroid Build Coastguard Worker 151*60b67249SAndroid Build Coastguard Worker[open-dice-v2.4]: https://pigweed.googlesource.com/open-dice/+/f9f454ae493bfe76ec2af8011eb7543c20c5ffc2/docs/specification.md 152*60b67249SAndroid Build Coastguard Worker[open-dice-v2.5]: https://pigweed.googlesource.com/open-dice/+/0b5044098bf9b40128927d675dea4ec1fb75c510/docs/specification.md 153