blob: e59443c44e6ef6b5c4c7a4d18a1b26b8ccaad867 [file] [log] [blame]
Selene Huang31ab4042020-04-29 04:22:39 -07001/*
2 * Copyright (C) 2020 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
Selene Huang31ab4042020-04-29 04:22:39 -070017#pragma once
18
David Drysdaleadfe6112021-05-27 12:00:53 +010019#include <functional>
David Drysdale300b5552021-05-20 12:05:26 +010020#include <string_view>
21
Selene Huang31ab4042020-04-29 04:22:39 -070022#include <aidl/Gtest.h>
23#include <aidl/Vintf.h>
David Drysdalea676c3b2021-06-14 14:46:02 +010024#include <android-base/properties.h>
Selene Huang31ab4042020-04-29 04:22:39 -070025#include <binder/IServiceManager.h>
26#include <binder/ProcessState.h>
27#include <gtest/gtest.h>
Shawn Willden7c130392020-12-21 09:58:22 -070028#include <openssl/x509.h>
Selene Huang31ab4042020-04-29 04:22:39 -070029
Janis Danisevskis24c04702020-12-16 18:28:39 -080030#include <aidl/android/hardware/security/keymint/ErrorCode.h>
31#include <aidl/android/hardware/security/keymint/IKeyMintDevice.h>
David Drysdale4dc01072021-04-01 12:17:35 +010032#include <aidl/android/hardware/security/keymint/MacedPublicKey.h>
Shawn Willden1d3f85e2020-12-09 14:18:44 -070033
Shawn Willden08a7e432020-12-11 13:05:27 +000034#include <keymint_support/authorization_set.h>
Shawn Willden7c130392020-12-21 09:58:22 -070035#include <keymint_support/openssl_utils.h>
Selene Huang31ab4042020-04-29 04:22:39 -070036
Shawn Willden0e80b5d2020-12-17 09:07:27 -070037namespace aidl::android::hardware::security::keymint {
38
39::std::ostream& operator<<(::std::ostream& os, const AuthorizationSet& set);
40
Shawn Willden7c130392020-12-21 09:58:22 -070041inline bool operator==(const keymint::AuthorizationSet& a, const keymint::AuthorizationSet& b) {
42 return a.size() == b.size() && std::equal(a.begin(), a.end(), b.begin());
43}
44
Shawn Willden0e80b5d2020-12-17 09:07:27 -070045namespace test {
Selene Huang31ab4042020-04-29 04:22:39 -070046
47using ::android::sp;
Janis Danisevskis24c04702020-12-16 18:28:39 -080048using Status = ::ndk::ScopedAStatus;
Shawn Willden7c130392020-12-21 09:58:22 -070049using ::std::optional;
Selene Huang31ab4042020-04-29 04:22:39 -070050using ::std::shared_ptr;
51using ::std::string;
52using ::std::vector;
53
54constexpr uint64_t kOpHandleSentinel = 0xFFFFFFFFFFFFFFFF;
55
Selene Huang31ab4042020-04-29 04:22:39 -070056class KeyMintAidlTestBase : public ::testing::TestWithParam<string> {
57 public:
Chirag Pathak9ea6a0a2021-02-01 23:54:27 +000058 struct KeyData {
59 vector<uint8_t> blob;
60 vector<KeyCharacteristics> characteristics;
61 };
62
Shawn Willden7c130392020-12-21 09:58:22 -070063 static bool arm_deleteAllKeys;
64 static bool dump_Attestations;
65
Selene Huang31ab4042020-04-29 04:22:39 -070066 void SetUp() override;
67 void TearDown() override {
68 if (key_blob_.size()) {
69 CheckedDeleteKey();
70 }
71 AbortIfNeeded();
72 }
73
Janis Danisevskis24c04702020-12-16 18:28:39 -080074 void InitializeKeyMint(std::shared_ptr<IKeyMintDevice> keyMint);
Selene Huang31ab4042020-04-29 04:22:39 -070075 IKeyMintDevice& keyMint() { return *keymint_; }
David Drysdale7dff4fc2021-12-10 10:10:52 +000076 int32_t AidlVersion();
Selene Huang31ab4042020-04-29 04:22:39 -070077 uint32_t os_version() { return os_version_; }
78 uint32_t os_patch_level() { return os_patch_level_; }
David Drysdalebb3d85e2021-04-13 11:15:51 +010079 uint32_t vendor_patch_level() { return vendor_patch_level_; }
David Drysdale37af4b32021-05-14 16:46:59 +010080 uint32_t boot_patch_level(const vector<KeyCharacteristics>& key_characteristics);
81 uint32_t boot_patch_level();
Selene Huang31ab4042020-04-29 04:22:39 -070082
David Drysdale42fe1892021-10-14 14:43:46 +010083 bool Curve25519Supported();
84
Janis Danisevskis24c04702020-12-16 18:28:39 -080085 ErrorCode GetReturnErrorCode(const Status& result);
Selene Huang31ab4042020-04-29 04:22:39 -070086
Shawn Willden7c130392020-12-21 09:58:22 -070087 ErrorCode GenerateKey(const AuthorizationSet& key_desc, vector<uint8_t>* key_blob,
88 vector<KeyCharacteristics>* key_characteristics) {
89 return GenerateKey(key_desc, std::nullopt /* attest_key */, key_blob, key_characteristics,
90 &cert_chain_);
91 }
92 ErrorCode GenerateKey(const AuthorizationSet& key_desc,
93 const optional<AttestationKey>& attest_key, vector<uint8_t>* key_blob,
94 vector<KeyCharacteristics>* key_characteristics,
95 vector<Certificate>* cert_chain);
96 ErrorCode GenerateKey(const AuthorizationSet& key_desc,
97 const optional<AttestationKey>& attest_key = std::nullopt);
98
Selene Huang31ab4042020-04-29 04:22:39 -070099 ErrorCode ImportKey(const AuthorizationSet& key_desc, KeyFormat format,
100 const string& key_material, vector<uint8_t>* key_blob,
Shawn Willden7f424372021-01-10 18:06:50 -0700101 vector<KeyCharacteristics>* key_characteristics);
Selene Huang31ab4042020-04-29 04:22:39 -0700102 ErrorCode ImportKey(const AuthorizationSet& key_desc, KeyFormat format,
103 const string& key_material);
104
105 ErrorCode ImportWrappedKey(string wrapped_key, string wrapping_key,
106 const AuthorizationSet& wrapping_key_desc, string masking_key,
David Drysdaled2cc8c22021-04-15 13:29:45 +0100107 const AuthorizationSet& unwrapping_params, int64_t password_sid,
108 int64_t biometric_sid);
109 ErrorCode ImportWrappedKey(string wrapped_key, string wrapping_key,
110 const AuthorizationSet& wrapping_key_desc, string masking_key,
111 const AuthorizationSet& unwrapping_params) {
112 return ImportWrappedKey(wrapped_key, wrapping_key, wrapping_key_desc, masking_key,
113 unwrapping_params, 0 /* password_sid */, 0 /* biometric_sid */);
114 }
Selene Huang31ab4042020-04-29 04:22:39 -0700115
David Drysdale300b5552021-05-20 12:05:26 +0100116 ErrorCode GetCharacteristics(const vector<uint8_t>& key_blob, const vector<uint8_t>& app_id,
117 const vector<uint8_t>& app_data,
118 vector<KeyCharacteristics>* key_characteristics);
119 ErrorCode GetCharacteristics(const vector<uint8_t>& key_blob,
120 vector<KeyCharacteristics>* key_characteristics);
121
122 void CheckCharacteristics(const vector<uint8_t>& key_blob,
123 const vector<KeyCharacteristics>& generate_characteristics);
124 void CheckAppIdCharacteristics(const vector<uint8_t>& key_blob, std::string_view app_id_string,
125 std::string_view app_data_string,
126 const vector<KeyCharacteristics>& generate_characteristics);
127
Selene Huang31ab4042020-04-29 04:22:39 -0700128 ErrorCode DeleteKey(vector<uint8_t>* key_blob, bool keep_key_blob = false);
129 ErrorCode DeleteKey(bool keep_key_blob = false);
130
131 ErrorCode DeleteAllKeys();
132
David Drysdaled2cc8c22021-04-15 13:29:45 +0100133 ErrorCode DestroyAttestationIds();
134
Selene Huang31ab4042020-04-29 04:22:39 -0700135 void CheckedDeleteKey(vector<uint8_t>* key_blob, bool keep_key_blob = false);
136 void CheckedDeleteKey();
137
138 ErrorCode Begin(KeyPurpose purpose, const vector<uint8_t>& key_blob,
139 const AuthorizationSet& in_params, AuthorizationSet* out_params,
Janis Danisevskis24c04702020-12-16 18:28:39 -0800140 std::shared_ptr<IKeyMintOperation>& op);
Selene Huang31ab4042020-04-29 04:22:39 -0700141 ErrorCode Begin(KeyPurpose purpose, const vector<uint8_t>& key_blob,
142 const AuthorizationSet& in_params, AuthorizationSet* out_params);
143 ErrorCode Begin(KeyPurpose purpose, const AuthorizationSet& in_params,
144 AuthorizationSet* out_params);
145 ErrorCode Begin(KeyPurpose purpose, const AuthorizationSet& in_params);
146
Shawn Willden92d79c02021-02-19 07:31:55 -0700147 ErrorCode UpdateAad(const string& input);
148 ErrorCode Update(const string& input, string* output);
Selene Huang31ab4042020-04-29 04:22:39 -0700149
Selene Huang31ab4042020-04-29 04:22:39 -0700150 ErrorCode Finish(const string& message, const string& signature, string* output);
Shawn Willden92d79c02021-02-19 07:31:55 -0700151 ErrorCode Finish(const string& message, string* output) {
152 return Finish(message, {} /* signature */, output);
153 }
154 ErrorCode Finish(string* output) { return Finish({} /* message */, output); }
Selene Huang31ab4042020-04-29 04:22:39 -0700155
156 ErrorCode Abort();
Janis Danisevskis24c04702020-12-16 18:28:39 -0800157 ErrorCode Abort(const shared_ptr<IKeyMintOperation>& op);
Selene Huang31ab4042020-04-29 04:22:39 -0700158 void AbortIfNeeded();
159
160 string ProcessMessage(const vector<uint8_t>& key_blob, KeyPurpose operation,
161 const string& message, const AuthorizationSet& in_params,
162 AuthorizationSet* out_params);
Shawn Willden92d79c02021-02-19 07:31:55 -0700163 std::tuple<ErrorCode, std::string /* processedMessage */> ProcessMessage(
164 const vector<uint8_t>& key_blob, KeyPurpose operation, const std::string& message,
165 const AuthorizationSet& in_params);
Selene Huang31ab4042020-04-29 04:22:39 -0700166 string SignMessage(const vector<uint8_t>& key_blob, const string& message,
167 const AuthorizationSet& params);
168 string SignMessage(const string& message, const AuthorizationSet& params);
169
170 string MacMessage(const string& message, Digest digest, size_t mac_length);
171
anil.hiranniah19a4ca12022-03-03 17:39:30 +0530172 void CheckAesIncrementalEncryptOperation(BlockMode block_mode, int message_size);
173
Selene Huang31ab4042020-04-29 04:22:39 -0700174 void CheckHmacTestVector(const string& key, const string& message, Digest digest,
175 const string& expected_mac);
176
177 void CheckAesCtrTestVector(const string& key, const string& nonce, const string& message,
178 const string& expected_ciphertext);
179
180 void CheckTripleDesTestVector(KeyPurpose purpose, BlockMode block_mode,
181 PaddingMode padding_mode, const string& key, const string& iv,
182 const string& input, const string& expected_output);
183
184 void VerifyMessage(const vector<uint8_t>& key_blob, const string& message,
185 const string& signature, const AuthorizationSet& params);
186 void VerifyMessage(const string& message, const string& signature,
187 const AuthorizationSet& params);
David Drysdaledf8f52e2021-05-06 08:10:58 +0100188 void LocalVerifyMessage(const string& message, const string& signature,
189 const AuthorizationSet& params);
Selene Huang31ab4042020-04-29 04:22:39 -0700190
David Drysdale59cae642021-05-12 13:52:03 +0100191 string LocalRsaEncryptMessage(const string& message, const AuthorizationSet& params);
Selene Huang31ab4042020-04-29 04:22:39 -0700192 string EncryptMessage(const vector<uint8_t>& key_blob, const string& message,
193 const AuthorizationSet& in_params, AuthorizationSet* out_params);
194 string EncryptMessage(const string& message, const AuthorizationSet& params,
195 AuthorizationSet* out_params);
196 string EncryptMessage(const string& message, const AuthorizationSet& params);
197 string EncryptMessage(const string& message, BlockMode block_mode, PaddingMode padding);
198 string EncryptMessage(const string& message, BlockMode block_mode, PaddingMode padding,
199 vector<uint8_t>* iv_out);
200 string EncryptMessage(const string& message, BlockMode block_mode, PaddingMode padding,
201 const vector<uint8_t>& iv_in);
202 string EncryptMessage(const string& message, BlockMode block_mode, PaddingMode padding,
203 uint8_t mac_length_bits, const vector<uint8_t>& iv_in);
David Drysdaled2cc8c22021-04-15 13:29:45 +0100204 string EncryptMessage(const string& message, BlockMode block_mode, PaddingMode padding,
205 uint8_t mac_length_bits);
Selene Huang31ab4042020-04-29 04:22:39 -0700206
207 string DecryptMessage(const vector<uint8_t>& key_blob, const string& ciphertext,
208 const AuthorizationSet& params);
209 string DecryptMessage(const string& ciphertext, const AuthorizationSet& params);
210 string DecryptMessage(const string& ciphertext, BlockMode block_mode, PaddingMode padding_mode,
211 const vector<uint8_t>& iv);
212
213 std::pair<ErrorCode, vector<uint8_t>> UpgradeKey(const vector<uint8_t>& key_blob);
214
Chirag Pathak9ea6a0a2021-02-01 23:54:27 +0000215 template <typename TagType>
216 std::tuple<KeyData /* aesKey */, KeyData /* hmacKey */, KeyData /* rsaKey */,
217 KeyData /* ecdsaKey */>
David Drysdaleadfe6112021-05-27 12:00:53 +0100218 CreateTestKeys(
219 TagType tagToTest, ErrorCode expectedReturn,
220 std::function<void(AuthorizationSetBuilder*)> tagModifier =
221 [](AuthorizationSetBuilder*) {}) {
Chirag Pathak9ea6a0a2021-02-01 23:54:27 +0000222 /* AES */
223 KeyData aesKeyData;
David Drysdaleadfe6112021-05-27 12:00:53 +0100224 AuthorizationSetBuilder aesBuilder = AuthorizationSetBuilder()
225 .AesEncryptionKey(128)
226 .Authorization(tagToTest)
227 .BlockMode(BlockMode::ECB)
228 .Padding(PaddingMode::NONE)
229 .Authorization(TAG_NO_AUTH_REQUIRED);
230 tagModifier(&aesBuilder);
231 ErrorCode errorCode =
232 GenerateKey(aesBuilder, &aesKeyData.blob, &aesKeyData.characteristics);
Chirag Pathak9ea6a0a2021-02-01 23:54:27 +0000233 EXPECT_EQ(expectedReturn, errorCode);
234
235 /* HMAC */
236 KeyData hmacKeyData;
David Drysdaleadfe6112021-05-27 12:00:53 +0100237 AuthorizationSetBuilder hmacBuilder = AuthorizationSetBuilder()
238 .HmacKey(128)
239 .Authorization(tagToTest)
240 .Digest(Digest::SHA_2_256)
241 .Authorization(TAG_MIN_MAC_LENGTH, 128)
242 .Authorization(TAG_NO_AUTH_REQUIRED);
243 tagModifier(&hmacBuilder);
244 errorCode = GenerateKey(hmacBuilder, &hmacKeyData.blob, &hmacKeyData.characteristics);
Chirag Pathak9ea6a0a2021-02-01 23:54:27 +0000245 EXPECT_EQ(expectedReturn, errorCode);
246
247 /* RSA */
248 KeyData rsaKeyData;
David Drysdaleadfe6112021-05-27 12:00:53 +0100249 AuthorizationSetBuilder rsaBuilder = AuthorizationSetBuilder()
250 .RsaSigningKey(2048, 65537)
251 .Authorization(tagToTest)
252 .Digest(Digest::NONE)
253 .Padding(PaddingMode::NONE)
254 .Authorization(TAG_NO_AUTH_REQUIRED)
255 .SetDefaultValidity();
256 tagModifier(&rsaBuilder);
257 errorCode = GenerateKey(rsaBuilder, &rsaKeyData.blob, &rsaKeyData.characteristics);
subrahmanyaman05642492022-02-05 07:10:56 +0000258 if (!(SecLevel() == SecurityLevel::STRONGBOX &&
259 ErrorCode::ATTESTATION_KEYS_NOT_PROVISIONED == errorCode)) {
260 EXPECT_EQ(expectedReturn, errorCode);
261 }
Chirag Pathak9ea6a0a2021-02-01 23:54:27 +0000262
263 /* ECDSA */
264 KeyData ecdsaKeyData;
David Drysdaleadfe6112021-05-27 12:00:53 +0100265 AuthorizationSetBuilder ecdsaBuilder = AuthorizationSetBuilder()
David Drysdaledf09e542021-06-08 15:46:11 +0100266 .EcdsaSigningKey(EcCurve::P_256)
David Drysdaleadfe6112021-05-27 12:00:53 +0100267 .Authorization(tagToTest)
268 .Digest(Digest::SHA_2_256)
269 .Authorization(TAG_NO_AUTH_REQUIRED)
270 .SetDefaultValidity();
271 tagModifier(&ecdsaBuilder);
272 errorCode = GenerateKey(ecdsaBuilder, &ecdsaKeyData.blob, &ecdsaKeyData.characteristics);
subrahmanyaman05642492022-02-05 07:10:56 +0000273 if (!(SecLevel() == SecurityLevel::STRONGBOX &&
274 ErrorCode::ATTESTATION_KEYS_NOT_PROVISIONED == errorCode)) {
275 EXPECT_EQ(expectedReturn, errorCode);
276 }
Chirag Pathak9ea6a0a2021-02-01 23:54:27 +0000277 return {aesKeyData, hmacKeyData, rsaKeyData, ecdsaKeyData};
278 }
Shawn Willden7f424372021-01-10 18:06:50 -0700279 bool IsSecure() const { return securityLevel_ != SecurityLevel::SOFTWARE; }
280 SecurityLevel SecLevel() const { return securityLevel_; }
Selene Huang31ab4042020-04-29 04:22:39 -0700281
282 vector<uint32_t> ValidKeySizes(Algorithm algorithm);
283 vector<uint32_t> InvalidKeySizes(Algorithm algorithm);
284
David Drysdale7de9feb2021-03-05 14:56:19 +0000285 vector<BlockMode> ValidBlockModes(Algorithm algorithm);
286 vector<PaddingMode> ValidPaddingModes(Algorithm algorithm, BlockMode blockMode);
287 vector<PaddingMode> InvalidPaddingModes(Algorithm algorithm, BlockMode blockMode);
288
Selene Huang31ab4042020-04-29 04:22:39 -0700289 vector<EcCurve> ValidCurves();
290 vector<EcCurve> InvalidCurves();
291
292 vector<Digest> ValidDigests(bool withNone, bool withMD5);
subrahmanyaman05642492022-02-05 07:10:56 +0000293 vector<uint64_t> ValidExponents();
Selene Huang31ab4042020-04-29 04:22:39 -0700294
295 static vector<string> build_params() {
Janis Danisevskis24c04702020-12-16 18:28:39 -0800296 auto params = ::android::getAidlHalInstanceNames(IKeyMintDevice::descriptor);
Selene Huang31ab4042020-04-29 04:22:39 -0700297 return params;
298 }
299
Janis Danisevskis24c04702020-12-16 18:28:39 -0800300 std::shared_ptr<IKeyMintOperation> op_;
Shawn Willden7f424372021-01-10 18:06:50 -0700301 vector<Certificate> cert_chain_;
Selene Huang31ab4042020-04-29 04:22:39 -0700302 vector<uint8_t> key_blob_;
Shawn Willden7f424372021-01-10 18:06:50 -0700303 vector<KeyCharacteristics> key_characteristics_;
304
305 const vector<KeyParameter>& SecLevelAuthorizations(
306 const vector<KeyCharacteristics>& key_characteristics);
307 inline const vector<KeyParameter>& SecLevelAuthorizations() {
308 return SecLevelAuthorizations(key_characteristics_);
309 }
Qi Wubeefae42021-01-28 23:16:37 +0800310 const vector<KeyParameter>& SecLevelAuthorizations(
311 const vector<KeyCharacteristics>& key_characteristics, SecurityLevel securityLevel);
312
Chirag Pathak9ea6a0a2021-02-01 23:54:27 +0000313 ErrorCode UseAesKey(const vector<uint8_t>& aesKeyBlob);
314 ErrorCode UseHmacKey(const vector<uint8_t>& hmacKeyBlob);
315 ErrorCode UseRsaKey(const vector<uint8_t>& rsaKeyBlob);
316 ErrorCode UseEcdsaKey(const vector<uint8_t>& ecdsaKeyBlob);
Selene Huang31ab4042020-04-29 04:22:39 -0700317
Shawn Willdend659c7c2021-02-19 14:51:51 -0700318 protected:
Janis Danisevskis24c04702020-12-16 18:28:39 -0800319 std::shared_ptr<IKeyMintDevice> keymint_;
Selene Huang31ab4042020-04-29 04:22:39 -0700320 uint32_t os_version_;
321 uint32_t os_patch_level_;
David Drysdalebb3d85e2021-04-13 11:15:51 +0100322 uint32_t vendor_patch_level_;
David Drysdaled2cc8c22021-04-15 13:29:45 +0100323 bool timestamp_token_required_;
Selene Huang31ab4042020-04-29 04:22:39 -0700324
325 SecurityLevel securityLevel_;
326 string name_;
327 string author_;
328 long challenge_;
329};
330
David Drysdalea676c3b2021-06-14 14:46:02 +0100331// If the given property is available, add it to the tag set under the given tag ID.
332template <Tag tag>
333void add_tag_from_prop(AuthorizationSetBuilder* tags, TypedTag<TagType::BYTES, tag> ttag,
334 const char* prop) {
335 std::string prop_value = ::android::base::GetProperty(prop, /* default= */ "");
336 if (!prop_value.empty()) {
337 tags->Authorization(ttag, prop_value.data(), prop_value.size());
338 }
339}
340
Selene Huang6e46f142021-04-20 19:20:11 -0700341vector<uint8_t> build_serial_blob(const uint64_t serial_int);
342void verify_subject(const X509* cert, const string& subject, bool self_signed);
343void verify_serial(X509* cert, const uint64_t expected_serial);
344void verify_subject_and_serial(const Certificate& certificate, //
345 const uint64_t expected_serial, //
346 const string& subject, bool self_signed);
347
David Drysdale7dff4fc2021-12-10 10:10:52 +0000348bool verify_attestation_record(int aidl_version, //
349 const string& challenge, //
Shawn Willden7c130392020-12-21 09:58:22 -0700350 const string& app_id, //
351 AuthorizationSet expected_sw_enforced, //
352 AuthorizationSet expected_hw_enforced, //
353 SecurityLevel security_level,
David Drysdale565ccc72021-10-11 12:49:50 +0100354 const vector<uint8_t>& attestation_cert,
355 vector<uint8_t>* unique_id = nullptr);
Selene Huang6e46f142021-04-20 19:20:11 -0700356
Shawn Willden7c130392020-12-21 09:58:22 -0700357string bin2hex(const vector<uint8_t>& data);
358X509_Ptr parse_cert_blob(const vector<uint8_t>& blob);
David Drysdalef0d516d2021-03-22 07:51:43 +0000359vector<uint8_t> make_name_from_str(const string& name);
David Drysdale4dc01072021-04-01 12:17:35 +0100360void check_maced_pubkey(const MacedPublicKey& macedPubKey, bool testMode,
361 vector<uint8_t>* payload_value);
362void p256_pub_key(const vector<uint8_t>& coseKeyData, EVP_PKEY_Ptr* signingKey);
363
David Drysdalef0d516d2021-03-22 07:51:43 +0000364AuthorizationSet HwEnforcedAuthorizations(const vector<KeyCharacteristics>& key_characteristics);
365AuthorizationSet SwEnforcedAuthorizations(const vector<KeyCharacteristics>& key_characteristics);
Eran Messeri03d7a1a2021-07-06 12:07:57 +0100366::testing::AssertionResult ChainSignaturesAreValid(const vector<Certificate>& chain,
367 bool strict_issuer_check = true);
Shawn Willden7c130392020-12-21 09:58:22 -0700368
Selene Huang31ab4042020-04-29 04:22:39 -0700369#define INSTANTIATE_KEYMINT_AIDL_TEST(name) \
370 INSTANTIATE_TEST_SUITE_P(PerInstance, name, \
371 testing::ValuesIn(KeyMintAidlTestBase::build_params()), \
Shawn Willden7e71f1e2021-04-01 16:44:22 -0600372 ::android::PrintInstanceNameToString); \
373 GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(name);
Selene Huang31ab4042020-04-29 04:22:39 -0700374
Shawn Willden0e80b5d2020-12-17 09:07:27 -0700375} // namespace test
376
377} // namespace aidl::android::hardware::security::keymint