Bert McMeen | daa1137 | 2015-09-17 16:35:18 -0700 | [diff] [blame] | 1 | page.title=Features |
| 2 | @jd:body |
| 3 | |
| 4 | <!-- |
| 5 | Copyright 2015 The Android Open Source Project |
| 6 | |
| 7 | Licensed under the Apache License, Version 2.0 (the "License"); |
| 8 | you may not use this file except in compliance with the License. |
| 9 | You may obtain a copy of the License at |
| 10 | |
| 11 | http://www.apache.org/licenses/LICENSE-2.0 |
| 12 | |
| 13 | Unless required by applicable law or agreed to in writing, software |
| 14 | distributed under the License is distributed on an "AS IS" BASIS, |
| 15 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 16 | See the License for the specific language governing permissions and |
| 17 | limitations under the License. |
| 18 | --> |
| 19 | <div id="qv-wrapper"> |
| 20 | <div id="qv"> |
| 21 | <h2>In this document</h2> |
| 22 | <ol id="auto-toc"> |
| 23 | </ol> |
| 24 | </div> |
| 25 | </div> |
| 26 | |
Danielle Roberts | 8bb806d | 2015-11-05 17:47:03 -0800 | [diff] [blame] | 27 | <p>This page contains information about the features of <a href="index.html">Keymaster</a> 1.0.</p> |
Bert McMeen | daa1137 | 2015-09-17 16:35:18 -0700 | [diff] [blame] | 28 | |
| 29 | <h2 id=cryptographic_primitives>Cryptographic primitives</h2> |
| 30 | |
| 31 | <p>The <code>libkeymaster</code> library and Keymaster provide the following categories of operations:</p> |
| 32 | |
| 33 | <ul> |
| 34 | <li>Key generation |
| 35 | <li>Import and export of asymmetric keys (no key wrapping) |
| 36 | <li>Import of raw symmetric keys (again, no wrapping) |
| 37 | <li>Asymmetric encryption and decryption with appropriate padding modes |
| 38 | <li>Asymmetric signing and verification with digesting and appropriate padding |
| 39 | modes |
| 40 | <li>Symmetric encryption and decryption in appropriate modes, including an AEAD |
| 41 | mode |
| 42 | <li>Generation and verification of symmetric message authentication codes |
| 43 | </ul> |
| 44 | |
| 45 | <p>Within each category, <code>libkeymaster</code> provides a mechanism for |
| 46 | discovering the available options (algorithms, |
| 47 | modes, etc.). But we also specify at least one required option, to ensure that |
| 48 | client software can depend on the presence of the required primitives.</p> |
| 49 | |
| 50 | <p>Protocol elements, such as purpose, mode and padding, as well |
| 51 | as <a href="#key_access_control">access control constraints</a>, |
| 52 | must be specified when keys are generated or imported and are permanently |
| 53 | bound to the key, ensuring the key cannot be used in any other way.</p> |
| 54 | |
| 55 | <p>In addition to the list above, there is one more service that Keymaster |
| 56 | implementations must provide but which is not exposed as an API: Random number |
| 57 | generation. This is used internally for generation of keys, Initialization |
| 58 | Vectors (IVs), random padding and other elements of secure protocols that |
| 59 | require randomness.</p> |
| 60 | |
| 61 | <h2 id=required_primitives>Required primitives</h2> |
| 62 | |
| 63 | <p>All implementations must provide:</p> |
| 64 | |
| 65 | <ul> |
| 66 | <li><a href="http://en.wikipedia.org/wiki/RSA_(cryptosystem)">RSA</a> |
| 67 | <ul> |
| 68 | <li>2048, 3072 and 4096-bit key support are required |
| 69 | <li>Support for public exponent F4 (2^16+1) |
| 70 | <li>Required padding modes for RSA signing are: |
| 71 | <ul> |
| 72 | <li>No padding (deprecated, will be removed in the future) |
| 73 | <li>RSASSA-PSS (<code>KM_PAD_RSA_PSS</code>) |
| 74 | <li>RSASSA-PKCS1-v1_5 (<code>KM_PAD_RSA_PKCS1_1_5_SIGN</code>) |
| 75 | </ul> |
| 76 | <li>Required digest modes for RSA signing are: |
| 77 | <ul> |
| 78 | <li>No digest (deprecated, will be removed in the future) |
| 79 | <li>SHA-256 |
| 80 | </ul> |
| 81 | <li>Required padding modes for RSA encryption/decryption are: |
| 82 | <ul> |
| 83 | <li>RSAES-OAEP (<code>KM_PAD_RSA_OAEP</code>) |
| 84 | <li>RSAES-PKCS1-v1_5 (<code>KM_PAD_RSA_PKCS1_1_5_ENCRYPT</code>) |
| 85 | </ul> |
| 86 | <li>Unpadded RSA encryption must not be supported |
| 87 | </ul> |
| 88 | <li><a href="http://en.wikipedia.org/wiki/Elliptic_Curve_DSA">ECDSA</a> |
| 89 | <ul> |
| 90 | <li>224, 256, 384 and 521-bit key support are required, using the NIST P-224, |
| 91 | P-256, P-384 and P-521 curves, respectively |
| 92 | <li>Required digest modes for ECDSA are: |
| 93 | <ul> |
| 94 | <li>No digest (deprecated, will be removed in the future) |
| 95 | <li>SHA-256 |
| 96 | </ul> |
| 97 | </ul> |
| 98 | <li><a href="http://en.wikipedia.org/wiki/Advanced_Encryption_Standard">AES</a> |
| 99 | <ul> |
| 100 | <li>128 and 256-bit keys are required |
| 101 | <li><a href="http://en.wikipedia.org/wiki/Block_cipher_mode_of_operation#Cipher-block_chaining_.28CBC.29">CBC</a>, |
| 102 | CTR, ECB and and GCM. The GCM implementation must not allow the use of tags |
| 103 | smaller than 96 bits or nonce lengths other than 96 bits. |
| 104 | <li>Padding modes <code>KM_PAD_NONE</code> and <code>KM_PAD_PKCS7</code> must |
| 105 | be supported for CBC and ECB modes. With no padding, CBC or ECB mode |
| 106 | encryption must fail if the input isn't a multiple of the block size. |
| 107 | </ul> |
| 108 | <li><a href="http://en.wikipedia.org/wiki/Hash-based_message_authentication_code">HMAC</a> |
| 109 | <a href="http://en.wikipedia.org/wiki/SHA-2">SHA-256</a>, with any key size up to at least 32 bytes. |
| 110 | </ul> |
| 111 | </ul> |
| 112 | |
| 113 | <p>SHA1 and the other members of the SHA2 family (SHA-224, SHA384 and SHA512) are |
| 114 | strongly recommended, but not required. Keystore will provide them in software |
| 115 | if the hardware Keymaster implementation doesn't provide them.</p> |
| 116 | |
| 117 | <p>Some primitives are also recommended for interoperability with other systems:</p> |
| 118 | |
| 119 | <ul> |
| 120 | <li>Smaller key sizes for RSA |
| 121 | <li>Arbitrary public exponents for RSA |
| 122 | </ul> |
| 123 | |
| 124 | <h2 id=key_access_control>Key access control</h2> |
| 125 | |
| 126 | <p>Hardware-based keys that can never be extracted from the device don't provide |
| 127 | much security if an attacker can use them at will (though they're more secure |
| 128 | than keys which <em>can</em> be exfiltrated). Thus, it's crucial that Keymaster enforce access controls.</p> |
| 129 | |
| 130 | <p>Access controls are defined as an "authorization list" of tag/value pairs. |
| 131 | Authorization tags are 32-bit integers and the values are a variety of types. |
| 132 | Some tags may be repeated to specify multiple values. Whether a tag may be |
| 133 | repeated is specified in the documentation for the tag. When a key is created, |
| 134 | the caller specifies an authorization list. The Keymaster implementation will |
| 135 | modify the list to specify some additional information, such as whether the key |
| 136 | has rollback protection, and return a "final" authorization list, encoded into |
| 137 | the returned key blob. Any attempt to use the key for any cryptographic |
| 138 | operation must fail if the final authorization list is modified.</p> |
| 139 | |
| 140 | <p>The set of possible tags is defined in the enumeration <code>keymaster_authorization_tag_t</code> and |
| 141 | the set must be permanently fixed (though it can be extended). |
| 142 | Names are prefixed with <code>KM_TAG_</code>. The top |
| 143 | four bits of tag IDs are used to indicate the type.</p> |
| 144 | |
| 145 | <p>Possible types include:</p> |
| 146 | |
| 147 | <p><strong><code>KM_ENUM</code>:</strong> Many tags' values are defined in enumerations. For example, the possible |
| 148 | values of <code>KM_TAG_PURPOSE</code> are defined in enum <code>keymaster_purpose_t</code>.</p> |
| 149 | |
| 150 | <p><strong><code>KM_ENUM_REP</code></strong>: Same as <code>KM_ENUM</code>, except that the tag may |
| 151 | be repeated in an authorization list. Repetition |
| 152 | indicates multiple authorized values. For example, an encryption key will |
| 153 | likely have <code>KM_PURPOSE_ENCRYPT</code> and <code>KM_PURPOSE_DECRYPT</code>.</p> |
| 154 | |
| 155 | <p><strong><code>KM_UINT</code>:</strong> 32-bit unsigned integers. Example: <code>KM_TAG_KEY_SIZE</code></p> |
| 156 | |
| 157 | <p><strong><code>KM_UINT_REP</code></strong>: Same as <code>KM_UINT</code>, except that the tag may be |
| 158 | repeated in an authorization list. Repetition indicates multiple authorized values.</p> |
| 159 | |
| 160 | <p><strong><code>KM_ULONG</code></strong>: 64-bit unsigned integers. Example: <code>KM_TAG_RSA_PUBLIC_EXPONENT</code></p> |
| 161 | |
| 162 | <p><strong><code>KM_ULONG_REP</code></strong>: Same as <code>KM_ULONG</code>, except that the tag may be |
| 163 | repeated in an authorization list. Repetition |
| 164 | indicates multiple authorized values.</p> |
| 165 | |
| 166 | <p><strong><code>KM_DATE</code></strong>: Date/time values, expressed as milliseconds since January 1, 1970. |
| 167 | Example: <code>KM_TAG_PRIVKEY_EXPIRE_DATETIME</code></p> |
| 168 | |
| 169 | <p><strong><code>KM_BOOL</code></strong>: True or false. A tag of type <code>KM_BOOL</code> is assumed |
| 170 | to be "false" if the tag is not present and "true" if present. Example: <code>KM_TAG_ROLLBACK_RESISTANT</code></p> |
| 171 | |
| 172 | <p><strong><code>KM_BIGNUM</code></strong>: Arbitrary-length integers, expressed as a byte array |
| 173 | in big-endian order. Example: <code>KM_TAG_RSA_PUBLIC_EXPONENT</code></p> |
| 174 | |
| 175 | <p><strong><code>KM_BYTES</code></strong>: A sequence of bytes. Example: <code>KM_TAG_ROOT_OF_TRUST</code></p> |
| 176 | |
| 177 | <h3 id=hardware_vs_software_enforcement>Hardware vs. software enforcement</h3> |
| 178 | |
| 179 | <p>Not all Keymaster implementations will implement the same features. To support |
| 180 | a variety of approaches, Keymaster 1.0 distinguishes between secure and |
| 181 | non-secure world access control enforcement, which we call hardware and |
| 182 | software enforcement, respectively.</p> |
| 183 | |
| 184 | <p>Implementations are required to:</p> |
| 185 | |
| 186 | <ul> |
| 187 | <li>Enforce exact matching (not enforcement) of all authorizations. Authorization |
| 188 | lists in key blobs must exactly match the authorizations returned during key |
| 189 | generation, including ordering. Any mismatch must cause an error diagnostic. |
| 190 | <li>Declare the authorizations whose semantic values are enforced. |
| 191 | </ul> |
| 192 | |
| 193 | <p>The API mechanism for declaring hardware-enforced authorizations is in |
| 194 | the <code>keymaster_key_characteristics_t</code> structure. It divides the authorization |
| 195 | list into two sub-lists, <code>hw_enforced</code> and <code>sw_enforced</code>. The |
| 196 | Keymaster implementation is responsible for placing the appropriate |
| 197 | values in each, based on what it can enforce.</p> |
| 198 | |
| 199 | <p>In addition, the keystore daemon will implement software-based enforcement of <em>all</em> authorizations, |
| 200 | whether they're enforced in hardware or not.</p> |
| 201 | |
| 202 | <p>For example, consider a TrustZone-based implementation that does not support |
| 203 | key expiration. A key with an expiration date may still be created. That key's |
| 204 | authorization list will include the tag <code>KM_TAG_ORIGINATION_EXPIRE_DATETIME</code> with |
| 205 | the expiration date. A request to Keymaster for the key characteristics |
| 206 | will find this tag in the <code>sw_enforced</code> list and the Keymaster implementation will |
| 207 | not enforce the expiration |
| 208 | requirement. However, attempts to use the key after expiration will be rejected |
| 209 | by the keystore daemon.</p> |
| 210 | |
| 211 | <p>If the device is then upgraded with a Keymaster implementation that does |
| 212 | support expiration, then a request for key characteristics will |
| 213 | find <code>KM_TAG_ORIGINATION_EXPIRE_DATETIME</code> in |
| 214 | the <code>hw_enforced</code> list, and attempts to use the key after expiration will fail even if the |
| 215 | keystore is somehow subverted or bypassed.</p> |
| 216 | |
| 217 | <h3 id=cryptographic_message_construction_authorizations>Cryptographic message construction authorizations</h3> |
| 218 | |
| 219 | <p>The following tags are used to define the cryptographic characteristics of |
| 220 | operations using the associated key: <code>KM_TAG_ALGORITHM</code>, <code>KM_TAG_KEY_SIZE</code>, |
| 221 | <code>KM_TAG_BLOCK_MODE</code>, <code>KM_TAG_PADDING</code>, <code>KM_TAG_CALLER_NONCE</code>, and <code>KM_TAG_DIGEST</code></p> |
| 222 | |
| 223 | <p><code>KM_TAG_PADDING</code>, <code>KM_TAG_DIGEST</code>, and <code>KM_PAD_BLOCK_MODE</code> |
| 224 | are repeatable, meaning that multiple values may be associated with a single |
| 225 | key, and the value to be used will be specified at operation time.</p> |
| 226 | |
| 227 | <h3 id=purpose>Purpose</h3> |
| 228 | |
| 229 | <p>Keys have an associated set of purposes, expressed as one or more authorization |
| 230 | entries with tag <code>KM_TAG_PURPOSE</code>, which defines how they can be used. The purposes are:</p> |
| 231 | |
| 232 | <ul> |
| 233 | <li><code>KM_PURPOSE_ENCRYPT</code> |
| 234 | <li><code>KM_PURPOSE_DECRYPT</code> |
| 235 | <li><code>KM_PURPOSE_SIGN</code> |
| 236 | <li><code>KM_PURPOSE_VERIFY</code> |
| 237 | </ul> |
| 238 | |
| 239 | <p>Any key can have any subset of these purposes. Note that some combinations |
| 240 | create security problems. For example, an RSA key that can be used to both |
| 241 | encrypt and to sign allows an attacker who can convince the system to decrypt |
| 242 | arbitrary data to generate signatures.</p> |
| 243 | |
| 244 | <p>Other purposes for keys that may be added in the future include:</p> |
| 245 | |
| 246 | <ul> |
| 247 | <li>"Derive Key" purpose, for key derivation keys |
| 248 | <li>"Attest" purpose, for keys that can generate attestations of the Keymaster |
| 249 | implementation and/or its environment |
| 250 | <li>"Wrap Key" purpose, for keys used to wrap keys for secure import or export |
| 251 | </ul> |
| 252 | |
| 253 | <h3 id=import_and_export>Import and export</h3> |
| 254 | |
| 255 | <p>Keymaster supports export of public keys only, in X.509 format, and import of:</p> |
| 256 | |
| 257 | <ul> |
| 258 | <li>Public and private key pairs in DER-encoded PKCS#8 format, without |
| 259 | password-based encryption, and |
| 260 | <li>Symmetric keys as raw bytes |
| 261 | </ul> |
| 262 | |
| 263 | <p>Future versions will likely expand the import/export options.</p> |
| 264 | |
| 265 | <p>To ensure that imported keys can be distinguished from securely-generated |
| 266 | keys, <code>KM_TAG_ORIGIN</code> is included in the appropriate key |
| 267 | authorization list. For example, if a key |
| 268 | was generated in secure hardware, <code>KM_TAG_ORIGIN</code> with |
| 269 | value <code>KM_ORIGIN_GENERATED</code> will be found in |
| 270 | the <code>hw_enforced</code> list of the key characteristics, while a key |
| 271 | that was imported into secure |
| 272 | hardware will have the value <code>KM_ORIGIN_IMPORTED</code>.</p> |
| 273 | |
| 274 | <h3 id=user_authentication>User authentication</h3> |
| 275 | |
| 276 | <p>Keymaster does not implement user authentication, but depends on other trusted |
| 277 | apps which do. For the interface that must be implemented by these apps, see |
| 278 | the Gatekeeper page.</p> |
| 279 | |
| 280 | <p>User authentication requirements are specified via two sets of tags. The first |
| 281 | set indicate which user can use the key:</p> |
| 282 | |
| 283 | <ul> |
| 284 | <li><code>KM_TAG_ALL_USERS</code> indicates the key is usable by all users. If |
| 285 | present, <code>KM_TAG_USER_ID</code> and <code>KM_TAG_SECURE_USER_ID</code> must not be present. |
| 286 | <li><code>KM_TAG_USER_ID</code> has a numeric value specifying the ID of the authorized user. |
| 287 | Note that this |
| 288 | is the Android user ID (for multi-user), not the application UID, and it is |
| 289 | enforced by non-secure software only. If present, <code>KM_TAG_ALL_USERS</code> must not be present. |
| 290 | <li><code>KM_TAG_SECURE_USER_ID</code> has a 64-bit numeric value specifying the secure user ID |
| 291 | that must be provided |
| 292 | in a secure authentication token to unlock use of the key. If repeated, the key |
| 293 | may be used if any of the values is provided in a secure authentication token. |
| 294 | </ul> |
| 295 | |
| 296 | <p>The second set indicate whether and when the user must be authenticated. If |
| 297 | neither of these tags is present, but <code>KM_TAG_SECURE_USER_ID</code> is, authentication is |
| 298 | required for every use of the key.</p> |
| 299 | |
| 300 | <ul> |
| 301 | <li><code>KM_NO_AUTHENTICATION_REQUIRED</code> indicates no user authentication is required, though |
| 302 | the key still may only be |
| 303 | used by apps running as the user(s) specified by <code>KM_TAG_USER_ID</code>. |
| 304 | <li><code>KM_TAG_AUTH_TIMEOUT</code> is a numeric value specifying, in seconds, how fresh the user |
| 305 | authentication |
| 306 | must be to authorize key usage. This applies only to private/secret key |
| 307 | operations. Public key operations don't require authentication. Timeouts do not |
| 308 | cross reboots; after a reboot, all keys are "never authenticated." The timeout |
| 309 | may be set to a large value to indicate that authentication is required once |
| 310 | per boot (2^32 seconds is ~136 years; presumably Android devices are rebooted |
| 311 | more often than that). |
| 312 | </ul> |
| 313 | |
| 314 | <h3 id=client_binding>Client binding</h3> |
| 315 | |
| 316 | <p>Client binding, the association of a key with a particular client application, |
| 317 | is done via an optional client ID and some optional client data (<code>KM_TAG_APPLICATION_ID</code> |
| 318 | and <code>KM_TAG_APPLICATION_DATA</code>, respectively). Keymaster treats these values as opaque blobs, |
| 319 | only ensuring |
| 320 | that the same blobs presented during key generation/import are presented for |
| 321 | every use and are byte-for-byte identical. The client binding data is not |
| 322 | returned by Keymaster. The caller must know it in order to use the key.</p> |
| 323 | |
| 324 | <h3 id=expiration>Expiration</h3> |
| 325 | |
| 326 | <p>Keymaster supports restricting key usage by date. Key start of validity and key |
| 327 | expirations can be associated with a key and Keymaster will refuse to perform |
| 328 | key operations if the current date/time is outside of the valid range. The key |
| 329 | validity range is specified with the tags <code>KM_TAG_ACTIVE_DATETIME</code>, |
| 330 | <code>KM_TAG_ORIGINATION_EXPIRE_DATETIME</code>, and <code>KM_TAG_USAGE_EXPIRE_DATETIME</code>. |
| 331 | The distinction between "origination" and "usage" is based on whether the key |
| 332 | is being used to "originate" a new ciphertext/signature/etc., or to "use" an |
| 333 | existing ciphertext/signature/etc.</p> |
| 334 | |
| 335 | <p>The <code>KM_TAG_ACTIVE_DATETIME</code>, <code>KM_TAG_ORIGINATION_EXPIRE_DATETIME</code>, |
| 336 | and <code>KM_TAG_USAGE_EXPIRE_DATETIME</code> tags are optional. If the tags are absent, it is |
| 337 | assumed that the key in |
| 338 | question can always be used to decrypt/verify messages.</p> |
| 339 | |
| 340 | <p>Because wall-clock time is provided by the non-secure world, it's unlikely that |
| 341 | the expiration-related tags will be in the hardware-enforced list. Hardware |
| 342 | enforcement of expiry would require that the secure world somehow obtain |
| 343 | trusted time and data, for example via a challenge response protocol with a |
| 344 | trusted remote timeserver.</p> |
| 345 | |
| 346 | <h3 id=root_of_trust_binding>Root of trust binding</h3> |
| 347 | |
| 348 | <p>Keymaster allows keys to be bound to a root of trust, which is a bitstring |
| 349 | provided to Keymaster during startup, preferably by the bootloader. If |
| 350 | provided, this bitstring must be cryptographically bound to every key managed |
| 351 | by Keymaster.</p> |
| 352 | |
| 353 | <p>The intent is for the bootloader to pass in the public key, used to verify the |
| 354 | signature on the boot image, along with the verified boot state (locked or |
| 355 | unlocked). If the public key is changed to allow a different system image to be |
| 356 | used or if the verified boot state is changed, then none of the |
| 357 | Keymaster-protected keys created by the previous system will be usable, unless |
| 358 | the previous root of trust is restored and a system that is signed by that key |
| 359 | is booted. The goal is to increase the value of the software-enforced key |
| 360 | access controls by making it imposSTEM</code>sible for an attacker-installed operating |
| 361 | system to use Keymaster keys.</p> |
| 362 | |
| 363 | <h3 id=standalone_keys>Standalone keys</h3> |
| 364 | |
| 365 | <p>Some Keymaster implementations may choose to store key material internally and |
| 366 | return handles rather than encrypted key material. Or there may be other cases |
| 367 | in which keys cannot be used until some other non-secure or secure world system |
| 368 | component is available. The Keymaster 1.0 API allows the caller to request that |
| 369 | a key be "standalone," via the <code>KM_TAG_STANDALONE</code> tag, |
| 370 | meaning that no resources other than the blob and the running Keymaster |
| 371 | system are required. The tags associated with a key may be inspected to see |
| 372 | whether a key is standalone. At present, only two values are defined:</p> |
| 373 | |
| 374 | <ul> |
| 375 | <li><code>KM_BLOB_STANDALONE</code> |
| 376 | <li><code>KM_BLOB_REQUIRES_FILE_SYSTEM</code> |
| 377 | </ul> |
| 378 | |
| 379 | <h3 id=velocity>Velocity</h3> |
| 380 | |
| 381 | <p>When it's created, the maximum usage velocity can be specified |
| 382 | with <code>KM_TAG_MIN_SECONDS_BETWEEN_OPS</code>. |
| 383 | TrustZone implementations will refuse to perform cryptographic operations |
| 384 | with that key if an operation was performed less |
| 385 | than <code>KM_TAG_MIN_SECONDS_BETWEEN_OPS</code> seconds earlier.</p> |
| 386 | |
| 387 | <p>The simple approach to implementing velocity limits is a table of key IDs and |
| 388 | last-use timestamps. This table will likely be of limited size, but must |
| 389 | accommodate at least 16 entries. In the event that the table is full and no |
| 390 | entries may be updated or discarded, Keymaster implementations must "fail |
| 391 | safe," preferring to refuse all velocity-limited key operations until one of |
| 392 | the entries expires. It is acceptable for all entries to expire upon reboot.</p> |
| 393 | |
| 394 | <p>Keys can also be limited to <em>n</em> uses per boot with <code>KM_TAG_USES_PER_BOOT</code>. |
| 395 | This also requires a tracking table, which must accommodate at least four |
| 396 | keys, and must also fail safe. Note that applications will be unable to create |
| 397 | per-boot limited keys. This feature will not be exposed through keystore and |
| 398 | will be reserved for system operations.</p> |
| 399 | |
| 400 | <h3 id=random_number_generator_re-seeding>Random number generator re-seeding</h3> |
| 401 | |
| 402 | <p>Because Keymaster must generate random numbers for key material and |
| 403 | Initialization Vectors (IVs), and because hardware random number generators may |
| 404 | not always be fully trustworthy, Keymaster provides an interface to allow the |
| 405 | client to provide additional entropy which will be mixed into the random |
| 406 | numbers generated.</p> |
| 407 | |
| 408 | <p>A hardware random-number generator should be used as the primary seed source, |
| 409 | if available, and the seed data provided through the external API must not be |
| 410 | the sole source of randomness used for number generation. Further, the mixing |
| 411 | operation used must ensure that the random output is unpredictable if any one |
| 412 | of the seed sources is unpredictable.</p> |