Merge branch 'master' of ssh://szv-y.codehub.huawei.com:2222/y00522150/asset

Match-id-3996308a7d7c7d73d28ff51aaf934a13b7758e84
This commit is contained in:
authName 2023-10-13 17:47:47 +08:00 committed by userName
commit a25bdd1f61
6 changed files with 12 additions and 13 deletions

View File

@ -87,7 +87,8 @@ fn compress(input_bytes: &Vec<u8>) -> [u32; 8] {
hash
}
pub(crate) fn sha256(input: &[u8]) -> [u8; 32] {
/// the function to get sha256
pub fn sha256(input: &[u8]) -> [u8; 32] {
// padding
let mut input_bytes = input.to_vec();
let input_len = input_bytes.len();

View File

@ -21,4 +21,6 @@ pub mod log_utils;
#[macro_use]
pub mod macro_utils;
pub mod definition;
pub mod definition;
pub mod hasher;

View File

@ -20,7 +20,6 @@ pub(crate) mod db_adapter;
mod default_params;
mod extra_params;
mod file_operator;
pub(crate) mod hasher;
pub(crate) use crypto_adapter::{encrypt, decrypt, init_decrypt};
pub(crate) use extra_params::construst_extra_params;

View File

@ -17,9 +17,8 @@
use crypto_manager::crypto::{Crypto, KeyInfo, SecretKey};
use asset_common::{definition::{AssetMap, Result, Tag, Value, ErrCode}, loge, logi};
use asset_common::{definition::{AssetMap, Result, Tag, Value, ErrCode}, loge, logi, hasher};
use crate::calling_info::CallingInfo;
use crate::operations::operation_common::hasher;
// todo : zwz : 实现真的aad
fn construct_aad() -> Vec<u8> {

View File

@ -20,9 +20,7 @@ use std::{
fs, path::Path,
};
use asset_common::{
loge, logi,
};
use asset_common::{ loge, logi, hasher};
use asset_sdk::definition::{
Accessibility, AuthType,
};
@ -55,10 +53,10 @@ pub unsafe extern "C" fn delete_hap_asset(user_id: i32, owner: *const c_char) ->
// 2 delete data in hucks
// todo owner_hash现在调用不到 需要等文志抽出来之后调用
let mut info = Vec::with_capacity(4);
info.push(KeyInfo { user_id, owner_hash: vec![b'2'], auth_type: AuthType::None as u32, access_type: Accessibility::DeviceFirstUnlock as u32 });
info.push(KeyInfo { user_id, owner_hash: vec![b'2'], auth_type: AuthType::None as u32, access_type: Accessibility::DeviceUnlock as u32 });
info.push(KeyInfo { user_id, owner_hash: vec![b'2'], auth_type: AuthType::Any as u32, access_type: Accessibility::DeviceFirstUnlock as u32 });
info.push(KeyInfo { user_id, owner_hash: vec![b'2'], auth_type: AuthType::Any as u32, access_type: Accessibility::DeviceUnlock as u32 });
info.push(KeyInfo { user_id, owner_hash: hasher::sha256(owner_str.as_bytes()).to_vec(), auth_type: AuthType::None as u32, access_type: Accessibility::DeviceFirstUnlock as u32 });
info.push(KeyInfo { user_id, owner_hash: hasher::sha256(owner_str.as_bytes()).to_vec(), auth_type: AuthType::None as u32, access_type: Accessibility::DeviceUnlock as u32 });
info.push(KeyInfo { user_id, owner_hash: hasher::sha256(owner_str.as_bytes()).to_vec(), auth_type: AuthType::Any as u32, access_type: Accessibility::DeviceFirstUnlock as u32 });
info.push(KeyInfo { user_id, owner_hash: hasher::sha256(owner_str.as_bytes()).to_vec(), auth_type: AuthType::Any as u32, access_type: Accessibility::DeviceUnlock as u32 });
while let Some(sub_info) = info.pop() {
let secret_key = SecretKey::new(sub_info);
match secret_key.delete() {

View File

@ -70,7 +70,7 @@ public:
LOGE("sandbox package appIndex = %{public}d is invalid.", appIndex);
return;
}
LOGE("sandbox package appIndex = %{public}d", appIndex);
LOGE("sandbox package appIndex = %{public}d", appIndex); // todo 要删掉
}