Lines Matching refs:kmen

85     TestKeymasterEnforcement kmen;  member in keymaster::test::KeymasterBaseTest
102 keymaster_error_t kmer = kmen.AuthorizeOperation(KM_PURPOSE_SIGN, key_id, single_auth_set); in TEST_F()
115 kmen.AuthorizeOperation(KM_PURPOSE_SIGN, key_id, auth_set)); in TEST_F()
118 ASSERT_EQ(KM_ERROR_OK, kmen.AuthorizeOperation(KM_PURPOSE_VERIFY, key_id, auth_set)); in TEST_F()
128 keymaster_error_t kmer_valid_time = kmen.AuthorizeOperation(KM_PURPOSE_SIGN, key_id, auth_set); in TEST_F()
140 ASSERT_EQ(KM_ERROR_KEY_EXPIRED, kmen.AuthorizeOperation(KM_PURPOSE_SIGN, key_id, auth_set)); in TEST_F()
143 ASSERT_EQ(KM_ERROR_OK, kmen.AuthorizeOperation(KM_PURPOSE_VERIFY, key_id, auth_set)); in TEST_F()
155 kmen.AuthorizeOperation(KM_PURPOSE_VERIFY, key_id, auth_set); in TEST_F()
168 kmen.AuthorizeOperation(KM_PURPOSE_SIGN, key_id, auth_set); in TEST_F()
182 kmen.AuthorizeOperation(KM_PURPOSE_VERIFY, key_id, auth_set); in TEST_F()
196 kmen.AuthorizeOperation(KM_PURPOSE_VERIFY, key_id, auth_set); in TEST_F()
210 kmen.AuthorizeOperation(KM_PURPOSE_SIGN, key_id, auth_set); in TEST_F()
223 kmen.AuthorizeOperation(KM_PURPOSE_VERIFY, key_id, auth_set); in TEST_F()
234 keymaster_error_t kmer1 = kmen.AuthorizeOperation(KM_PURPOSE_SIGN, key_id, auth_set); in TEST_F()
235 keymaster_error_t kmer2 = kmen.AuthorizeOperation(KM_PURPOSE_SIGN, key_id, auth_set); in TEST_F()
249 ASSERT_EQ(KM_ERROR_OK, kmen.AuthorizeOperation(KM_PURPOSE_SIGN, key_id, auth_set)); in TEST_F()
250 ASSERT_EQ(KM_ERROR_OK, kmen.AuthorizeOperation(KM_PURPOSE_SIGN, key_id, auth_set)); in TEST_F()
251 ASSERT_EQ(KM_ERROR_OK, kmen.AuthorizeOperation(KM_PURPOSE_SIGN, key_id, auth_set)); in TEST_F()
252 ASSERT_EQ(KM_ERROR_OK, kmen.AuthorizeOperation(KM_PURPOSE_SIGN, key_id, auth_set)); in TEST_F()
254 kmen.AuthorizeOperation(KM_PURPOSE_SIGN, key_id, auth_set)); in TEST_F()
256 ASSERT_EQ(KM_ERROR_OK, kmen.AuthorizeOperation(KM_PURPOSE_VERIFY, key_id, auth_set)); in TEST_F()
267 EXPECT_EQ(KM_ERROR_OK, kmen.AuthorizeOperation(KM_PURPOSE_SIGN, 1 /* key_id */, auth_set)); in TEST_F()
269 EXPECT_EQ(KM_ERROR_OK, kmen.AuthorizeOperation(KM_PURPOSE_SIGN, 2 /* key_id */, auth_set)); in TEST_F()
271 EXPECT_EQ(KM_ERROR_OK, kmen.AuthorizeOperation(KM_PURPOSE_SIGN, 3 /* key_id */, auth_set)); in TEST_F()
275 kmen.AuthorizeOperation(KM_PURPOSE_SIGN, 4 /* key_id */, auth_set)); in TEST_F()
278 EXPECT_EQ(KM_ERROR_OK, kmen.AuthorizeOperation(KM_PURPOSE_SIGN, 1 /* key_id */, auth_set)); in TEST_F()
282 kmen.AuthorizeOperation(KM_PURPOSE_SIGN, 1 /* key_id */, auth_set)); in TEST_F()
286 kmen.AuthorizeOperation(KM_PURPOSE_SIGN, 4 /* key_id */, auth_set)); in TEST_F()
289 EXPECT_EQ(KM_ERROR_OK, kmen.AuthorizeOperation(KM_PURPOSE_VERIFY, 1 /* key_id */, auth_set)); in TEST_F()
290 EXPECT_EQ(KM_ERROR_OK, kmen.AuthorizeOperation(KM_PURPOSE_VERIFY, 4 /* key_id */, auth_set)); in TEST_F()
301 keymaster_error_t kmer1 = kmen.AuthorizeOperation(KM_PURPOSE_SIGN, key_id, auth_set); in TEST_F()
302 keymaster_error_t kmer2 = kmen.AuthorizeOperation(KM_PURPOSE_SIGN, key_id, auth_set); in TEST_F()
303 keymaster_error_t kmer3 = kmen.AuthorizeOperation(KM_PURPOSE_VERIFY, key_id, auth_set); in TEST_F()
306 kmen.tick(2); in TEST_F()
321 EXPECT_EQ(KM_ERROR_OK, kmen.AuthorizeOperation(KM_PURPOSE_VERIFY, key_id, auth_set)); in TEST_F()
322 kmen.tick(); in TEST_F()
324 kmen.AuthorizeOperation(KM_PURPOSE_SIGN, key_id, auth_set)); in TEST_F()
325 kmen.tick(); in TEST_F()
326 EXPECT_EQ(KM_ERROR_OK, kmen.AuthorizeOperation(KM_PURPOSE_SIGN, key_id, auth_set)); in TEST_F()
338 EXPECT_EQ(KM_ERROR_OK, kmen.AuthorizeOperation(KM_PURPOSE_VERIFY, 1 /* key_id */, auth_set)); in TEST_F()
340 kmen.tick(); in TEST_F()
344 kmen.AuthorizeOperation(KM_PURPOSE_VERIFY, 1 /* key_id */, auth_set)); in TEST_F()
346 EXPECT_EQ(KM_ERROR_OK, kmen.AuthorizeOperation(KM_PURPOSE_VERIFY, 2 /* key_id */, auth_set)); in TEST_F()
348 kmen.tick(); in TEST_F()
352 kmen.AuthorizeOperation(KM_PURPOSE_VERIFY, 1 /* key_id */, auth_set)); in TEST_F()
355 kmen.AuthorizeOperation(KM_PURPOSE_VERIFY, 2 /* key_id */, auth_set)); in TEST_F()
357 EXPECT_EQ(KM_ERROR_OK, kmen.AuthorizeOperation(KM_PURPOSE_VERIFY, 3 /* key_id */, auth_set)); in TEST_F()
359 kmen.tick(); in TEST_F()
363 kmen.AuthorizeOperation(KM_PURPOSE_VERIFY, 1 /* key_id */, auth_set)); in TEST_F()
366 kmen.AuthorizeOperation(KM_PURPOSE_VERIFY, 2 /* key_id */, auth_set)); in TEST_F()
369 kmen.AuthorizeOperation(KM_PURPOSE_VERIFY, 3 /* key_id */, auth_set)); in TEST_F()
372 kmen.AuthorizeOperation(KM_PURPOSE_VERIFY, 4 /* key_id */, auth_set)); in TEST_F()
374 kmen.tick(); in TEST_F()
377 EXPECT_EQ(KM_ERROR_OK, kmen.AuthorizeOperation(KM_PURPOSE_VERIFY, 4 /* key_id */, auth_set)); in TEST_F()
381 kmen.AuthorizeOperation(KM_PURPOSE_VERIFY, 1 /* key_id */, auth_set)); in TEST_F()
384 kmen.AuthorizeOperation(KM_PURPOSE_VERIFY, 2 /* key_id */, auth_set)); in TEST_F()
387 kmen.AuthorizeOperation(KM_PURPOSE_VERIFY, 3 /* key_id */, auth_set)); in TEST_F()
389 kmen.tick(); in TEST_F()
392 EXPECT_EQ(KM_ERROR_OK, kmen.AuthorizeOperation(KM_PURPOSE_VERIFY, 1 /* key_id */, auth_set)); in TEST_F()
395 kmen.AuthorizeOperation(KM_PURPOSE_VERIFY, 2 /* key_id */, auth_set)); in TEST_F()
398 kmen.AuthorizeOperation(KM_PURPOSE_VERIFY, 3 /* key_id */, auth_set)); in TEST_F()
401 kmen.AuthorizeOperation(KM_PURPOSE_VERIFY, 4 /* key_id */, auth_set)); in TEST_F()
403 kmen.tick(4); in TEST_F()
405 EXPECT_EQ(KM_ERROR_OK, kmen.AuthorizeOperation(KM_PURPOSE_VERIFY, 1 /* key_id */, auth_set)); in TEST_F()
406 EXPECT_EQ(KM_ERROR_OK, kmen.AuthorizeOperation(KM_PURPOSE_VERIFY, 2 /* key_id */, auth_set)); in TEST_F()
407 EXPECT_EQ(KM_ERROR_OK, kmen.AuthorizeOperation(KM_PURPOSE_VERIFY, 3 /* key_id */, auth_set)); in TEST_F()
418 EXPECT_EQ(KM_ERROR_OK, kmen.AuthorizeOperation(KM_PURPOSE_SIGN, 1 /* key_id */, auth_set)); in TEST_F()
420 kmen.tick(); in TEST_F()
424 kmen.AuthorizeOperation(KM_PURPOSE_SIGN, 1 /* key_id */, auth_set)); in TEST_F()
426 EXPECT_EQ(KM_ERROR_OK, kmen.AuthorizeOperation(KM_PURPOSE_VERIFY, 1 /* key_id */, auth_set)); in TEST_F()
437 kmen.AuthorizeOperation(invalidPurpose1, key_id, auth_set)); in TEST_F()
439 kmen.AuthorizeOperation(invalidPurpose2, key_id, auth_set)); in TEST_F()
448 EXPECT_EQ(KM_ERROR_OK, kmen.AuthorizeOperation(KM_PURPOSE_SIGN, key_id, auth_set)); in TEST_F()
449 EXPECT_EQ(KM_ERROR_OK, kmen.AuthorizeOperation(KM_PURPOSE_VERIFY, key_id, auth_set)); in TEST_F()
452 kmen.AuthorizeOperation(KM_PURPOSE_ENCRYPT, key_id, auth_set)); in TEST_F()
454 kmen.AuthorizeOperation(KM_PURPOSE_DECRYPT, key_id, auth_set)); in TEST_F()
463 EXPECT_EQ(KM_ERROR_OK, kmen.AuthorizeOperation(KM_PURPOSE_SIGN, key_id, auth_set)); in TEST_F()
464 EXPECT_EQ(KM_ERROR_OK, kmen.AuthorizeOperation(KM_PURPOSE_VERIFY, key_id, auth_set)); in TEST_F()
467 EXPECT_EQ(KM_ERROR_OK, kmen.AuthorizeOperation(KM_PURPOSE_ENCRYPT, key_id, auth_set)); in TEST_F()
469 kmen.AuthorizeOperation(KM_PURPOSE_DECRYPT, key_id, auth_set)); in TEST_F()
485 kmen.AuthorizeOperation(KM_PURPOSE_ENCRYPT, key_id, caller_nonce, begin_params, in TEST_F()
488 kmen.AuthorizeOperation(KM_PURPOSE_DECRYPT, key_id, caller_nonce, begin_params, in TEST_F()
491 kmen.AuthorizeOperation(KM_PURPOSE_ENCRYPT, key_id, no_caller_nonce, begin_params, in TEST_F()
494 kmen.AuthorizeOperation(KM_PURPOSE_DECRYPT, key_id, no_caller_nonce, begin_params, in TEST_F()
504 kmen.AuthorizeOperation(KM_PURPOSE_SIGN, key_id, auth_set)); in TEST_F()
507 EXPECT_EQ(KM_ERROR_OK, kmen.AuthorizeOperation(KM_PURPOSE_VERIFY, key_id, auth_set)); in TEST_F()
516 kmen.AuthorizeOperation(KM_PURPOSE_SIGN, key_id, auth_set)); in TEST_F()
538 kmen.AuthorizeOperation(KM_PURPOSE_SIGN, key_id, auth_set, op_params, token.challenge, in TEST_F()
561 kmen.set_report_token_valid(false); in TEST_F()
563 kmen.AuthorizeOperation(KM_PURPOSE_SIGN, key_id, auth_set, op_params, token.challenge, in TEST_F()
567 kmen.AuthorizeOperation(KM_PURPOSE_VERIFY, key_id, auth_set, op_params, in TEST_F()
590 kmen.AuthorizeOperation(KM_PURPOSE_SIGN, key_id, auth_set, op_params, in TEST_F()
614 kmen.AuthorizeOperation(KM_PURPOSE_SIGN, key_id, auth_set, op_params, token.challenge, in TEST_F()
618 kmen.AuthorizeOperation(KM_PURPOSE_VERIFY, key_id, auth_set, op_params, in TEST_F()
643 kmen.AuthorizeOperation(KM_PURPOSE_SIGN, key_id, auth_set, op_params, token.challenge, in TEST_F()
647 kmen.AuthorizeOperation(KM_PURPOSE_VERIFY, key_id, auth_set, op_params, in TEST_F()
672 kmen.AuthorizeOperation(KM_PURPOSE_SIGN, key_id, auth_set, op_params, token.challenge, in TEST_F()
676 kmen.AuthorizeOperation(KM_PURPOSE_VERIFY, key_id, auth_set, op_params, in TEST_F()
699 kmen.AuthorizeOperation(KM_PURPOSE_SIGN, key_id, auth_set, op_params, token.challenge, in TEST_F()
722 EXPECT_EQ(KM_ERROR_OK, kmen.AuthorizeOperation(KM_PURPOSE_SIGN, key_id, auth_set, op_params, in TEST_F()
726 kmen.AuthorizeOperation(KM_PURPOSE_SIGN, key_id, auth_set, op_params, token.challenge, in TEST_F()
730 kmen.AuthorizeOperation(KM_PURPOSE_VERIFY, key_id, auth_set, op_params, in TEST_F()
741 kmen.AuthorizeOperation(KM_PURPOSE_VERIFY, key_id, auth_set, op_params, in TEST_F()
752 kmen.AuthorizeOperation(KM_PURPOSE_SIGN, key_id, auth_set)); in TEST_F()
763 token.timestamp = hton(kmen.current_time()); in TEST_F()
776 kmen.AuthorizeOperation(KM_PURPOSE_SIGN, key_id, auth_set, op_params, in TEST_F()
788 token.timestamp = hton(static_cast<uint64_t>(kmen.current_time())); in TEST_F()
801 kmen.AuthorizeOperation(KM_PURPOSE_SIGN, key_id, auth_set, op_params, in TEST_F()
804 kmen.tick(1); in TEST_F()
808 kmen.AuthorizeOperation(KM_PURPOSE_SIGN, key_id, auth_set, op_params, in TEST_F()
811 kmen.tick(1); in TEST_F()
815 kmen.AuthorizeOperation(KM_PURPOSE_SIGN, key_id, auth_set, op_params, in TEST_F()
820 kmen.AuthorizeOperation(KM_PURPOSE_SIGN, key_id, auth_set, op_params, in TEST_F()
825 kmen.AuthorizeOperation(KM_PURPOSE_VERIFY, key_id, auth_set, op_params, in TEST_F()
837 token.timestamp = hton(static_cast<uint64_t>(kmen.current_time())); in TEST_F()
850 kmen.AuthorizeOperation(KM_PURPOSE_SIGN, key_id, auth_set, op_params, token.challenge, in TEST_F()
855 kmen.AuthorizeOperation(KM_PURPOSE_SIGN, key_id, auth_set, op_params, token.challenge, in TEST_F()
859 EXPECT_EQ(KM_ERROR_OK, kmen.AuthorizeOperation(KM_PURPOSE_VERIFY, key_id, auth_set, op_params, in TEST_F()