blob: 0499c5d0fdca2e9bad93be0790aa7be4a11cab90 [file] [log] [blame]
Zachary Iqbal1f700742018-04-24 23:42:21 -07001/*
2 * Copyright (C) 2018 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.biometrics.face@1.0;
18
19import IBiometricsFaceClientCallback;
20
Zachary Iqbal1f700742018-04-24 23:42:21 -070021/**
22 * The HAL interface for biometric face authentication.
23 */
24interface IBiometricsFace {
25
26 /**
27 * Sets the current client callback.
28 *
29 * Registers a user function that must receive notifications from the HAL.
30 * There is usually only one client (FaceService). This call must block
31 * if the HAL state machine is in busy state until the HAL leaves the
32 * busy state.
33 *
34 * All callback methods pass a deviceId to differentiate callback
35 * invocations in the case where multiple sensors exist.
36 *
37 * @param clientCallback The client defined callback to register.
38 * @return result, with its "value" parameter representing a "deviceId",
39 * which must be unique for a given sensor.
40 */
41 @callflow(next={"setActiveUser"})
42 @entry
43 setCallback(IBiometricsFaceClientCallback clientCallback)
44 generates (OptionalUint64 result);
45
46 /**
47 * Sets the active user, which all subsequent HAL operations are applied to.
48 *
49 * HAL service implementors must ensure that operations are restricted to
50 * the given user. Clients must not call any part of this interface, except
51 * for setCallback(), without first having set an active user. The
52 * implementation is responsible for cancelling the current operation and
53 * returning to the idle state. Calling this method with the same userId
54 * should have no effect on the state machine.
55 *
56 * @param userId A non-negative user identifier that must be unique and
57 * persistent for a given user.
58 * @param storePath filesystem path to the template storage directory.
59 */
Kevin Chynaf5d0a62018-08-31 16:06:43 -070060 @callflow(next={"authenticate", "generateChallenge", "enumerate", "remove"})
Zachary Iqbal1f700742018-04-24 23:42:21 -070061 setActiveUser(int32_t userId, string storePath) generates (Status status);
62
63 /**
Kevin Chynaf5d0a62018-08-31 16:06:43 -070064 * Begins a secure transaction request, e.g. enrollment.
Zachary Iqbal1f700742018-04-24 23:42:21 -070065 *
66 * Generates a unique and cryptographically secure random token used to
Kevin Chynaf5d0a62018-08-31 16:06:43 -070067 * indicate the start of a secure transaction. generateChallenge() and
68 * revokeChallenge() specify a pin/pattern/password cleared time window where
69 * the secure transaction is allowed.
Zachary Iqbal1f700742018-04-24 23:42:21 -070070 *
Kevin Chynaf5d0a62018-08-31 16:06:43 -070071 * generateChallenge() generates a challenge which must then be wrapped by the
Zachary Iqbal1f700742018-04-24 23:42:21 -070072 * gatekeeper after verifying a successful strong authentication attempt,
73 * which generates a Hardware Authentication Token. The challenge prevents
74 * spoofing and replay attacks and ensures that we only update a user’s face
75 * template if the operation was preceded by some kind of strong credential
76 * confirmation (e.g. device password).
77 *
Kevin Chyn2acfd2a2018-09-20 18:42:09 -070078 * @param challengeTimeoutSec A timeout in seconds, after which the driver
79 * must invalidate the challenge. This is to prevent bugs or crashes in
80 * the system from leaving a challenge enabled indefinitely.
Zachary Iqbal1f700742018-04-24 23:42:21 -070081 * @return result, with its "value" parameter representing a "challenge": a
82 * unique and cryptographically secure random token.
83 */
Kevin Chyna009f892018-12-06 21:29:36 -080084 @callflow(next={"enroll", "revokeChallenge", "setFeatureDisabled"})
Kevin Chyn2acfd2a2018-09-20 18:42:09 -070085 generateChallenge(uint32_t challengeTimeoutSec)
86 generates (OptionalUint64 result);
Zachary Iqbal1f700742018-04-24 23:42:21 -070087
88 /**
89 * Enrolls a user's face.
90 *
91 * Note that this interface permits implementations where multiple faces can
92 * be enrolled for a single user. However, allowing multiple faces to be
93 * enrolled can be a severe security vulnerability and hence, most
94 * implementations must ensure that only a single face be enrolled at a
95 * given time. Multi-enrollment must only be used where there is a clear
96 * necessity for a shared use case, e.g. TVs or cars.
97 *
98 * Note that the Hardware Authentication Token must still be valid after
Kevin Chynaf5d0a62018-08-31 16:06:43 -070099 * this call, and must be explicitly invalidated by a call to
100 * revokeChallenge(). This allows clients to immediately reattempt
101 * enrollment (for example, if a user wasn’t satisfied with their enrollment)
102 * without having to go through another strong authentication flow.
Zachary Iqbal1f700742018-04-24 23:42:21 -0700103 *
104 * This method triggers the IBiometricsFaceClientCallback#onEnrollResult()
105 * method.
106 *
107 * @param hat A valid Hardware Authentication Token, generated as a result
Kevin Chynaf5d0a62018-08-31 16:06:43 -0700108 * of a generateChallenge() challenge being wrapped by the gatekeeper
109 * after a sucessful strong authentication request.
Zachary Iqbal1f700742018-04-24 23:42:21 -0700110 * @param timeoutSec A timeout in seconds, after which this enrollment
111 * attempt is cancelled. Note that the client still needs to
Kevin Chynaf5d0a62018-08-31 16:06:43 -0700112 * call revokeChallenge() to terminate the enrollment session.
Kevin Chyna009f892018-12-06 21:29:36 -0800113 * @param disabledFeatures A list of features to be disabled during
114 * enrollment. Note that all features are enabled by default.
Zachary Iqbal1f700742018-04-24 23:42:21 -0700115 * @return status The status of this method call.
116 */
Kevin Chynaf5d0a62018-08-31 16:06:43 -0700117 @callflow(next={"cancel", "enroll", "revokeChallenge", "remove"})
Kevin Chyna009f892018-12-06 21:29:36 -0800118 enroll(vec<uint8_t> hat, uint32_t timeoutSec, vec<Feature> disabledFeatures)
Kevin Chyn57acf972018-08-31 15:10:03 -0700119 generates (Status status);
Zachary Iqbal1f700742018-04-24 23:42:21 -0700120
121 /**
Kevin Chynaf5d0a62018-08-31 16:06:43 -0700122 * Finishes the secure transaction by invalidating the challenge generated
123 * by generateChallenge().
Zachary Iqbal1f700742018-04-24 23:42:21 -0700124 *
125 * Clients must call this method once enrollment is complete, and the user's
126 * face template no longer needs to be updated.
127 *
128 * @return status The status of this method call.
129 */
130 @callflow(next={"authenticate", "setActiveUser", "enumerate", "remove"})
Kevin Chynaf5d0a62018-08-31 16:06:43 -0700131 revokeChallenge() generates (Status status);
132
133 /**
Kevin Chyna009f892018-12-06 21:29:36 -0800134 * Requires all subsequent enroll/authenticate calls to use the feature.
135 * This method does not affect enroll, which has its own feature list.
Kevin Chynaf5d0a62018-08-31 16:06:43 -0700136 *
137 * Changes the state of previous enrollment setting. Because this may
138 * decrease security, the user must enter their password before this method
139 * is invoked (see @param HAT). The driver must verify the HAT before
Kevin Chyna009f892018-12-06 21:29:36 -0800140 * changing any feature state.
Kevin Chynaf5d0a62018-08-31 16:06:43 -0700141 * Note: In some cases it may not be possible to change the state of this
142 * flag without re-enrolling. For example, if the user didn't provide
143 * attention during the original enrollment. This flag reflects the same
144 * persistent state as the one passed to enroll().
145 *
Kevin Chyna009f892018-12-06 21:29:36 -0800146 * @param feature The feature to be enabled or disabled.
147 * @param enabled True to enable the feature, false to disable.
Kevin Chynaf5d0a62018-08-31 16:06:43 -0700148 * @param hat A valid Hardware Authentication Token, generated as a result
149 * of getChallenge().
150 * @return status The status of this method call.
151 */
Kevin Chyna009f892018-12-06 21:29:36 -0800152 setFeature(Feature feature, bool enabled, vec<uint8_t> hat)
Kevin Chynaf5d0a62018-08-31 16:06:43 -0700153 generates(Status status);
154
155 /**
Kevin Chyna009f892018-12-06 21:29:36 -0800156 * Retrieves the current state of the feature.
Kevin Chynaf5d0a62018-08-31 16:06:43 -0700157 *
Kevin Chyna009f892018-12-06 21:29:36 -0800158 * @return enabled True if the feature is enabled, false if disabled.
Kevin Chynaf5d0a62018-08-31 16:06:43 -0700159 */
Kevin Chyna009f892018-12-06 21:29:36 -0800160 getFeature(Feature feature) generates (bool enabled);
Zachary Iqbal1f700742018-04-24 23:42:21 -0700161
162 /**
163 * Returns an identifier associated with the current face set.
164 *
165 * The authenticator ID must change whenever a new face is enrolled. The
166 * authenticator ID must not be changed when a face is deleted. The
167 * authenticator ID must be an entropy-encoded random number which all
168 * current templates are tied to. The authenticator ID must be immutable
169 * outside of an active enrollment window to prevent replay attacks.
170 *
171 * @return result, with its value parameter representing an
172 * "authenticatorId": an identifier associated to the user's current
173 * face enrollment.
174 */
175 @callflow(next={"authenticate"})
176 getAuthenticatorId() generates (OptionalUint64 result);
177
178 /**
179 * Cancels a pending enrollment or authentication request.
180 *
181 * @return status The status of this method call.
182 */
183 @callflow(next={"authenticate", "enroll", "enumerate", "remove",
184 "setActiveUser"})
185 cancel() generates (Status status);
186
187 /**
188 * Enumerates all face templates associated with the active user.
189 *
190 * The onEnumerate() callback method is invoked once for each face template
191 * found.
192 *
193 * @return status The status of this method call.
194 */
195 @callflow(next={"remove", "enroll", "authenticate", "setActiveUser"})
196 enumerate() generates (Status status);
197
198 /**
199 * Removes a face template or all face templates associated with the active
200 * user.
201 *
202 * This method triggers the IBiometricsFaceClientCallback#onRemoved() method.
203 *
204 * @param faceId The id correpsonding to the face to be removed; or 0 if all
205 * faces are to be removed.
206 * @return status The status of this method call.
207 */
208 @callflow(next={"enumerate", "authenticate", "cancel", "getAuthenticatorId",
209 "setActiveUser"})
210 remove(uint32_t faceId) generates (Status status);
211
212 /**
213 * Authenticates the active user.
214 *
215 * An optional operationId can be specified as a token from the transaction
Kevin Chynba9ec872018-09-28 16:37:45 -0700216 * being authorized. The hardware may enter a standby state during
217 * authentication, where the device is idle to conserve power while
218 * authenticating, e.g. after 3 seconds without finding a face. See
219 * IBiometricsFace#userActivity() for more info.
Zachary Iqbal1f700742018-04-24 23:42:21 -0700220 *
221 * @param operationId A non-zero operation id associated with a crypto
222 * object instance; or 0 if not being used.
223 * @return status The status of this method call.
224 */
Kevin Chynaf5d0a62018-08-31 16:06:43 -0700225 @callflow(next={"cancel", "generateChallenge", "remove"})
Zachary Iqbal1f700742018-04-24 23:42:21 -0700226 authenticate(uint64_t operationId) generates (Status status);
Kevin Chynba9ec872018-09-28 16:37:45 -0700227
228 /**
229 * A hint to the HAL to continue looking for faces.
230 *
231 * This method should only be used when the HAL is in the authenticating
232 * or standby state. Using this method when the HAL is not in one of the
233 * mentioned states must return OPERATION_NOT_SUPPORTED. Calling this
234 * method while the HAL is already authenticating may extend the duration
235 * where it's looking for a face.
236 *
237 * @return status The status of this method call.
238 */
239 userActivity() generates (Status status);
Kevin Chyn16d891d2018-12-14 16:19:38 -0800240
241 /**
242 * Reset lockout for the current user.
243 *
244 * @param hat A valid Hardware Authentication Token, generated when the
Kevin Chyn1c164452019-02-13 10:16:52 -0800245 * user authenticates with Pin/Pattern/Pass. When the Hardware
246 * Authentication Token is verified, lockout must be reset and
247 * onLockoutChanged must be called with duration 0.
248 * @return status The status of this method call.
Kevin Chyn16d891d2018-12-14 16:19:38 -0800249 */
Kevin Chyn1c164452019-02-13 10:16:52 -0800250 resetLockout(vec<uint8_t> hat) generates (Status status);
Zachary Iqbal1f700742018-04-24 23:42:21 -0700251};