blob: f471d1ab7dfe216c7ecf5ac27baacde949bca2a4 [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
Andres Morales89dd74c2015-04-09 11:46:52 -070022#ifdef __cplusplus
Shawn Willdenc51d01e2015-03-18 18:59:52 -060023extern "C" {
24#endif // __cplusplus
Shawn Willdenc3ab05c2015-03-14 08:23:41 -060025
Andres Morales8e7aa992015-04-08 12:38:26 -070026const uint8_t HW_AUTH_TOKEN_VERSION = 0;
27
Shawn Willdenc3ab05c2015-03-14 08:23:41 -060028typedef enum {
29 HW_AUTH_NONE = 0,
Shawn Willden85cec0f2015-04-06 11:50:04 -060030 HW_AUTH_PASSWORD = 1 << 0,
31 HW_AUTH_FINGERPRINT = 1 << 1,
Shawn Willdenc3ab05c2015-03-14 08:23:41 -060032 // Additional entries should be powers of 2.
33 HW_AUTH_ANY = UINT32_MAX,
34} hw_authenticator_type_t;
35
36/**
37 * Data format for an authentication record used to prove successful authentication.
38 */
39typedef struct __attribute__((__packed__)) {
40 uint8_t version; // Current version is 0
41 uint64_t challenge;
42 uint64_t user_id; // secure user ID, not Android user ID
43 uint64_t authenticator_id; // secure authenticator ID
44 uint32_t authenticator_type; // hw_authenticator_type_t, in network order
Andres Morales606167c2015-04-13 10:21:32 -070045 uint64_t timestamp; // in network order
Shawn Willdenc3ab05c2015-03-14 08:23:41 -060046 uint8_t hmac[32];
47} hw_auth_token_t;
48
Andres Morales89dd74c2015-04-09 11:46:52 -070049#ifdef __cplusplus
Shawn Willdenc51d01e2015-03-18 18:59:52 -060050} // extern "C"
51#endif // __cplusplus
Shawn Willdenc3ab05c2015-03-14 08:23:41 -060052
53#endif // ANDROID_HARDWARE_HW_AUTH_TOKEN_H