blob: 64d2c9fedd6f1563b3c8df59ff37ff1d9fb6de96 [file] [log] [blame]
Shawn Willden94ad8912019-09-09 02:13:58 -06001/*
2 * Copyright (C) 2019 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.hardware.keymaster@4.1;
18
19import @4.0::ErrorCode;
20import @4.0::HardwareAuthToken;
21import @4.0::IKeymasterDevice;
22import @4.0::KeyParameter;
23import @4.0::KeyPurpose;
24import @4.0::OperationHandle;
25import IOperation;
26
27/**
28 * @4.1::IKeymasterDevice is a minor extension to @4.0::IKeymasterDevice. It adds support for
29 *
30 * - Partial hardware enforcment of UNLOCKED_DEVICE_REQUIRED keys;
31 * - Device-unique attestaion;
32 * - Early boot only keys;
33 * - Better cleanup of operations when clients die without completing or aborting them.
34 */
35interface IKeymasterDevice extends @4.0::IKeymasterDevice {
36 /**
37 * Called by client to notify the IKeymasterDevice that the device is now locked, and keys with
38 * the UNLOCKED_DEVICE_REQUIRED tag should no longer be usable. When this function is called,
39 * the IKeymasterDevice should note the current timestamp, and attempts to use
40 * UNLOCKED_DEVICE_REQUIRED keys must be rejected with Error::DEVICE_LOCKED until an
41 * authentication token with a later timestamp is presented. If the `passwordOnly' argument is
42 * set to true the sufficiently-recent authentication token must indicate that the user
43 * authenticated with a password, not a biometric.
44 *
45 * @param passwordOnly specifies whether the device must be unlocked with a password, rather
46 * than a biometric, before UNLOCKED_DEVICE_REQUIRED keys can be used.
47 */
48 deviceLocked(bool passwordOnly) generates (ErrorCode error);
49
50 /**
51 * Called by client to notify the IKeymasterDevice that the device has left the early boot
52 * state, and that keys with the EARLY_BOOT_ONLY tag may no longer be used. All attempts to use
53 * an EARLY_BOOT_ONLY key after this method is called must fail with Error::INVALID_KEY_BLOB.
54 */
55 earlyBootEnded() generates (ErrorCode error);
56
57 /**
58 * Begins a cryptographic operation. beginOp() is a variation on begin(). beginOp() has
59 * identical functionality to begin, but instead of an OperationHandle it returns an IOperation
60 * object. An IKeymasterDevice HAL service must call linkToDeath() on the Operation before
61 * returning it, and the provided hidl_death_recipient, if called, must abort() the operation.
62 * This is to ensure that in the event a client crashes while an operation is in progress, the
63 * operation slot is freed and available for use by other clients.
64 *
65 * @4.1::IKeymasterDevices must implement both beginOp() and begin().
66 */
67 beginOp(KeyPurpose purpose, vec<uint8_t> keyBlob, vec<KeyParameter> inParams,
68 HardwareAuthToken authToken)
69 generates (ErrorCode error, vec<KeyParameter> outParam, IOperation operation);
70};