blob: 00f1fe2b2b0236e3fc508ef5014c4eb1c7176422 [file] [log] [blame]
Max Bires33aac2d2018-02-23 10:53:10 -08001/*
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
28namespace keystore {
29
30using ::android::IBinder;
31using ::android::sp;
32using keymaster::support::Keymaster;
33
34struct 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;
Shawn Willden2eef1352018-05-22 16:13:24 -060053 VerificationToken verificationToken;
Max Bires33aac2d2018-02-23 10:53:10 -080054 const hidl_vec<KeyParameter> params;
55};
56
57} // namespace keystore
58
59#endif