blob: 154c1fd93f1e6e87e9eb4589b61e0afa16c1144a [file] [log] [blame]
Shawn Willdenc3ab05c2015-03-14 08:23:41 -06001/*
2 * Copyright (C) 2014 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
17#include <stdint.h>
18
19#ifndef ANDROID_HARDWARE_HW_AUTH_TOKEN_H
20#define ANDROID_HARDWARE_HW_AUTH_TOKEN_H
21
Shawn Willdenc51d01e2015-03-18 18:59:52 -060022#ifndef __cplusplus
23extern "C" {
24#endif // __cplusplus
Shawn Willdenc3ab05c2015-03-14 08:23:41 -060025
26typedef enum {
27 HW_AUTH_NONE = 0,
28 HW_AUTH_PASSWORD = 1 << 1,
29 HW_AUTH_FINGERPRINT = 1 << 2,
30 // Additional entries should be powers of 2.
31 HW_AUTH_ANY = UINT32_MAX,
32} hw_authenticator_type_t;
33
34/**
35 * Data format for an authentication record used to prove successful authentication.
36 */
37typedef struct __attribute__((__packed__)) {
38 uint8_t version; // Current version is 0
39 uint64_t challenge;
40 uint64_t user_id; // secure user ID, not Android user ID
41 uint64_t authenticator_id; // secure authenticator ID
42 uint32_t authenticator_type; // hw_authenticator_type_t, in network order
43 uint32_t timestamp; // in network order
44 uint8_t hmac[32];
45} hw_auth_token_t;
46
Shawn Willdenc51d01e2015-03-18 18:59:52 -060047#ifndef __cplusplus
48} // extern "C"
49#endif // __cplusplus
Shawn Willdenc3ab05c2015-03-14 08:23:41 -060050
51#endif // ANDROID_HARDWARE_HW_AUTH_TOKEN_H