Lines Matching refs:db
848 let mut db = Self { conn, gc, perboot: perboot::PERBOOT_DB.clone() }; in new() localVariable
849 db.with_transaction(TransactionBehavior::Immediate, |tx| { in new()
854 Ok(db) in new()
3246 let mut db = KeystoreDB { conn, gc: None, perboot: Arc::new(perboot::PerbootDB::new()) }; in new_test_db() localVariable
3247 db.with_transaction(TransactionBehavior::Immediate, |tx| { in new_test_db()
3250 Ok(db) in new_test_db()
3266 db: &mut KeystoreDB, in rebind_alias()
3272 db.with_transaction(TransactionBehavior::Immediate, |tx| { in rebind_alias()
3319 let db = new_test_db()?; in test_tables() localVariable
3320 let tables = db in test_tables()
3337 let mut db = new_test_db()?; in test_auth_token_table_invariant() localVariable
3346 db.insert_auth_token(&auth_token1); in test_auth_token_table_invariant()
3347 let auth_tokens_returned = get_auth_tokens(&db); in test_auth_token_table_invariant()
3361 db.insert_auth_token(&auth_token2); in test_auth_token_table_invariant()
3362 let mut auth_tokens_returned = get_auth_tokens(&db); in test_auth_token_table_invariant()
3380 db.insert_auth_token(&auth_token3); in test_auth_token_table_invariant()
3381 let auth_tokens_returned = get_auth_tokens(&db); in test_auth_token_table_invariant()
3388 fn get_auth_tokens(db: &KeystoreDB) -> Vec<AuthTokenEntry> { in get_auth_tokens()
3389 db.perboot.get_all_auth_token_entries() in get_auth_tokens()
3395 let mut db = KeystoreDB::new(temp_dir.path(), None)?; in test_persistence_for_files() localVariable
3397 db.create_key_entry(&Domain::APP, &100, KeyType::Client, &KEYSTORE_UUID)?; in test_persistence_for_files()
3398 let entries = get_keyentry(&db)?; in test_persistence_for_files()
3401 let db = KeystoreDB::new(temp_dir.path(), None)?; in test_persistence_for_files() localVariable
3403 let entries_new = get_keyentry(&db)?; in test_persistence_for_files()
3414 let mut db = new_test_db()?; in test_create_key_entry() localVariable
3416 db.create_key_entry(&Domain::APP, &100, KeyType::Client, &KEYSTORE_UUID)?; in test_create_key_entry()
3417 db.create_key_entry(&Domain::SELINUX, &101, KeyType::Client, &KEYSTORE_UUID)?; in test_create_key_entry()
3419 let entries = get_keyentry(&db)?; in test_create_key_entry()
3426 db.create_key_entry(&Domain::GRANT, &102, KeyType::Client, &KEYSTORE_UUID), in test_create_key_entry()
3430 db.create_key_entry(&Domain::BLOB, &103, KeyType::Client, &KEYSTORE_UUID), in test_create_key_entry()
3434 db.create_key_entry(&Domain::KEY_ID, &104, KeyType::Client, &KEYSTORE_UUID), in test_create_key_entry()
3443 let mut db = new_test_db()?; in test_add_unsigned_key() localVariable
3447 db.create_attestation_key_entry( in test_add_unsigned_key()
3453 let keys = db.fetch_unsigned_attestation_keys(5, &KEYSTORE_UUID)?; in test_add_unsigned_key()
3461 let mut db = new_test_db()?; in test_store_signed_attestation_certificate_chain() localVariable
3466 load_attestation_key_pool(&mut db, expiration_date, namespace, base_byte)?; in test_store_signed_attestation_certificate_chain()
3468 db.retrieve_attestation_key_and_cert_chain(Domain::APP, namespace, &KEYSTORE_UUID)?; in test_store_signed_attestation_certificate_chain()
3479 let mut db = new_test_db()?; in test_get_attestation_pool_status() localVariable
3482 &mut db, 10, /* expiration */ in test_get_attestation_pool_status()
3485 load_attestation_key_pool(&mut db, 20 /* expiration */, namespace + 1, 0x02)?; in test_get_attestation_pool_status()
3486 load_attestation_key_pool(&mut db, 40 /* expiration */, namespace + 2, 0x03)?; in test_get_attestation_pool_status()
3487 let mut status = db.get_attestation_pool_status(9 /* expiration */, &KEYSTORE_UUID)?; in test_get_attestation_pool_status()
3493 db.get_attestation_pool_status(15 /* expiration */, &KEYSTORE_UUID)?.expiring, in test_get_attestation_pool_status()
3497 db.get_attestation_pool_status(25 /* expiration */, &KEYSTORE_UUID)?.expiring, in test_get_attestation_pool_status()
3501 db.get_attestation_pool_status(60 /* expiration */, &KEYSTORE_UUID)?.expiring, in test_get_attestation_pool_status()
3509 db.create_attestation_key_entry( in test_get_attestation_pool_status()
3515 status = db.get_attestation_pool_status(0 /* expiration */, &KEYSTORE_UUID)?; in test_get_attestation_pool_status()
3519 db.store_signed_attestation_certificate_chain( in test_get_attestation_pool_status()
3526 status = db.get_attestation_pool_status(0 /* expiration */, &KEYSTORE_UUID)?; in test_get_attestation_pool_status()
3537 let mut db = new_test_db_with_gc(temp_dir.path(), |_, _| Ok(()))?; in test_remove_expired_certs() localVariable
3544 &mut db, in test_remove_expired_certs()
3549 load_attestation_key_pool(&mut db, 45, namespace_del1, 0x02)?; in test_remove_expired_certs()
3550 load_attestation_key_pool(&mut db, 60, namespace_del2, 0x03)?; in test_remove_expired_certs()
3552 let blob_entry_row_count: u32 = db in test_remove_expired_certs()
3560 assert_eq!(db.delete_expired_attestation_keys()?, 2); in test_remove_expired_certs()
3563 db.retrieve_attestation_key_and_cert_chain(Domain::APP, namespace, &KEYSTORE_UUID)?; in test_remove_expired_certs()
3570 cert_chain = db.retrieve_attestation_key_and_cert_chain( in test_remove_expired_certs()
3576 cert_chain = db.retrieve_attestation_key_and_cert_chain( in test_remove_expired_certs()
3586 let blob_entry_row_count: u32 = db in test_remove_expired_certs()
3599 let mut db = new_test_db()?; in test_delete_all_attestation_keys() localVariable
3600 load_attestation_key_pool(&mut db, 45 /* expiration */, 1 /* namespace */, 0x02)?; in test_delete_all_attestation_keys()
3601 load_attestation_key_pool(&mut db, 80 /* expiration */, 2 /* namespace */, 0x03)?; in test_delete_all_attestation_keys()
3602 db.create_key_entry(&Domain::APP, &42, KeyType::Client, &KEYSTORE_UUID)?; in test_delete_all_attestation_keys()
3603 let result = db.delete_all_attestation_keys()?; in test_delete_all_attestation_keys()
3622 let mut db = new_test_db()?; in test_rebind_alias() localVariable
3623 db.create_key_entry(&Domain::APP, &42, KeyType::Client, &KEYSTORE_UUID)?; in test_rebind_alias()
3624 db.create_key_entry(&Domain::APP, &42, KeyType::Client, &KEYSTORE_UUID)?; in test_rebind_alias()
3625 let entries = get_keyentry(&db)?; in test_rebind_alias()
3637 rebind_alias(&mut db, &KEY_ID_LOCK.get(entries[0].id), "foo", Domain::APP, 42)?; in test_rebind_alias()
3638 let entries = get_keyentry(&db)?; in test_rebind_alias()
3650 rebind_alias(&mut db, &KEY_ID_LOCK.get(entries[1].id), "foo", Domain::APP, 42)?; in test_rebind_alias()
3651 let entries = get_keyentry(&db)?; in test_rebind_alias()
3661 rebind_alias(&mut db, &KEY_ID_LOCK.get(0), "foo", Domain::GRANT, 42), in test_rebind_alias()
3665 rebind_alias(&mut db, &KEY_ID_LOCK.get(0), "foo", Domain::BLOB, 42), in test_rebind_alias()
3669 rebind_alias(&mut db, &KEY_ID_LOCK.get(0), "foo", Domain::KEY_ID, 42), in test_rebind_alias()
3675 rebind_alias(&mut db, &KEY_ID_LOCK.get(0), "foo", Domain::SELINUX, 42), in test_rebind_alias()
3679 let entries = get_keyentry(&db)?; in test_rebind_alias()
3696 let mut db = new_test_db()?; in test_grant_ungrant() localVariable
3697 db.conn.execute( in test_grant_ungrant()
3716 let app_granted_key = db in test_grant_ungrant()
3751 let selinux_granted_key = db in test_grant_ungrant()
3781 let selinux_granted_key = db in test_grant_ungrant()
3812 let mut stmt = db in test_grant_ungrant()
3832 debug_dump_keyentry_table(&mut db)?; in test_grant_ungrant()
3836 db.ungrant(&app_key, CALLER_UID, GRANTEE_UID, |_| Ok(()))?; in test_grant_ungrant()
3837 db.ungrant(&selinux_key, CALLER_UID, GRANTEE_UID, |_| Ok(()))?; in test_grant_ungrant()
3849 let mut db = new_test_db()?; in test_set_blob() localVariable
3852 db.set_blob( in test_set_blob()
3858 db.set_blob(&key_id, SubComponentType::CERT, Some(TEST_CERT_BLOB), None)?; in test_set_blob()
3859 db.set_blob(&key_id, SubComponentType::CERT_CHAIN, Some(TEST_CERT_CHAIN_BLOB), None)?; in test_set_blob()
3862 let mut stmt = db.conn.prepare( in test_set_blob()
3881 db.with_transaction(TransactionBehavior::Immediate, |tx| { in test_set_blob()
3894 let mut db = new_test_db()?; in test_insert_and_load_full_keyentry_domain_app() localVariable
3895 let key_id = make_test_key_entry(&mut db, Domain::APP, 1, TEST_ALIAS, None) in test_insert_and_load_full_keyentry_domain_app()
3898 let (_key_guard, key_entry) = db in test_insert_and_load_full_keyentry_domain_app()
3914 db.unbind_key( in test_insert_and_load_full_keyentry_domain_app()
3929 db.load_key_entry( in test_insert_and_load_full_keyentry_domain_app()
3951 let mut db = new_test_db()?; in test_insert_and_load_certificate_entry_domain_app() localVariable
3953 db.store_new_certificate( in test_insert_and_load_certificate_entry_domain_app()
3966 let (_key_guard, mut key_entry) = db in test_insert_and_load_certificate_entry_domain_app()
3985 db.unbind_key( in test_insert_and_load_certificate_entry_domain_app()
4000 db.load_key_entry( in test_insert_and_load_certificate_entry_domain_app()
4022 let mut db = new_test_db()?; in test_insert_and_load_full_keyentry_domain_selinux() localVariable
4023 let key_id = make_test_key_entry(&mut db, Domain::SELINUX, 1, TEST_ALIAS, None) in test_insert_and_load_full_keyentry_domain_selinux()
4026 let (_key_guard, key_entry) = db in test_insert_and_load_full_keyentry_domain_selinux()
4042 db.unbind_key( in test_insert_and_load_full_keyentry_domain_selinux()
4057 db.load_key_entry( in test_insert_and_load_full_keyentry_domain_selinux()
4079 let mut db = new_test_db()?; in test_insert_and_load_full_keyentry_domain_key_id() localVariable
4080 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()
4083 let (_, key_entry) = db in test_insert_and_load_full_keyentry_domain_key_id()
4095 db.unbind_key( in test_insert_and_load_full_keyentry_domain_key_id()
4105 db.load_key_entry( in test_insert_and_load_full_keyentry_domain_key_id()
4122 let mut db = new_test_db()?; in test_check_and_update_key_usage_count_with_limited_use_key() localVariable
4123 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()
4127 db.check_and_update_key_usage_count(key_id)?; in test_check_and_update_key_usage_count_with_limited_use_key()
4129 let (_key_guard, key_entry) = db.load_key_entry( in test_check_and_update_key_usage_count_with_limited_use_key()
4145 let mut db = new_test_db()?; in test_check_and_update_key_usage_count_with_exhausted_limited_use_key() localVariable
4146 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()
4150 db.check_and_update_key_usage_count(key_id).expect(concat!( in test_check_and_update_key_usage_count_with_exhausted_limited_use_key()
4156 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()
4170 let mut db = new_test_db()?; in test_insert_and_load_full_keyentry_from_grant() localVariable
4171 let key_id = make_test_key_entry(&mut db, Domain::APP, 1, TEST_ALIAS, None) in test_insert_and_load_full_keyentry_from_grant()
4175 let granted_key = db in test_insert_and_load_full_keyentry_from_grant()
4190 debug_dump_grant_table(&mut db)?; in test_insert_and_load_full_keyentry_from_grant()
4192 let (_key_guard, key_entry) = db in test_insert_and_load_full_keyentry_from_grant()
4202 db.unbind_key(&granted_key, KeyType::Client, 2, |_, _| Ok(())).unwrap(); in test_insert_and_load_full_keyentry_from_grant()
4206 db.load_key_entry( in test_insert_and_load_full_keyentry_from_grant()
4225 let mut db = new_test_db()?; in test_insert_and_load_full_keyentry_from_grant_by_key_id() localVariable
4229 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()
4233 db.grant( in test_insert_and_load_full_keyentry_from_grant_by_key_id()
4247 debug_dump_grant_table(&mut db)?; in test_insert_and_load_full_keyentry_from_grant_by_key_id()
4252 let (_, key_entry) = db in test_insert_and_load_full_keyentry_from_grant_by_key_id()
4269 let (_, key_entry) = db in test_insert_and_load_full_keyentry_from_grant_by_key_id()
4286 db.unbind_key(&id_descriptor, KeyType::Client, OWNER_UID, |_, _| Ok(())).unwrap(); in test_insert_and_load_full_keyentry_from_grant_by_key_id()
4290 db.load_key_entry( in test_insert_and_load_full_keyentry_from_grant_by_key_id()
4309 let mut db = new_test_db()?; in test_migrate_key_app_to_app() localVariable
4315 make_test_key_entry(&mut db, Domain::APP, SOURCE_UID as i64, SOURCE_ALIAS, None) in test_migrate_key_app_to_app()
4334 db.migrate_key_namespace(key_id_guard, &destination_descriptor, DESTINATION_UID, |_k| { in test_migrate_key_app_to_app()
4339 let (_, key_entry) = db in test_migrate_key_app_to_app()
4358 db.load_key_entry( in test_migrate_key_app_to_app()
4377 let mut db = new_test_db()?; in test_migrate_key_app_to_selinux() localVariable
4384 make_test_key_entry(&mut db, Domain::APP, SOURCE_UID as i64, SOURCE_ALIAS, None) in test_migrate_key_app_to_selinux()
4403 db.migrate_key_namespace(key_id_guard, &destination_descriptor, DESTINATION_UID, |_k| { in test_migrate_key_app_to_selinux()
4408 let (_, key_entry) = db in test_migrate_key_app_to_selinux()
4427 db.load_key_entry( in test_migrate_key_app_to_selinux()
4446 let mut db = new_test_db()?; in test_migrate_key_destination_occupied() localVariable
4452 make_test_key_entry(&mut db, Domain::APP, SOURCE_UID as i64, SOURCE_ALIAS, None) in test_migrate_key_destination_occupied()
4454 make_test_key_entry(&mut db, Domain::APP, DESTINATION_UID as i64, DESTINATION_ALIAS, None) in test_migrate_key_destination_occupied()
4466 db.migrate_key_namespace( in test_migrate_key_destination_occupied()
4487 let mut db = KeystoreDB::new(temp_dir.path(), None).unwrap(); in test_upgrade_0_to_1() localVariable
4489 make_test_key_entry(&mut db, Domain::APP, UID as i64, ALIAS1, None).unwrap().id(); in test_upgrade_0_to_1()
4491 make_bootlevel_key_entry(&mut db, Domain::APP, UID as i64, ALIAS2, false).unwrap().id(); in test_upgrade_0_to_1()
4493 make_bootlevel_key_entry(&mut db, Domain::APP, UID as i64, ALIAS3, true).unwrap().id(); in test_upgrade_0_to_1()
4495 let (_, key_entry) = db in test_upgrade_0_to_1()
4515 let (_, key_entry) = db in test_upgrade_0_to_1()
4535 let (_, key_entry) = db in test_upgrade_0_to_1()
4556 db.with_transaction(TransactionBehavior::Immediate, |tx| { in test_upgrade_0_to_1()
4561 let (_, key_entry) = db in test_upgrade_0_to_1()
4581 let (_, key_entry) = db in test_upgrade_0_to_1()
4603 db.load_key_entry( in test_upgrade_0_to_1()
4633 let mut db = KeystoreDB::new(temp_dir.path(), None)?; in test_insert_and_load_full_keyentry_domain_app_concurrently() localVariable
4634 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()
4637 let (_key_guard, key_entry) = db in test_insert_and_load_full_keyentry_domain_app_concurrently()
4664 let mut db = KeystoreDB::new(temp_dir.path(), None).unwrap(); in test_insert_and_load_full_keyentry_domain_app_concurrently() localVariable
4665 assert!(db in test_insert_and_load_full_keyentry_domain_app_concurrently()
4745 let mut db = in test_large_number_of_concurrent_db_manipulations() localVariable
4757 make_test_key_entry(&mut db, Domain::APP, 1, &alias, None) in test_large_number_of_concurrent_db_manipulations()
4764 let mut db = new_test_db_with_gc(temp_dir1.path(), |_, _| Ok(())) in test_large_number_of_concurrent_db_manipulations() localVariable
4772 make_test_key_entry(&mut db, Domain::APP, 2, &alias, None) in test_large_number_of_concurrent_db_manipulations()
4787 db.unbind_key(&key, KeyType::Client, 2, |_, _| Ok(())).expect("Unbind Failed."); in test_large_number_of_concurrent_db_manipulations()
4794 let mut db = new_test_db_with_gc(temp_dir2.path(), |_, _| Ok(())) in test_large_number_of_concurrent_db_manipulations() localVariable
4807 db.unbind_key(&key, KeyType::Client, 1, |_, _| Ok(())).expect("Unbind Failed."); in test_large_number_of_concurrent_db_manipulations()
4822 let mut db = new_test_db_with_gc(temp_dir4.path(), |_, _| Ok(())) in test_large_number_of_concurrent_db_manipulations() localVariable
4826 make_test_key_entry(&mut db, Domain::APP, 3, &alias, None) in test_large_number_of_concurrent_db_manipulations()
4834 db.unbind_key(&key, KeyType::Client, 3, |_, _| Ok(())).expect("Unbind Failed."); in test_large_number_of_concurrent_db_manipulations()
4848 let mut db = KeystoreDB::new(temp_dir.path(), None)?; in list() localVariable
4876 let entry = make_test_key_entry(&mut db, *domain, *ns, *alias, None) in list()
4900 let mut list_result = db.list(*domain, *namespace, KeyType::Client)?; in list()
4907 let (_, entry) = db in list()
4930 assert_eq!(Vec::<KeyDescriptor>::new(), db.list(Domain::SELINUX, 101, KeyType::Client)?); in list()
4962 fn get_keyentry(db: &KeystoreDB) -> Result<Vec<KeyEntryRow>> { in get_keyentry()
4963 db.conn in get_keyentry()
4990 db: &mut KeystoreDB, in load_attestation_key_pool()
5000 db.create_attestation_key_entry(&public_key, &raw_public_key, &priv_key, &KEYSTORE_UUID)?; in load_attestation_key_pool()
5001 db.store_signed_attestation_certificate_chain( in load_attestation_key_pool()
5008 db.assign_attestation_key(Domain::APP, namespace, &KEYSTORE_UUID)?; in load_attestation_key_pool()
5242 db: &mut KeystoreDB, in make_test_key_entry()
5248 let key_id = db.create_key_entry(&domain, &namespace, KeyType::Client, &KEYSTORE_UUID)?; in make_test_key_entry()
5256 db.set_blob( in make_test_key_entry()
5262 db.set_blob(&key_id, SubComponentType::CERT, Some(TEST_CERT_BLOB), None)?; in make_test_key_entry()
5263 db.set_blob(&key_id, SubComponentType::CERT_CHAIN, Some(TEST_CERT_CHAIN_BLOB), None)?; in make_test_key_entry()
5266 db.insert_keyparameter(&key_id, ¶ms)?; in make_test_key_entry()
5270 db.insert_key_metadata(&key_id, &metadata)?; in make_test_key_entry()
5271 rebind_alias(db, &key_id, alias, domain, namespace)?; in make_test_key_entry()
5301 db: &mut KeystoreDB, in make_bootlevel_key_entry()
5307 let key_id = db.create_key_entry(&domain, &namespace, KeyType::Client, &KEYSTORE_UUID)?; in make_bootlevel_key_entry()
5314 db.set_blob( in make_bootlevel_key_entry()
5320 db.set_blob(&key_id, SubComponentType::CERT, Some(TEST_CERT_BLOB), None)?; in make_bootlevel_key_entry()
5321 db.set_blob(&key_id, SubComponentType::CERT_CHAIN, Some(TEST_CERT_CHAIN_BLOB), None)?; in make_bootlevel_key_entry()
5326 db.insert_keyparameter(&key_id, ¶ms)?; in make_bootlevel_key_entry()
5330 db.insert_key_metadata(&key_id, &metadata)?; in make_bootlevel_key_entry()
5331 rebind_alias(db, &key_id, alias, domain, namespace)?; in make_bootlevel_key_entry()
5360 fn debug_dump_keyentry_table(db: &mut KeystoreDB) -> Result<()> { in debug_dump_keyentry_table()
5361 let mut stmt = db.conn.prepare( in debug_dump_keyentry_table()
5390 fn debug_dump_grant_table(db: &mut KeystoreDB) -> Result<()> { in debug_dump_grant_table()
5391 let mut stmt = db in debug_dump_grant_table()
5429 let mut db = new_test_db()?; in test_last_off_body() localVariable
5430 db.insert_last_off_body(MonotonicRawTime::now()); in test_last_off_body()
5431 let tx = db.conn.transaction_with_behavior(TransactionBehavior::Immediate)?; in test_last_off_body()
5433 let last_off_body_1 = db.get_last_off_body(); in test_last_off_body()
5436 db.update_last_off_body(MonotonicRawTime::now()); in test_last_off_body()
5437 let tx2 = db.conn.transaction_with_behavior(TransactionBehavior::Immediate)?; in test_last_off_body()
5439 let last_off_body_2 = db.get_last_off_body(); in test_last_off_body()
5446 let mut db = new_test_db()?; in test_unbind_keys_for_user() localVariable
5447 db.unbind_keys_for_user(1, false)?; in test_unbind_keys_for_user()
5449 make_test_key_entry(&mut db, Domain::APP, 210000, TEST_ALIAS, None)?; in test_unbind_keys_for_user()
5450 make_test_key_entry(&mut db, Domain::APP, 110000, TEST_ALIAS, None)?; in test_unbind_keys_for_user()
5451 db.unbind_keys_for_user(2, false)?; in test_unbind_keys_for_user()
5453 assert_eq!(1, db.list(Domain::APP, 110000, KeyType::Client)?.len()); in test_unbind_keys_for_user()
5454 assert_eq!(0, db.list(Domain::APP, 210000, KeyType::Client)?.len()); in test_unbind_keys_for_user()
5456 db.unbind_keys_for_user(1, true)?; in test_unbind_keys_for_user()
5457 assert_eq!(0, db.list(Domain::APP, 110000, KeyType::Client)?.len()); in test_unbind_keys_for_user()
5464 let mut db = new_test_db()?; in test_store_super_key() localVariable
5473 db.store_super_key( in test_store_super_key()
5482 assert!(db.key_exists(Domain::APP, 1, &USER_SUPER_KEY.alias, KeyType::Super)?); in test_store_super_key()
5484 let (_, key_entry) = db.load_super_key(&USER_SUPER_KEY, 1)?.unwrap(); in test_store_super_key()
5522 let mut db = new_test_db()?; in test_query_all_valid_table_sizes() localVariable
5525 let stat = db.get_storage_stat(t)?; in test_query_all_valid_table_sizes()
5538 fn get_storage_stats_map(db: &mut KeystoreDB) -> BTreeMap<i32, StorageStats> { in get_storage_stats_map()
5541 .map(|t| (t.0, db.get_storage_stat(t).unwrap())) in get_storage_stats_map()
5546 db: &mut KeystoreDB, in assert_storage_increased()
5552 let new = db.get_storage_stat(storage).unwrap(); in assert_storage_increased()
5570 let updated_stats = get_storage_stats_map(db); in assert_storage_increased()
5595 let mut db = new_test_db()?; in test_verify_key_table_size_reporting() localVariable
5596 let mut working_stats = get_storage_stats_map(&mut db); in test_verify_key_table_size_reporting()
5598 let key_id = db.create_key_entry(&Domain::APP, &42, KeyType::Client, &KEYSTORE_UUID)?; in test_verify_key_table_size_reporting()
5600 &mut db, in test_verify_key_table_size_reporting()
5611 db.set_blob(&key_id, SubComponentType::KEY_BLOB, Some(TEST_KEY_BLOB), None)?; in test_verify_key_table_size_reporting()
5613 &mut db, in test_verify_key_table_size_reporting()
5624 db.insert_keyparameter(&key_id, ¶ms)?; in test_verify_key_table_size_reporting()
5626 &mut db, in test_verify_key_table_size_reporting()
5633 db.insert_key_metadata(&key_id, &metadata)?; in test_verify_key_table_size_reporting()
5635 &mut db, in test_verify_key_table_size_reporting()
5644 let total = db.get_storage_stat(MetricsStorage::DATABASE)?.size; in test_verify_key_table_size_reporting()
5652 let mut db = new_test_db()?; in test_verify_auth_table_size_reporting() localVariable
5653 let mut working_stats = get_storage_stats_map(&mut db); in test_verify_auth_table_size_reporting()
5654 db.insert_auth_token(&HardwareAuthToken { in test_verify_auth_table_size_reporting()
5662 assert_storage_increased(&mut db, vec![MetricsStorage::AUTH_TOKEN], &mut working_stats); in test_verify_auth_table_size_reporting()
5669 let mut db = new_test_db()?; in test_verify_grant_table_size_reporting() localVariable
5670 make_test_key_entry(&mut db, Domain::APP, OWNER, TEST_ALIAS, None)?; in test_verify_grant_table_size_reporting()
5672 let mut working_stats = get_storage_stats_map(&mut db); in test_verify_grant_table_size_reporting()
5673 db.grant( in test_verify_grant_table_size_reporting()
5686 assert_storage_increased(&mut db, vec![MetricsStorage::GRANT], &mut working_stats); in test_verify_grant_table_size_reporting()
5693 let mut db = new_test_db()?; in find_auth_token_entry_returns_latest() localVariable
5694 db.insert_auth_token(&HardwareAuthToken { in find_auth_token_entry_returns_latest()
5703 db.insert_auth_token(&HardwareAuthToken { in find_auth_token_entry_returns_latest()
5712 db.insert_auth_token(&HardwareAuthToken { in find_auth_token_entry_returns_latest()
5721 assert_eq!(db.perboot.auth_tokens_len(), 3); in find_auth_token_entry_returns_latest()
5723 assert_eq!(db.find_auth_token_entry(|_| true).unwrap().0.auth_token.mac, b"mac2".to_vec()); in find_auth_token_entry_returns_latest()
5729 let mut db = new_test_db()?; in test_load_key_descriptor() localVariable
5730 let key_id = make_test_key_entry(&mut db, Domain::APP, 1, TEST_ALIAS, None)?.0; in test_load_key_descriptor()
5732 let key = db.load_key_descriptor(key_id)?.unwrap(); in test_load_key_descriptor()
5739 assert_eq!(db.load_key_descriptor(key_id + 1)?, None); in test_load_key_descriptor()