blob: 23767efa08374e44f96d0e127de70964a078fc1c [file] [log] [blame]
Janis Danisevskis0f35e5a2016-10-12 11:33:13 +01001/*
2 **
3 ** Copyright 2016, The Android Open Source Project
4 **
5 ** Licensed under the Apache License, Version 2.0 (the "License");
6 ** you may not use this file except in compliance with the License.
7 ** You may obtain a copy of the License at
8 **
9 ** http://www.apache.org/licenses/LICENSE-2.0
10 **
11 ** Unless required by applicable law or agreed to in writing, software
12 ** distributed under the License is distributed on an "AS IS" BASIS,
13 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 ** See the License for the specific language governing permissions and
15 ** limitations under the License.
16 */
17
18#ifndef HIDL_GENERATED_android_hardware_keymaster_V3_0_KeymasterDevice_H_
19#define HIDL_GENERATED_android_hardware_keymaster_V3_0_KeymasterDevice_H_
20
21#include <hardware/keymaster2.h>
22
23#include <android/hardware/keymaster/3.0/IKeymasterDevice.h>
24#include <hidl/Status.h>
25
26#include <hidl/MQDescriptor.h>
27namespace android {
28namespace hardware {
29namespace keymaster {
30namespace V3_0 {
31namespace implementation {
32
33using ::android::hardware::keymaster::V3_0::ErrorCode;
34using ::android::hardware::keymaster::V3_0::IKeymasterDevice;
35using ::android::hardware::keymaster::V3_0::KeyCharacteristics;
36using ::android::hardware::keymaster::V3_0::KeyFormat;
37using ::android::hardware::keymaster::V3_0::KeyParameter;
38using ::android::hardware::keymaster::V3_0::KeyPurpose;
39using ::android::hardware::Return;
40using ::android::hardware::Void;
41using ::android::hardware::hidl_vec;
42using ::android::hardware::hidl_string;
43using ::android::sp;
44
45class KeymasterDevice : public IKeymasterDevice {
46 public:
47 KeymasterDevice(keymaster2_device_t* dev, uint32_t hardware_version, bool hardware_supports_ec)
48 : keymaster_device_(dev), hardware_version_(hardware_version),
49 hardware_supports_ec_(hardware_supports_ec) {}
50 virtual ~KeymasterDevice();
51
52 // Methods from ::android::hardware::keymaster::V3_0::IKeymasterDevice follow.
53 Return<void> getHardwareFeatures(getHardwareFeatures_cb _hidl_cb);
54 Return<ErrorCode> addRngEntropy(const hidl_vec<uint8_t>& data) override;
55 Return<void> generateKey(const hidl_vec<KeyParameter>& keyParams,
56 generateKey_cb _hidl_cb) override;
57 Return<void> getKeyCharacteristics(const hidl_vec<uint8_t>& keyBlob,
58 const hidl_vec<uint8_t>& clientId,
59 const hidl_vec<uint8_t>& appData,
60 getKeyCharacteristics_cb _hidl_cb) override;
61 Return<void> importKey(const hidl_vec<KeyParameter>& params, KeyFormat keyFormat,
62 const hidl_vec<uint8_t>& keyData, importKey_cb _hidl_cb) override;
63 Return<void> exportKey(KeyFormat exportFormat, const hidl_vec<uint8_t>& keyBlob,
64 const hidl_vec<uint8_t>& clientId, const hidl_vec<uint8_t>& appData,
65 exportKey_cb _hidl_cb) override;
66 Return<void> attestKey(const hidl_vec<uint8_t>& keyToAttest,
67 const hidl_vec<KeyParameter>& attestParams,
68 attestKey_cb _hidl_cb) override;
69 Return<void> upgradeKey(const hidl_vec<uint8_t>& keyBlobToUpgrade,
70 const hidl_vec<KeyParameter>& upgradeParams,
71 upgradeKey_cb _hidl_cb) override;
72 Return<ErrorCode> deleteKey(const hidl_vec<uint8_t>& keyBlob) override;
73 Return<ErrorCode> deleteAllKeys() override;
74 Return<void> begin(KeyPurpose purpose, const hidl_vec<uint8_t>& key,
75 const hidl_vec<KeyParameter>& inParams, begin_cb _hidl_cb) override;
76 Return<void> update(uint64_t operationHandle, const hidl_vec<KeyParameter>& inParams,
77 const hidl_vec<uint8_t>& input, update_cb _hidl_cb) override;
78 Return<void> finish(uint64_t operationHandle, const hidl_vec<KeyParameter>& inParams,
79 const hidl_vec<uint8_t>& input, const hidl_vec<uint8_t>& signature,
80 finish_cb _hidl_cb) override;
81 Return<ErrorCode> abort(uint64_t operationHandle) override;
82
83 private:
84 keymaster2_device_t* keymaster_device_;
85 uint32_t hardware_version_;
86 bool hardware_supports_ec_;
87};
88
89extern "C" IKeymasterDevice* HIDL_FETCH_IKeymasterDevice(const char* name);
90
91} // namespace implementation
92} // namespace V3_0
93} // namespace keymaster
94} // namespace hardware
95} // namespace android
96
97#endif // HIDL_GENERATED_android_hardware_keymaster_V3_0_KeymasterDevice_H_