blob: 8198eca96c864437d8cb638b8befd532e91a0270 [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:
Shawn Willdend4417fb2017-02-23 11:01:49 -070047 KeymasterDevice(keymaster2_device_t* dev, uint32_t hardware_version, bool hardware_supports_ec,
48 bool hardware_supports_all_digests)
Janis Danisevskis0f35e5a2016-10-12 11:33:13 +010049 : keymaster_device_(dev), hardware_version_(hardware_version),
Shawn Willdend4417fb2017-02-23 11:01:49 -070050 hardware_supports_ec_(hardware_supports_ec),
51 hardware_supports_all_digests_(hardware_supports_all_digests) {}
Janis Danisevskis0f35e5a2016-10-12 11:33:13 +010052 virtual ~KeymasterDevice();
53
54 // Methods from ::android::hardware::keymaster::V3_0::IKeymasterDevice follow.
55 Return<void> getHardwareFeatures(getHardwareFeatures_cb _hidl_cb);
Shawn Willden62f63c72017-02-17 12:23:51 -070056 Return<void> parseHardwareAuthToken(const hidl_vec<uint8_t>& token,
57 parseHardwareAuthToken_cb _hidl_cb);
Janis Danisevskis0f35e5a2016-10-12 11:33:13 +010058 Return<ErrorCode> addRngEntropy(const hidl_vec<uint8_t>& data) override;
59 Return<void> generateKey(const hidl_vec<KeyParameter>& keyParams,
60 generateKey_cb _hidl_cb) override;
61 Return<void> getKeyCharacteristics(const hidl_vec<uint8_t>& keyBlob,
62 const hidl_vec<uint8_t>& clientId,
63 const hidl_vec<uint8_t>& appData,
64 getKeyCharacteristics_cb _hidl_cb) override;
65 Return<void> importKey(const hidl_vec<KeyParameter>& params, KeyFormat keyFormat,
66 const hidl_vec<uint8_t>& keyData, importKey_cb _hidl_cb) override;
67 Return<void> exportKey(KeyFormat exportFormat, const hidl_vec<uint8_t>& keyBlob,
68 const hidl_vec<uint8_t>& clientId, const hidl_vec<uint8_t>& appData,
69 exportKey_cb _hidl_cb) override;
70 Return<void> attestKey(const hidl_vec<uint8_t>& keyToAttest,
71 const hidl_vec<KeyParameter>& attestParams,
72 attestKey_cb _hidl_cb) override;
73 Return<void> upgradeKey(const hidl_vec<uint8_t>& keyBlobToUpgrade,
74 const hidl_vec<KeyParameter>& upgradeParams,
75 upgradeKey_cb _hidl_cb) override;
76 Return<ErrorCode> deleteKey(const hidl_vec<uint8_t>& keyBlob) override;
77 Return<ErrorCode> deleteAllKeys() override;
Bartosz Fabianowskiaac0fc72017-01-23 13:51:10 +010078 Return<ErrorCode> destroyAttestationIds() override;
Janis Danisevskis0f35e5a2016-10-12 11:33:13 +010079 Return<void> begin(KeyPurpose purpose, const hidl_vec<uint8_t>& key,
80 const hidl_vec<KeyParameter>& inParams, begin_cb _hidl_cb) override;
81 Return<void> update(uint64_t operationHandle, const hidl_vec<KeyParameter>& inParams,
82 const hidl_vec<uint8_t>& input, update_cb _hidl_cb) override;
83 Return<void> finish(uint64_t operationHandle, const hidl_vec<KeyParameter>& inParams,
84 const hidl_vec<uint8_t>& input, const hidl_vec<uint8_t>& signature,
85 finish_cb _hidl_cb) override;
86 Return<ErrorCode> abort(uint64_t operationHandle) override;
87
88 private:
89 keymaster2_device_t* keymaster_device_;
90 uint32_t hardware_version_;
91 bool hardware_supports_ec_;
Shawn Willdend4417fb2017-02-23 11:01:49 -070092 bool hardware_supports_all_digests_;
Janis Danisevskis0f35e5a2016-10-12 11:33:13 +010093};
94
95extern "C" IKeymasterDevice* HIDL_FETCH_IKeymasterDevice(const char* name);
96
97} // namespace implementation
98} // namespace V3_0
99} // namespace keymaster
100} // namespace hardware
101} // namespace android
102
103#endif // HIDL_GENERATED_android_hardware_keymaster_V3_0_KeymasterDevice_H_