• Home
  • Raw
  • Download

Lines Matching refs:db

878         let mut db = Self { conn, gc, perboot: perboot::PERBOOT_DB.clone() };  in new()  localVariable
879 db.with_transaction(TransactionBehavior::Immediate, |tx| { in new()
884 Ok(db) in new()
3298 let mut db = KeystoreDB { conn, gc: None, perboot: Arc::new(perboot::PerbootDB::new()) }; in new_test_db() localVariable
3299 db.with_transaction(TransactionBehavior::Immediate, |tx| { in new_test_db()
3302 Ok(db) in new_test_db()
3318 db: &mut KeystoreDB, in rebind_alias()
3324 db.with_transaction(TransactionBehavior::Immediate, |tx| { in rebind_alias()
3371 let db = new_test_db()?; in test_tables() localVariable
3372 let tables = db in test_tables()
3389 let mut db = new_test_db()?; in test_auth_token_table_invariant() localVariable
3398 db.insert_auth_token(&auth_token1); in test_auth_token_table_invariant()
3399 let auth_tokens_returned = get_auth_tokens(&db); in test_auth_token_table_invariant()
3413 db.insert_auth_token(&auth_token2); in test_auth_token_table_invariant()
3414 let mut auth_tokens_returned = get_auth_tokens(&db); in test_auth_token_table_invariant()
3432 db.insert_auth_token(&auth_token3); in test_auth_token_table_invariant()
3433 let auth_tokens_returned = get_auth_tokens(&db); in test_auth_token_table_invariant()
3440 fn get_auth_tokens(db: &KeystoreDB) -> Vec<AuthTokenEntry> { in get_auth_tokens()
3441 db.perboot.get_all_auth_token_entries() in get_auth_tokens()
3447 let mut db = KeystoreDB::new(temp_dir.path(), None)?; in test_persistence_for_files() localVariable
3449 db.create_key_entry(&Domain::APP, &100, KeyType::Client, &KEYSTORE_UUID)?; in test_persistence_for_files()
3450 let entries = get_keyentry(&db)?; in test_persistence_for_files()
3453 let db = KeystoreDB::new(temp_dir.path(), None)?; in test_persistence_for_files() localVariable
3455 let entries_new = get_keyentry(&db)?; in test_persistence_for_files()
3466 let mut db = new_test_db()?; in test_create_key_entry() localVariable
3468 db.create_key_entry(&Domain::APP, &100, KeyType::Client, &KEYSTORE_UUID)?; in test_create_key_entry()
3469 db.create_key_entry(&Domain::SELINUX, &101, KeyType::Client, &KEYSTORE_UUID)?; in test_create_key_entry()
3471 let entries = get_keyentry(&db)?; in test_create_key_entry()
3478 db.create_key_entry(&Domain::GRANT, &102, KeyType::Client, &KEYSTORE_UUID), in test_create_key_entry()
3482 db.create_key_entry(&Domain::BLOB, &103, KeyType::Client, &KEYSTORE_UUID), in test_create_key_entry()
3486 db.create_key_entry(&Domain::KEY_ID, &104, KeyType::Client, &KEYSTORE_UUID), in test_create_key_entry()
3495 let mut db = new_test_db()?; in test_add_unsigned_key() localVariable
3499 db.create_attestation_key_entry( in test_add_unsigned_key()
3505 let keys = db.fetch_unsigned_attestation_keys(5, &KEYSTORE_UUID)?; in test_add_unsigned_key()
3513 let mut db = new_test_db()?; in test_store_signed_attestation_certificate_chain() localVariable
3521 load_attestation_key_pool(&mut db, expiration_date, namespace, base_byte)?; in test_store_signed_attestation_certificate_chain()
3523 db.retrieve_attestation_key_and_cert_chain(Domain::APP, namespace, &KEYSTORE_UUID)?; in test_store_signed_attestation_certificate_chain()
3536 let mut db = new_test_db_with_gc(temp_dir.path(), |_, _| Ok(()))?; in test_remove_expired_certs() localVariable
3545 &mut db, in test_remove_expired_certs()
3550 load_attestation_key_pool(&mut db, 45, namespace_del1, 0x02)?; in test_remove_expired_certs()
3551 load_attestation_key_pool(&mut db, expiration_date - 10001, namespace_del2, 0x03)?; in test_remove_expired_certs()
3553 let blob_entry_row_count: u32 = db in test_remove_expired_certs()
3561 assert_eq!(db.delete_expired_attestation_keys()?, 2); in test_remove_expired_certs()
3564 db.retrieve_attestation_key_and_cert_chain(Domain::APP, namespace, &KEYSTORE_UUID)?; in test_remove_expired_certs()
3571 cert_chain = db.retrieve_attestation_key_and_cert_chain( in test_remove_expired_certs()
3577 cert_chain = db.retrieve_attestation_key_and_cert_chain( in test_remove_expired_certs()
3587 let blob_entry_row_count: u32 = db in test_remove_expired_certs()
3613 let mut db = new_test_db_with_gc(temp_dir.path(), |_, _| Ok(()))?; in test_dont_remove_valid_certs() localVariable
3622 &mut db, in test_dont_remove_valid_certs()
3628 load_attestation_key_pool(&mut db, expiration_date + 40000, namespace2, 0x02)?; in test_dont_remove_valid_certs()
3630 load_attestation_key_pool(&mut db, expiration_date - 9000, namespace3, 0x03)?; in test_dont_remove_valid_certs()
3632 let blob_entry_row_count: u32 = db in test_dont_remove_valid_certs()
3641 db.retrieve_attestation_key_and_cert_chain(Domain::APP, namespace1, &KEYSTORE_UUID)?; in test_dont_remove_valid_certs()
3645 db.retrieve_attestation_key_and_cert_chain(Domain::APP, namespace2, &KEYSTORE_UUID)?; in test_dont_remove_valid_certs()
3649 db.retrieve_attestation_key_and_cert_chain(Domain::APP, namespace3, &KEYSTORE_UUID)?; in test_dont_remove_valid_certs()
3655 let blob_entry_row_count: u32 = db in test_dont_remove_valid_certs()
3667 let mut db = new_test_db()?; in test_delete_all_attestation_keys() localVariable
3668 load_attestation_key_pool(&mut db, 45 /* expiration */, 1 /* namespace */, 0x02)?; in test_delete_all_attestation_keys()
3669 load_attestation_key_pool(&mut db, 80 /* expiration */, 2 /* namespace */, 0x03)?; in test_delete_all_attestation_keys()
3670 db.create_key_entry(&Domain::APP, &42, KeyType::Client, &KEYSTORE_UUID)?; in test_delete_all_attestation_keys()
3671 let result = db.delete_all_attestation_keys()?; in test_delete_all_attestation_keys()
3690 let mut db = new_test_db()?; in test_rebind_alias() localVariable
3691 db.create_key_entry(&Domain::APP, &42, KeyType::Client, &KEYSTORE_UUID)?; in test_rebind_alias()
3692 db.create_key_entry(&Domain::APP, &42, KeyType::Client, &KEYSTORE_UUID)?; in test_rebind_alias()
3693 let entries = get_keyentry(&db)?; in test_rebind_alias()
3705 rebind_alias(&mut db, &KEY_ID_LOCK.get(entries[0].id), "foo", Domain::APP, 42)?; in test_rebind_alias()
3706 let entries = get_keyentry(&db)?; in test_rebind_alias()
3718 rebind_alias(&mut db, &KEY_ID_LOCK.get(entries[1].id), "foo", Domain::APP, 42)?; in test_rebind_alias()
3719 let entries = get_keyentry(&db)?; in test_rebind_alias()
3729 rebind_alias(&mut db, &KEY_ID_LOCK.get(0), "foo", Domain::GRANT, 42), in test_rebind_alias()
3733 rebind_alias(&mut db, &KEY_ID_LOCK.get(0), "foo", Domain::BLOB, 42), in test_rebind_alias()
3737 rebind_alias(&mut db, &KEY_ID_LOCK.get(0), "foo", Domain::KEY_ID, 42), in test_rebind_alias()
3743 rebind_alias(&mut db, &KEY_ID_LOCK.get(0), "foo", Domain::SELINUX, 42), in test_rebind_alias()
3747 let entries = get_keyentry(&db)?; in test_rebind_alias()
3764 let mut db = new_test_db()?; in test_grant_ungrant() localVariable
3765 db.conn.execute( in test_grant_ungrant()
3784 let app_granted_key = db in test_grant_ungrant()
3819 let selinux_granted_key = db in test_grant_ungrant()
3849 let selinux_granted_key = db in test_grant_ungrant()
3880 let mut stmt = db in test_grant_ungrant()
3900 debug_dump_keyentry_table(&mut db)?; in test_grant_ungrant()
3904 db.ungrant(&app_key, CALLER_UID, GRANTEE_UID, |_| Ok(()))?; in test_grant_ungrant()
3905 db.ungrant(&selinux_key, CALLER_UID, GRANTEE_UID, |_| Ok(()))?; in test_grant_ungrant()
3917 let mut db = new_test_db()?; in test_set_blob() localVariable
3920 db.set_blob( in test_set_blob()
3926 db.set_blob(&key_id, SubComponentType::CERT, Some(TEST_CERT_BLOB), None)?; in test_set_blob()
3927 db.set_blob(&key_id, SubComponentType::CERT_CHAIN, Some(TEST_CERT_CHAIN_BLOB), None)?; in test_set_blob()
3930 let mut stmt = db.conn.prepare( in test_set_blob()
3949 db.with_transaction(TransactionBehavior::Immediate, |tx| { in test_set_blob()
3962 let mut db = new_test_db()?; in test_insert_and_load_full_keyentry_domain_app() localVariable
3963 let key_id = make_test_key_entry(&mut db, Domain::APP, 1, TEST_ALIAS, None) in test_insert_and_load_full_keyentry_domain_app()
3966 let (_key_guard, key_entry) = db in test_insert_and_load_full_keyentry_domain_app()
3982 db.unbind_key( in test_insert_and_load_full_keyentry_domain_app()
3997 db.load_key_entry( in test_insert_and_load_full_keyentry_domain_app()
4019 let mut db = new_test_db()?; in test_insert_and_load_certificate_entry_domain_app() localVariable
4021 db.store_new_certificate( in test_insert_and_load_certificate_entry_domain_app()
4034 let (_key_guard, mut key_entry) = db in test_insert_and_load_certificate_entry_domain_app()
4053 db.unbind_key( in test_insert_and_load_certificate_entry_domain_app()
4068 db.load_key_entry( in test_insert_and_load_certificate_entry_domain_app()
4090 let mut db = new_test_db()?; in test_insert_and_load_full_keyentry_domain_selinux() localVariable
4091 let key_id = make_test_key_entry(&mut db, Domain::SELINUX, 1, TEST_ALIAS, None) in test_insert_and_load_full_keyentry_domain_selinux()
4094 let (_key_guard, key_entry) = db in test_insert_and_load_full_keyentry_domain_selinux()
4110 db.unbind_key( in test_insert_and_load_full_keyentry_domain_selinux()
4125 db.load_key_entry( in test_insert_and_load_full_keyentry_domain_selinux()
4147 let mut db = new_test_db()?; in test_insert_and_load_full_keyentry_domain_key_id() localVariable
4148 let key_id = make_test_key_entry(&mut db, Domain::SELINUX, 1, TEST_ALIAS, None) in test_insert_and_load_full_keyentry_domain_key_id()
4151 let (_, key_entry) = db in test_insert_and_load_full_keyentry_domain_key_id()
4163 db.unbind_key( in test_insert_and_load_full_keyentry_domain_key_id()
4173 db.load_key_entry( in test_insert_and_load_full_keyentry_domain_key_id()
4190 let mut db = new_test_db()?; in test_check_and_update_key_usage_count_with_limited_use_key() localVariable
4191 let key_id = make_test_key_entry(&mut db, Domain::SELINUX, 1, TEST_ALIAS, Some(123)) in test_check_and_update_key_usage_count_with_limited_use_key()
4195 db.check_and_update_key_usage_count(key_id)?; in test_check_and_update_key_usage_count_with_limited_use_key()
4197 let (_key_guard, key_entry) = db.load_key_entry( in test_check_and_update_key_usage_count_with_limited_use_key()
4213 let mut db = new_test_db()?; in test_check_and_update_key_usage_count_with_exhausted_limited_use_key() localVariable
4214 let key_id = make_test_key_entry(&mut db, Domain::SELINUX, 1, TEST_ALIAS, Some(1)) in test_check_and_update_key_usage_count_with_exhausted_limited_use_key()
4218 db.check_and_update_key_usage_count(key_id).expect(concat!( in test_check_and_update_key_usage_count_with_exhausted_limited_use_key()
4224 let e = db.check_and_update_key_usage_count(key_id).expect_err(concat!( in test_check_and_update_key_usage_count_with_exhausted_limited_use_key()
4238 let mut db = new_test_db()?; in test_insert_and_load_full_keyentry_from_grant() localVariable
4239 let key_id = make_test_key_entry(&mut db, Domain::APP, 1, TEST_ALIAS, None) in test_insert_and_load_full_keyentry_from_grant()
4243 let granted_key = db in test_insert_and_load_full_keyentry_from_grant()
4258 debug_dump_grant_table(&mut db)?; in test_insert_and_load_full_keyentry_from_grant()
4260 let (_key_guard, key_entry) = db in test_insert_and_load_full_keyentry_from_grant()
4270 db.unbind_key(&granted_key, KeyType::Client, 2, |_, _| Ok(())).unwrap(); in test_insert_and_load_full_keyentry_from_grant()
4274 db.load_key_entry( in test_insert_and_load_full_keyentry_from_grant()
4293 let mut db = new_test_db()?; in test_insert_and_load_full_keyentry_from_grant_by_key_id() localVariable
4297 let key_id = make_test_key_entry(&mut db, Domain::APP, OWNER_UID as i64, TEST_ALIAS, None) in test_insert_and_load_full_keyentry_from_grant_by_key_id()
4301 db.grant( in test_insert_and_load_full_keyentry_from_grant_by_key_id()
4315 debug_dump_grant_table(&mut db)?; in test_insert_and_load_full_keyentry_from_grant_by_key_id()
4320 let (_, key_entry) = db in test_insert_and_load_full_keyentry_from_grant_by_key_id()
4337 let (_, key_entry) = db in test_insert_and_load_full_keyentry_from_grant_by_key_id()
4354 db.unbind_key(&id_descriptor, KeyType::Client, OWNER_UID, |_, _| Ok(())).unwrap(); in test_insert_and_load_full_keyentry_from_grant_by_key_id()
4358 db.load_key_entry( in test_insert_and_load_full_keyentry_from_grant_by_key_id()
4377 let mut db = new_test_db()?; in test_migrate_key_app_to_app() localVariable
4383 make_test_key_entry(&mut db, Domain::APP, SOURCE_UID as i64, SOURCE_ALIAS, None) in test_migrate_key_app_to_app()
4402 db.migrate_key_namespace(key_id_guard, &destination_descriptor, DESTINATION_UID, |_k| { in test_migrate_key_app_to_app()
4407 let (_, key_entry) = db in test_migrate_key_app_to_app()
4426 db.load_key_entry( in test_migrate_key_app_to_app()
4445 let mut db = new_test_db()?; in test_migrate_key_app_to_selinux() localVariable
4452 make_test_key_entry(&mut db, Domain::APP, SOURCE_UID as i64, SOURCE_ALIAS, None) in test_migrate_key_app_to_selinux()
4471 db.migrate_key_namespace(key_id_guard, &destination_descriptor, DESTINATION_UID, |_k| { in test_migrate_key_app_to_selinux()
4476 let (_, key_entry) = db in test_migrate_key_app_to_selinux()
4495 db.load_key_entry( in test_migrate_key_app_to_selinux()
4514 let mut db = new_test_db()?; in test_migrate_key_destination_occupied() localVariable
4520 make_test_key_entry(&mut db, Domain::APP, SOURCE_UID as i64, SOURCE_ALIAS, None) in test_migrate_key_destination_occupied()
4522 make_test_key_entry(&mut db, Domain::APP, DESTINATION_UID as i64, DESTINATION_ALIAS, None) in test_migrate_key_destination_occupied()
4534 db.migrate_key_namespace( in test_migrate_key_destination_occupied()
4555 let mut db = KeystoreDB::new(temp_dir.path(), None).unwrap(); in test_upgrade_0_to_1() localVariable
4557 make_test_key_entry(&mut db, Domain::APP, UID as i64, ALIAS1, None).unwrap().id(); in test_upgrade_0_to_1()
4559 make_bootlevel_key_entry(&mut db, Domain::APP, UID as i64, ALIAS2, false).unwrap().id(); in test_upgrade_0_to_1()
4561 make_bootlevel_key_entry(&mut db, Domain::APP, UID as i64, ALIAS3, true).unwrap().id(); in test_upgrade_0_to_1()
4563 let (_, key_entry) = db in test_upgrade_0_to_1()
4583 let (_, key_entry) = db in test_upgrade_0_to_1()
4603 let (_, key_entry) = db in test_upgrade_0_to_1()
4624 db.with_transaction(TransactionBehavior::Immediate, |tx| { in test_upgrade_0_to_1()
4629 let (_, key_entry) = db in test_upgrade_0_to_1()
4649 let (_, key_entry) = db in test_upgrade_0_to_1()
4671 db.load_key_entry( in test_upgrade_0_to_1()
4701 let mut db = KeystoreDB::new(temp_dir.path(), None)?; in test_insert_and_load_full_keyentry_domain_app_concurrently() localVariable
4702 let key_id = make_test_key_entry(&mut db, Domain::APP, 33, KEY_LOCK_TEST_ALIAS, None) in test_insert_and_load_full_keyentry_domain_app_concurrently()
4705 let (_key_guard, key_entry) = db in test_insert_and_load_full_keyentry_domain_app_concurrently()
4732 let mut db = KeystoreDB::new(temp_dir.path(), None).unwrap(); in test_insert_and_load_full_keyentry_domain_app_concurrently() localVariable
4733 assert!(db in test_insert_and_load_full_keyentry_domain_app_concurrently()
4813 let mut db = in test_large_number_of_concurrent_db_manipulations() localVariable
4825 make_test_key_entry(&mut db, Domain::APP, 1, &alias, None) in test_large_number_of_concurrent_db_manipulations()
4832 let mut db = new_test_db_with_gc(temp_dir1.path(), |_, _| Ok(())) in test_large_number_of_concurrent_db_manipulations() localVariable
4840 make_test_key_entry(&mut db, Domain::APP, 2, &alias, None) in test_large_number_of_concurrent_db_manipulations()
4855 db.unbind_key(&key, KeyType::Client, 2, |_, _| Ok(())).expect("Unbind Failed."); in test_large_number_of_concurrent_db_manipulations()
4862 let mut db = new_test_db_with_gc(temp_dir2.path(), |_, _| Ok(())) in test_large_number_of_concurrent_db_manipulations() localVariable
4875 db.unbind_key(&key, KeyType::Client, 1, |_, _| Ok(())).expect("Unbind Failed."); in test_large_number_of_concurrent_db_manipulations()
4890 let mut db = new_test_db_with_gc(temp_dir4.path(), |_, _| Ok(())) in test_large_number_of_concurrent_db_manipulations() localVariable
4894 make_test_key_entry(&mut db, Domain::APP, 3, &alias, None) in test_large_number_of_concurrent_db_manipulations()
4902 db.unbind_key(&key, KeyType::Client, 3, |_, _| Ok(())).expect("Unbind Failed."); in test_large_number_of_concurrent_db_manipulations()
4916 let mut db = KeystoreDB::new(temp_dir.path(), None)?; in list() localVariable
4945 make_test_key_entry(&mut db, *domain, *ns, alias, None).unwrap_or_else(|e| { in list()
4968 let mut list_result = db.list_past_alias(*domain, *namespace, KeyType::Client, None)?; in list()
4975 let (_, entry) = db in list()
5000 db.list_past_alias(Domain::SELINUX, 101, KeyType::Client, None)? in list()
5033 fn get_keyentry(db: &KeystoreDB) -> Result<Vec<KeyEntryRow>> { in get_keyentry()
5034 db.conn in get_keyentry()
5058 db: &mut KeystoreDB, in load_attestation_key_pool()
5068 db.create_attestation_key_entry(&public_key, &raw_public_key, &priv_key, &KEYSTORE_UUID)?; in load_attestation_key_pool()
5069 db.store_signed_attestation_certificate_chain( in load_attestation_key_pool()
5076 db.assign_attestation_key(Domain::APP, namespace, &KEYSTORE_UUID)?; in load_attestation_key_pool()
5314 db: &mut KeystoreDB, in make_test_key_entry()
5320 let key_id = db.create_key_entry(&domain, &namespace, KeyType::Client, &KEYSTORE_UUID)?; in make_test_key_entry()
5328 db.set_blob( in make_test_key_entry()
5334 db.set_blob(&key_id, SubComponentType::CERT, Some(TEST_CERT_BLOB), None)?; in make_test_key_entry()
5335 db.set_blob(&key_id, SubComponentType::CERT_CHAIN, Some(TEST_CERT_CHAIN_BLOB), None)?; in make_test_key_entry()
5338 db.insert_keyparameter(&key_id, &params)?; in make_test_key_entry()
5342 db.insert_key_metadata(&key_id, &metadata)?; in make_test_key_entry()
5343 rebind_alias(db, &key_id, alias, domain, namespace)?; in make_test_key_entry()
5373 db: &mut KeystoreDB, in make_bootlevel_key_entry()
5379 let key_id = db.create_key_entry(&domain, &namespace, KeyType::Client, &KEYSTORE_UUID)?; in make_bootlevel_key_entry()
5386 db.set_blob( in make_bootlevel_key_entry()
5392 db.set_blob(&key_id, SubComponentType::CERT, Some(TEST_CERT_BLOB), None)?; in make_bootlevel_key_entry()
5393 db.set_blob(&key_id, SubComponentType::CERT_CHAIN, Some(TEST_CERT_CHAIN_BLOB), None)?; in make_bootlevel_key_entry()
5398 db.insert_keyparameter(&key_id, &params)?; in make_bootlevel_key_entry()
5402 db.insert_key_metadata(&key_id, &metadata)?; in make_bootlevel_key_entry()
5403 rebind_alias(db, &key_id, alias, domain, namespace)?; in make_bootlevel_key_entry()
5432 fn debug_dump_keyentry_table(db: &mut KeystoreDB) -> Result<()> { in debug_dump_keyentry_table()
5433 let mut stmt = db.conn.prepare( in debug_dump_keyentry_table()
5462 fn debug_dump_grant_table(db: &mut KeystoreDB) -> Result<()> { in debug_dump_grant_table()
5463 let mut stmt = db in debug_dump_grant_table()
5501 let mut db = new_test_db()?; in test_last_off_body() localVariable
5502 db.insert_last_off_body(MonotonicRawTime::now()); in test_last_off_body()
5503 let tx = db.conn.transaction_with_behavior(TransactionBehavior::Immediate)?; in test_last_off_body()
5505 let last_off_body_1 = db.get_last_off_body(); in test_last_off_body()
5508 db.update_last_off_body(MonotonicRawTime::now()); in test_last_off_body()
5509 let tx2 = db.conn.transaction_with_behavior(TransactionBehavior::Immediate)?; in test_last_off_body()
5511 let last_off_body_2 = db.get_last_off_body(); in test_last_off_body()
5518 let mut db = new_test_db()?; in test_unbind_keys_for_user() localVariable
5519 db.unbind_keys_for_user(1, false)?; in test_unbind_keys_for_user()
5521 make_test_key_entry(&mut db, Domain::APP, 210000, TEST_ALIAS, None)?; in test_unbind_keys_for_user()
5522 make_test_key_entry(&mut db, Domain::APP, 110000, TEST_ALIAS, None)?; in test_unbind_keys_for_user()
5523 db.unbind_keys_for_user(2, false)?; in test_unbind_keys_for_user()
5525 assert_eq!(1, db.list_past_alias(Domain::APP, 110000, KeyType::Client, None)?.len()); in test_unbind_keys_for_user()
5526 assert_eq!(0, db.list_past_alias(Domain::APP, 210000, KeyType::Client, None)?.len()); in test_unbind_keys_for_user()
5528 db.unbind_keys_for_user(1, true)?; in test_unbind_keys_for_user()
5529 assert_eq!(0, db.list_past_alias(Domain::APP, 110000, KeyType::Client, None)?.len()); in test_unbind_keys_for_user()
5536 let mut db = new_test_db()?; in test_unbind_keys_for_user_removes_superkeys() localVariable
5553 db.store_super_key( in test_unbind_keys_for_user_removes_superkeys()
5560 db.store_super_key(1, &key_name_enc, &encrypted_super_key, &metadata, &KeyMetaData::new())?; in test_unbind_keys_for_user_removes_superkeys()
5563 assert!(db.load_super_key(&key_name_enc, 1)?.is_some()); in test_unbind_keys_for_user_removes_superkeys()
5564 assert!(db.load_super_key(&key_name_nonenc, 1)?.is_some()); in test_unbind_keys_for_user_removes_superkeys()
5567 db.store_super_key( in test_unbind_keys_for_user_removes_superkeys()
5574 db.store_super_key(2, &key_name_enc, &encrypted_super_key, &metadata, &KeyMetaData::new())?; in test_unbind_keys_for_user_removes_superkeys()
5577 assert!(db.load_super_key(&key_name_enc, 2)?.is_some()); in test_unbind_keys_for_user_removes_superkeys()
5578 assert!(db.load_super_key(&key_name_nonenc, 2)?.is_some()); in test_unbind_keys_for_user_removes_superkeys()
5581 db.unbind_keys_for_user(1, true)?; in test_unbind_keys_for_user_removes_superkeys()
5584 assert!(db.load_super_key(&key_name_enc, 1)?.is_none()); in test_unbind_keys_for_user_removes_superkeys()
5585 assert!(db.load_super_key(&key_name_nonenc, 1)?.is_some()); in test_unbind_keys_for_user_removes_superkeys()
5588 db.store_super_key(1, &key_name_enc, &encrypted_super_key, &metadata, &KeyMetaData::new())?; in test_unbind_keys_for_user_removes_superkeys()
5591 assert!(db.load_super_key(&key_name_enc, 1)?.is_some()); in test_unbind_keys_for_user_removes_superkeys()
5592 assert!(db.load_super_key(&key_name_nonenc, 1)?.is_some()); in test_unbind_keys_for_user_removes_superkeys()
5595 db.unbind_keys_for_user(1, false)?; in test_unbind_keys_for_user_removes_superkeys()
5598 assert!(db.load_super_key(&key_name_enc, 1)?.is_none()); in test_unbind_keys_for_user_removes_superkeys()
5599 assert!(db.load_super_key(&key_name_nonenc, 1)?.is_none()); in test_unbind_keys_for_user_removes_superkeys()
5602 assert!(db.load_super_key(&key_name_enc, 2)?.is_some()); in test_unbind_keys_for_user_removes_superkeys()
5603 assert!(db.load_super_key(&key_name_nonenc, 2)?.is_some()); in test_unbind_keys_for_user_removes_superkeys()
5610 let mut db = new_test_db()?; in test_store_super_key() localVariable
5619 db.store_super_key( in test_store_super_key()
5628 assert!(db.key_exists(Domain::APP, 1, USER_SUPER_KEY.alias, KeyType::Super)?); in test_store_super_key()
5630 let (_, key_entry) = db.load_super_key(&USER_SUPER_KEY, 1)?.unwrap(); in test_store_super_key()
5668 let mut db = new_test_db()?; in test_query_all_valid_table_sizes() localVariable
5671 let stat = db.get_storage_stat(t)?; in test_query_all_valid_table_sizes()
5684 fn get_storage_stats_map(db: &mut KeystoreDB) -> BTreeMap<i32, StorageStats> { in get_storage_stats_map()
5687 .map(|t| (t.0, db.get_storage_stat(t).unwrap())) in get_storage_stats_map()
5692 db: &mut KeystoreDB, in assert_storage_increased()
5698 let new = db.get_storage_stat(storage).unwrap(); in assert_storage_increased()
5716 let updated_stats = get_storage_stats_map(db); in assert_storage_increased()
5741 let mut db = new_test_db()?; in test_verify_key_table_size_reporting() localVariable
5742 let mut working_stats = get_storage_stats_map(&mut db); in test_verify_key_table_size_reporting()
5744 let key_id = db.create_key_entry(&Domain::APP, &42, KeyType::Client, &KEYSTORE_UUID)?; in test_verify_key_table_size_reporting()
5746 &mut db, in test_verify_key_table_size_reporting()
5757 db.set_blob(&key_id, SubComponentType::KEY_BLOB, Some(TEST_KEY_BLOB), None)?; in test_verify_key_table_size_reporting()
5759 &mut db, in test_verify_key_table_size_reporting()
5770 db.insert_keyparameter(&key_id, &params)?; in test_verify_key_table_size_reporting()
5772 &mut db, in test_verify_key_table_size_reporting()
5779 db.insert_key_metadata(&key_id, &metadata)?; in test_verify_key_table_size_reporting()
5781 &mut db, in test_verify_key_table_size_reporting()
5790 let total = db.get_storage_stat(MetricsStorage::DATABASE)?.size; in test_verify_key_table_size_reporting()
5798 let mut db = new_test_db()?; in test_verify_auth_table_size_reporting() localVariable
5799 let mut working_stats = get_storage_stats_map(&mut db); in test_verify_auth_table_size_reporting()
5800 db.insert_auth_token(&HardwareAuthToken { in test_verify_auth_table_size_reporting()
5808 assert_storage_increased(&mut db, vec![MetricsStorage::AUTH_TOKEN], &mut working_stats); in test_verify_auth_table_size_reporting()
5815 let mut db = new_test_db()?; in test_verify_grant_table_size_reporting() localVariable
5816 make_test_key_entry(&mut db, Domain::APP, OWNER, TEST_ALIAS, None)?; in test_verify_grant_table_size_reporting()
5818 let mut working_stats = get_storage_stats_map(&mut db); in test_verify_grant_table_size_reporting()
5819 db.grant( in test_verify_grant_table_size_reporting()
5832 assert_storage_increased(&mut db, vec![MetricsStorage::GRANT], &mut working_stats); in test_verify_grant_table_size_reporting()
5839 let mut db = new_test_db()?; in find_auth_token_entry_returns_latest() localVariable
5840 db.insert_auth_token(&HardwareAuthToken { in find_auth_token_entry_returns_latest()
5849 db.insert_auth_token(&HardwareAuthToken { in find_auth_token_entry_returns_latest()
5858 db.insert_auth_token(&HardwareAuthToken { in find_auth_token_entry_returns_latest()
5867 assert_eq!(db.perboot.auth_tokens_len(), 3); in find_auth_token_entry_returns_latest()
5869 assert_eq!(db.find_auth_token_entry(|_| true).unwrap().0.auth_token.mac, b"mac2".to_vec()); in find_auth_token_entry_returns_latest()
5875 let mut db = new_test_db()?; in test_load_key_descriptor() localVariable
5876 let key_id = make_test_key_entry(&mut db, Domain::APP, 1, TEST_ALIAS, None)?.0; in test_load_key_descriptor()
5878 let key = db.load_key_descriptor(key_id)?.unwrap(); in test_load_key_descriptor()
5885 assert_eq!(db.load_key_descriptor(key_id + 1)?, None); in test_load_key_descriptor()