Max Bires | 33aac2d | 2018-02-23 10:53:10 -0800 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (C) 2018 The Android Open Source 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 | #ifndef KEYSTORE_OPERATION_STRUCT_H_ |
| 18 | #define KEYSTORE_OPERATION_STRUCT_H_ |
| 19 | |
| 20 | #include <binder/Binder.h> |
| 21 | #include <binder/IBinder.h> |
| 22 | #include <keymasterV4_0/Keymaster.h> |
| 23 | #include <utils/StrongPointer.h> |
| 24 | |
| 25 | #include <keystore/keymaster_types.h> |
| 26 | #include <keystore/keystore_hidl_support.h> |
| 27 | |
| 28 | namespace keystore { |
| 29 | |
| 30 | using ::android::IBinder; |
| 31 | using ::android::sp; |
| 32 | using keymaster::support::Keymaster; |
| 33 | |
| 34 | struct Operation { |
| 35 | Operation() = default; |
| 36 | Operation(uint64_t handle_, uint64_t keyid_, KeyPurpose purpose_, const sp<Keymaster>& device_, |
| 37 | KeyCharacteristics&& characteristics_, sp<IBinder> appToken_, |
| 38 | const hidl_vec<KeyParameter> params_) |
| 39 | : handle(handle_), keyid(keyid_), purpose(purpose_), device(device_), |
| 40 | characteristics(characteristics_), appToken(appToken_), params(params_) {} |
| 41 | Operation(Operation&&) = default; |
| 42 | Operation(const Operation&) = delete; |
| 43 | |
| 44 | bool hasAuthToken() const { return authToken.mac.size() != 0; } |
| 45 | |
| 46 | uint64_t handle; |
| 47 | uint64_t keyid; |
| 48 | KeyPurpose purpose; |
| 49 | sp<Keymaster> device; |
| 50 | KeyCharacteristics characteristics; |
| 51 | sp<IBinder> appToken; |
| 52 | HardwareAuthToken authToken; |
| 53 | const hidl_vec<KeyParameter> params; |
| 54 | }; |
| 55 | |
| 56 | } // namespace keystore |
| 57 | |
| 58 | #endif |