blob: 6593b2cd61c2460b1a372a8a6d111d1dff597621 [file] [log] [blame]
dianlujitao47d41f62019-10-06 12:04:33 +08001/*
2 * Copyright (C) 2019 The LineageOS 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#pragma once
18
19#include <ICryptfsHwController.h>
20#include <android-base/macros.h>
21
22#include <memory>
23
24namespace vendor {
25namespace qti {
26namespace hardware {
27namespace cryptfshw {
28namespace V1_0 {
29namespace implementation {
30namespace qsee {
31
32// interface wrapper
33class Controller : public ICryptfsHwController {
34 public:
35 Controller();
36 int createKey(int usage, const char* passwd) override;
37 int updateKey(int usage, const char* oldpw, const char* newpw) override;
38 int wipeKey(int usage) override;
39
40 private:
41 template <typename Function>
42 Function loadFunction(const char* name);
43 std::shared_ptr<void> handle_;
44
45 int (*mFn_create_key)(int, void*);
46 int (*mFn_update_key_user_info)(int, void*, void*);
47 int (*mFn_wipe_key)(int);
48
49 DISALLOW_COPY_AND_ASSIGN(Controller);
50 Controller(Controller&&) = delete;
51 Controller& operator=(Controller&&) = delete;
52};
53
54} // namespace qsee
55} // namespace implementation
56} // namespace V1_0
57} // namespace cryptfshw
58} // namespace hardware
59} // namespace qti
60} // namespace vendor