Janis Danisevskis | 0f35e5a | 2016-10-12 11:33:13 +0100 | [diff] [blame] | 1 | /* |
| 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> |
| 27 | namespace android { |
| 28 | namespace hardware { |
| 29 | namespace keymaster { |
| 30 | namespace V3_0 { |
| 31 | namespace implementation { |
| 32 | |
| 33 | using ::android::hardware::keymaster::V3_0::ErrorCode; |
| 34 | using ::android::hardware::keymaster::V3_0::IKeymasterDevice; |
| 35 | using ::android::hardware::keymaster::V3_0::KeyCharacteristics; |
| 36 | using ::android::hardware::keymaster::V3_0::KeyFormat; |
| 37 | using ::android::hardware::keymaster::V3_0::KeyParameter; |
| 38 | using ::android::hardware::keymaster::V3_0::KeyPurpose; |
| 39 | using ::android::hardware::Return; |
| 40 | using ::android::hardware::Void; |
| 41 | using ::android::hardware::hidl_vec; |
| 42 | using ::android::hardware::hidl_string; |
| 43 | using ::android::sp; |
| 44 | |
| 45 | class 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 | |
| 89 | extern "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_ |