1 /*
2  * Copyright (C) 2016 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 #ifndef ANDROID_HARDWARE_GATEKEEPER_V1_0_GATEKEEPER_H
17 #define ANDROID_HARDWARE_GATEKEEPER_V1_0_GATEKEEPER_H
18 
19 #include <android/hardware/gatekeeper/1.0/IGatekeeper.h>
20 #include <hidl/Status.h>
21 
22 #include <hidl/MQDescriptor.h>
23 
24 #include <hardware/hardware.h>
25 #include <hardware/gatekeeper.h>
26 
27 namespace android {
28 namespace hardware {
29 namespace gatekeeper {
30 namespace V1_0 {
31 namespace implementation {
32 
33 using ::android::hardware::gatekeeper::V1_0::GatekeeperResponse;
34 using ::android::hardware::gatekeeper::V1_0::IGatekeeper;
35 using ::android::hardware::Return;
36 using ::android::hardware::Void;
37 using ::android::hardware::hidl_vec;
38 using ::android::hardware::hidl_string;
39 using ::android::sp;
40 
41 class Gatekeeper : public IGatekeeper {
42 public:
43     Gatekeeper();
44     ~Gatekeeper();
45 
46     // Methods from ::android::hardware::gatekeeper::V1_0::IGatekeeper follow.
47     Return<void> enroll(uint32_t uid,
48                         const hidl_vec<uint8_t>& currentPasswordHandle,
49                         const hidl_vec<uint8_t>& currentPassword,
50                         const hidl_vec<uint8_t>& desiredPassword,
51                         enroll_cb _hidl_cb)  override;
52     Return<void> verify(uint32_t uid,
53                         uint64_t challenge,
54                         const hidl_vec<uint8_t>& enrolledPasswordHandle,
55                         const hidl_vec<uint8_t>& providedPassword,
56                         verify_cb _hidl_cb)  override;
57     Return<void> deleteUser(uint32_t uid, deleteUser_cb _hidl_cb)  override;
58     Return<void> deleteAllUsers(deleteAllUsers_cb _hidl_cb)  override;
59 private:
60     gatekeeper_device_t *device;
61     const hw_module_t *module;
62 };
63 
64 extern "C" IGatekeeper* HIDL_FETCH_IGatekeeper(const char* name);
65 
66 }  // namespace implementation
67 }  // namespace V1_0
68 }  // namespace gatekeeper
69 }  // namespace hardware
70 }  // namespace android
71 
72 #endif  // ANDROID_HARDWARE_GATEKEEPER_V1_0_GATEKEEPER_H
73