blob: c48e1de13736935485eacba5f343226a4dff4262 [file] [log] [blame]
Andres Morales94b201e2015-04-16 13:47:47 -07001/*
2 * Copyright 2015 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#ifndef GATEKEEPER_PASSWORD_HANDLE_H_
18#define GATEKEEPER_PASSWORD_HANDLE_H_
19
Andres Morales48a4f832015-05-29 10:13:31 -070020#define HANDLE_FLAG_THROTTLE_SECURE 1
21
22#define HANDLE_VERSION_THROTTLE 2
23
Andres Morales94b201e2015-04-16 13:47:47 -070024namespace gatekeeper {
25
26typedef uint64_t secure_id_t;
27typedef uint64_t salt_t;
28/**
29 * structure for easy serialization
30 * and deserialization of password handles.
31 */
Andres Morales48a4f832015-05-29 10:13:31 -070032static const uint8_t HANDLE_VERSION = 2;
Andres Morales94b201e2015-04-16 13:47:47 -070033struct __attribute__ ((__packed__)) password_handle_t {
34 // fields included in signature
35 uint8_t version;
36 secure_id_t user_id;
Andres Morales48a4f832015-05-29 10:13:31 -070037 uint64_t flags;
Andres Morales94b201e2015-04-16 13:47:47 -070038
39 // fields not included in signature
40 salt_t salt;
41 uint8_t signature[32];
Andres Moralesaedf6052015-05-14 13:10:30 -070042
43 bool hardware_backed;
Andres Morales94b201e2015-04-16 13:47:47 -070044};
45}
46
Andres Morales94b201e2015-04-16 13:47:47 -070047#endif // GATEKEEPER_PASSWORD_HANDLE_H_