summaryrefslogtreecommitdiff
path: root/include/amlogic_keymaster/AmlogicKeymaster4Device.h (plain)
blob: f4225ebf5edaf5e3f894ee4dba12ae620ad1f02c
1/*
2 **
3 ** Copyright 2017, 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 keymaster_V4_0_AmlogicKeymaster4Device_H_
19#define keymaster_V4_0_AmlogicKeymaster4Device_H_
20
21#include <android/hardware/keymaster/4.0/IKeymasterDevice.h>
22#include <hidl/Status.h>
23#include <amlogic_keymaster/AmlogicKeymaster.h>
24
25namespace keymaster {
26
27namespace V4_0 {
28
29using ::android::sp;
30using ::android::hardware::hidl_vec;
31using ::android::hardware::Return;
32using ::android::hardware::Void;
33using ::android::hardware::keymaster::V4_0::ErrorCode;
34using ::android::hardware::keymaster::V4_0::HardwareAuthenticatorType;
35using ::android::hardware::keymaster::V4_0::HardwareAuthToken;
36using ::android::hardware::keymaster::V4_0::HmacSharingParameters;
37using ::android::hardware::keymaster::V4_0::IKeymasterDevice;
38using ::android::hardware::keymaster::V4_0::KeyCharacteristics;
39using ::android::hardware::keymaster::V4_0::KeyFormat;
40using ::android::hardware::keymaster::V4_0::KeyParameter;
41using ::android::hardware::keymaster::V4_0::KeyPurpose;
42using ::android::hardware::keymaster::V4_0::SecurityLevel;
43using ::android::hardware::keymaster::V4_0::Tag;
44using ::android::hardware::keymaster::V4_0::VerificationToken;
45
46class AmlogicKeymaster4Device : public IKeymasterDevice {
47 public:
48 explicit AmlogicKeymaster4Device(AmlogicKeymaster* impl);
49 virtual ~AmlogicKeymaster4Device();
50
51 Return<void> getHardwareInfo(getHardwareInfo_cb _hidl_cb) override;
52 Return<void> getHmacSharingParameters(getHmacSharingParameters_cb _hidl_cb) override;
53 Return<void> computeSharedHmac(const hidl_vec<HmacSharingParameters>& params,
54 computeSharedHmac_cb) override;
55 Return<void> verifyAuthorization(uint64_t challenge,
56 const hidl_vec<KeyParameter>& parametersToVerify,
57 const HardwareAuthToken& authToken,
58 verifyAuthorization_cb _hidl_cb) override;
59 Return<ErrorCode> addRngEntropy(const hidl_vec<uint8_t>& data) override;
60 Return<void> generateKey(const hidl_vec<KeyParameter>& keyParams,
61 generateKey_cb _hidl_cb) override;
62 Return<void> getKeyCharacteristics(const hidl_vec<uint8_t>& keyBlob,
63 const hidl_vec<uint8_t>& clientId,
64 const hidl_vec<uint8_t>& appData,
65 getKeyCharacteristics_cb _hidl_cb) override;
66 Return<void> importKey(const hidl_vec<KeyParameter>& params, KeyFormat keyFormat,
67 const hidl_vec<uint8_t>& keyData, importKey_cb _hidl_cb) override;
68 Return<void> importWrappedKey(const hidl_vec<uint8_t>& wrappedKeyData,
69 const hidl_vec<uint8_t>& wrappingKeyBlob,
70 const hidl_vec<uint8_t>& maskingKey,
71 const hidl_vec<KeyParameter>& unwrappingParams,
72 uint64_t passwordSid, uint64_t biometricSid,
73 importWrappedKey_cb _hidl_cb) override;
74 Return<void> exportKey(KeyFormat exportFormat, const hidl_vec<uint8_t>& keyBlob,
75 const hidl_vec<uint8_t>& clientId, const hidl_vec<uint8_t>& appData,
76 exportKey_cb _hidl_cb) override;
77 Return<void> attestKey(const hidl_vec<uint8_t>& keyToAttest,
78 const hidl_vec<KeyParameter>& attestParams,
79 attestKey_cb _hidl_cb) override;
80 Return<void> upgradeKey(const hidl_vec<uint8_t>& keyBlobToUpgrade,
81 const hidl_vec<KeyParameter>& upgradeParams,
82 upgradeKey_cb _hidl_cb) override;
83 Return<ErrorCode> deleteKey(const hidl_vec<uint8_t>& keyBlob) override;
84 Return<ErrorCode> deleteAllKeys() override;
85 Return<ErrorCode> destroyAttestationIds() override;
86 Return<void> begin(KeyPurpose purpose, const hidl_vec<uint8_t>& key,
87 const hidl_vec<KeyParameter>& inParams, const HardwareAuthToken& authToken,
88 begin_cb _hidl_cb) override;
89 Return<void> update(uint64_t operationHandle, const hidl_vec<KeyParameter>& inParams,
90 const hidl_vec<uint8_t>& input, const HardwareAuthToken& authToken,
91 const VerificationToken& verificationToken, update_cb _hidl_cb) override;
92 Return<void> finish(uint64_t operationHandle, const hidl_vec<KeyParameter>& inParams,
93 const hidl_vec<uint8_t>& input, const hidl_vec<uint8_t>& signature,
94 const HardwareAuthToken& authToken,
95 const VerificationToken& verificationToken, finish_cb _hidl_cb) override;
96 Return<ErrorCode> abort(uint64_t operationHandle) override;
97
98 private:
99 std::unique_ptr<::keymaster::AmlogicKeymaster> impl_;
100};
101
102} // namespace V4_0
103} // namespace keymaster
104
105#endif // keymaster_V4_0_AmlogicKeymaster4Device_H_
106