blob: ffb72a9bf909f02e700e0ea0f8da224946890f60 [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
22__BEGIN_DECLS
23
24typedef enum {
25 HW_AUTH_NONE = 0,
26 HW_AUTH_PASSWORD = 1 << 1,
27 HW_AUTH_FINGERPRINT = 1 << 2,
28 // Additional entries should be powers of 2.
29 HW_AUTH_ANY = UINT32_MAX,
30} hw_authenticator_type_t;
31
32/**
33 * Data format for an authentication record used to prove successful authentication.
34 */
35typedef struct __attribute__((__packed__)) {
36 uint8_t version; // Current version is 0
37 uint64_t challenge;
38 uint64_t user_id; // secure user ID, not Android user ID
39 uint64_t authenticator_id; // secure authenticator ID
40 uint32_t authenticator_type; // hw_authenticator_type_t, in network order
41 uint32_t timestamp; // in network order
42 uint8_t hmac[32];
43} hw_auth_token_t;
44
45__END_DECLS
46
47#endif // ANDROID_HARDWARE_HW_AUTH_TOKEN_H