modified report info

Signed-off-by: qu-xianfei <quxianfei1@huawei.com>
This commit is contained in:
qu-xianfei 2024-10-20 15:16:33 +08:00
parent b4e305ad74
commit 36a1f291f6
7 changed files with 155 additions and 89 deletions

12
build/suite.py Executable file → Normal file
View File

@ -76,12 +76,6 @@ class XDeviceBuilder:
build xdevice package
:return:
"""
current_parentdir_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
xtstools_othersign_dir = os.path.join(current_parentdir_path, 'others', 'sign')
run_scripts1 = ",".join(
[os.path.join(xtstools_othersign_dir, "add_root.bat"),
os.path.join(xtstools_othersign_dir, "add_root.sh"),
os.path.join(xtstools_othersign_dir, "add_trust_root.py")])
ohos_dir = os.path.join(self.args.source_dir, 'plugins', 'ohos')
devicetest_dir = os.path.join(self.args.source_dir, 'plugins', 'devicetest')
gen_dir0 = os.path.join(self.args.source_dir, 'dist')
@ -113,22 +107,16 @@ class XDeviceBuilder:
to_dir=True)
utils.copy_file(output=self.args.suite_out_dir, sources=run_scripts,
to_dir=True)
dist_sign_dir = os.path.join(self.args.suite_out_dir, 'sign')
utils.copy_file(output=dist_sign_dir, sources=run_scripts1,
to_dir=True)
xtssuite_out_dir = self.args.suite_out_dir
if (xtssuite_out_dir.find('/acts/') != -1):
acts_validator_dir = os.path.join(self.args.suite_out_dir, '../acts-validator')
acts_validator_tools_dir = os.path.join(self.args.suite_out_dir, '../acts-validator/tools')
acts_validator_sign_dir = os.path.join(self.args.suite_out_dir, '../acts-validator/sign')
utils.copy_file(output=acts_validator_tools_dir, source_dirs=gen_dir0,
to_dir=True)
utils.copy_file(output=acts_validator_tools_dir, source_dirs=gen_dir1,
to_dir=True)
utils.copy_file(output=acts_validator_dir, sources=run_scripts,
to_dir=True)
utils.copy_file(output=acts_validator_sign_dir, sources=run_scripts1,
to_dir=True)
if self.args.configs_dir:

View File

@ -206,46 +206,64 @@ void ObtainProductParams(void)
int sdkApiVersion = GetSdkApiVersion();
if (sdkApiVersion != 0) {
printf("SdkApiVersion = %d\n", sdkApiVersion);
} else {
printf("SdkApiVersion = 0\n");
}
int firstApiVersion = GetFirstApiVersion();
if (firstApiVersion != 0) {
printf("firstApiVersion = %d\n", firstApiVersion);
} else {
printf("firstApiVersion = 0\n");
}
const char *bootloaderVersion = GetBootloaderVersion();
if (bootloaderVersion != NULL) {
printf("bootloaderVersion = %s\n", bootloaderVersion);
} else {
printf("bootloaderVersion = NULL\n");
}
const char *incrementalVersion = GetIncrementalVersion();
if (incrementalVersion != NULL) {
printf("incrementalVersion = %s\n", incrementalVersion);
} else {
printf("incrementalVersion = NULL\n");
}
const char *buildType = GetBuildType();
if (buildType != NULL) {
printf("buildType = %s\n", buildType);
} else {
printf("buildType = NULL\n");
}
const char *buildUser = GetBuildUser();
if (buildUser != NULL) {
printf("buildUser = %s\n", buildUser);
} else {
printf("buildUser = NULL\n");
}
const char *buildHost = GetBuildHost();
if (buildHost != NULL) {
printf("buildHost = %s\n", buildHost);
} else {
printf("buildHost = NULL\n");
}
const char *buildTime = GetBuildTime();
if (buildTime != NULL) {
printf("buildTime = %s\n", buildTime);
} else {
printf("buildTime = NULL\n");
}
const char *abiList = GetAbiList();
if (abiList != NULL) {
printf("AbiList = %s\n", abiList);
} else {
printf("AbiList = NULL\n");
}
}
@ -257,9 +275,12 @@ void ObtainAttestResultParams(void)
int32_t retStatus = GetAttestStatus(&attestResultInfo);
if (retStatus != DEVATTEST_SUCCESS) {
printf("[CLIENT MAIN] wrong. retStatus:%d\n", retStatus);
printf("authResult = %d\n", attestResultInfo.authResult);
printf("softwareResult = %d\n", attestResultInfo.softwareResult);
} else {
printf("authResult = %d\n", attestResultInfo.authResult);
printf("softwareResult = %d\n", attestResultInfo.softwareResult);
}
printf("authResult = %d\n", attestResultInfo.authResult);
printf("softwareResult = %d\n", attestResultInfo.softwareResult);
}
#endif
@ -269,26 +290,36 @@ void ObtainSystemParams(void)
const char *productType = GetDeviceType();
if (productType != NULL) {
printf("Device Type = %s\n", productType);
} else {
printf("Device Type = NULL\n");
}
const char *securityPatchTag = GetSecurityPatchTag();
if (securityPatchTag != NULL) {
printf("Security Patch = %s\n", securityPatchTag);
} else {
printf("Security Patch = NULL\n");
}
const char *osName = GetOSFullName();
if (osName != NULL) {
printf("OsFullName = %s\n", osName);
} else {
printf("OsFullName = NULL\n");
}
const char *displayVersion = GetDisplayVersion();
if (displayVersion != NULL) {
printf("DisplayVersion = %s\n", displayVersion);
} else {
printf("DisplayVersion = NULL\n");
}
const char *versionId = GetVersionId();
if (versionId != NULL) {
printf("VersionID = %s\n", versionId);
} else {
printf("VersionID = NULL\n");
}
#ifdef INTER_ATTEST_MINI_MODULE
@ -299,51 +330,71 @@ void ObtainSystemParams(void)
int retUdid = GetDevUdid(udid, UDIDSIZE_LEN + 1);
if (retUdid == 0) {
printf("DevUdid = %s\n", udid);
} else {
printf("DevUdid = NULL\n");
}
const char *manuFacture = GetManufacture();
if (manuFacture != NULL) {
printf("manuFacture = %s\n", manuFacture);
} else {
printf("manuFacture = NULL\n");
}
const char *productModel = GetProductModel();
if (productModel != NULL) {
printf("productModel = %s\n", productModel);
} else {
printf("productModel = NULL\n");
}
const char *serial = GetSerial();
if (serial != NULL) {
printf("serial = %s\n", serial);
} else {
printf("serial = NULL\n");
}
const char *brand = GetBrand();
if (brand != NULL) {
printf("brand = %s\n", brand);
} else {
printf("brand = NULL\n");
}
const char *productSeries = GetProductSeries();
if (productSeries != NULL) {
printf("productSeries = %s\n", productSeries);
} else {
printf("productSeries = NULL\n");
}
const char *softwareModel = GetSoftwareModel();
if (softwareModel != NULL) {
printf("softwareModel = %s\n", softwareModel);
} else {
printf("softwareModel = NULL\n");
}
const char *hardWareModel = GetHardwareModel();
if (hardWareModel != NULL) {
printf("HardwareModel = %s\n", hardWareModel);
} else {
printf("HardwareModel = NULL\n");
}
const char *buildRootHash = GetBuildRootHash();
if (buildRootHash != NULL) {
printf("BuildRootHash = %s\n", buildRootHash);
} else {
printf("BuildRootHash = NULL\n");
}
const char *marketName = GetMarketName();
if (marketName != NULL) {
printf("marketName = %s\n", marketName);
} else {
printf("marketName = NULL\n");
}
ObtainProductParams();

View File

@ -27,46 +27,65 @@ void ObtainProductParms()
int sdkApiVersion = GetSdkApiVersion();
if (sdkApiVersion != 0) {
printf("SdkApiVersion = %d\n", sdkApiVersion);
} else {
printf("SdkApiVersion = 0\n");
}
int firstApiVersion = GetFirstApiVersion();
if (firstApiVersion != 0) {
printf("firstApiVersion = %d\n", firstApiVersion);
} else {
printf("firstApiVersion = 0\n");
}
const char *bootloaderVersion = GetBootloaderVersion();
if (bootloaderVersion != nullptr) {
printf("bootloaderVersion = %s\n", bootloaderVersion);
} else {
printf("bootloaderVersion = nullptr\n");
}
const char *incrementalVersion = GetIncrementalVersion();
if (incrementalVersion != nullptr) {
printf("incrementalVersion = %s\n", incrementalVersion);
} else {
printf("incrementalVersion = nullptr\n");
}
const char *buildType = GetBuildType();
if (buildType != nullptr) {
printf("buildType = %s\n", buildType);
} else {
printf("buildType = nullptr\n");
}
const char *buildUser = GetBuildUser();
if (buildUser != nullptr) {
printf("buildUser = %s\n", buildUser);
} else {
printf("buildUser = nullptr\n");
}
const char *buildHost = GetBuildHost();
if (buildHost != nullptr) {
printf("buildHost = %s\n", buildHost);
} else {
printf("buildHost = nullptr\n");
}
const char *buildTime = GetBuildTime();
if (buildTime != nullptr) {
printf("buildTime = %s\n", buildTime);
} else {
printf("buildTime = nullptr\n");
}
const char *abiList = GetAbiList();
if (abiList != nullptr) {
printf("AbiList = %s\n", abiList);
} else {
printf("AbiList = nullptr\n");
}
}
@ -76,26 +95,36 @@ int main()
const char *productType = GetDeviceType();
if (productType != nullptr) {
printf("Device Type = %s\n", productType);
} else {
printf("Device Type = nullptr\n");
}
const char *securityPatchTag = GetSecurityPatchTag();
if (securityPatchTag != nullptr) {
printf("Security Patch = %s\n", securityPatchTag);
} else {
printf("Security Patch = nullptr\n");
}
const char *osName = GetOSFullName();
if (osName != nullptr) {
printf("OsFullName = %s\n", osName);
} else {
printf("OsFullName = nullptr\n");
}
const char *displayVersion = GetDisplayVersion();
if (displayVersion != nullptr) {
printf("DisplayVersion = %s\n", displayVersion);
} else {
printf("DisplayVersion = nullptr\n");
}
const char *versionId = GetVersionId();
if (versionId != nullptr) {
printf("VersionID = %s\n", versionId);
} else {
printf("VersionID = nullptr\n");
}
AttestResultInfo attestResultInfo = {0};
@ -103,59 +132,82 @@ int main()
int32_t retStatus = GetAttestStatus(&attestResultInfo);
if (retStatus != DEVATTEST_SUESS) {
printf("[CLIENT MAIN] wrong. retStatus:%d\n", retStatus);
printf("authResult = %d\n", attestResultInfo.authResult);
printf("softwareResult = %d\n", attestResultInfo.softwareResult);
} else {
printf("authResult = %d\n", attestResultInfo.authResult);
printf("softwareResult = %d\n", attestResultInfo.softwareResult);
}
printf("authResult = %d\n", attestResultInfo.authResult);
printf("softwareResult = %d\n", attestResultInfo.softwareResult);
char udid[UDIDSIZE_LEN + 1] = {0};
int retUdid = GetDevUdid(udid, UDIDSIZE_LEN + 1);
if (retUdid == 0) {
printf("DevUdid = %s\n", udid);
} else {
printf("DevUdid = nullptr\n");
}
const char *manuFacture = GetManufacture();
if (manuFacture != nullptr) {
printf("manuFacture = %s\n", manuFacture);
} else {
printf("manuFacture = nullptr\n");
}
const char *productModel = GetProductModel();
if (productModel != nullptr) {
printf("productModel = %s\n", productModel);
} else {
printf("productModel = nullptr\n");
}
const char *serial = GetSerial();
if (serial != nullptr) {
printf("serial = %s\n", serial);
} else {
printf("serial = nullptr\n");
}
const char *brand = GetBrand();
if (brand != nullptr) {
printf("brand = %s\n", brand);
} else {
printf("brand = nullptr\n");
}
const char *productSeries = GetProductSeries();
if (productSeries != nullptr) {
printf("productSeries = %s\n", productSeries);
} else {
printf("productSeries = nullptr\n");
}
const char *softwareModel = GetSoftwareModel();
if (softwareModel != nullptr) {
printf("softwareModel = %s\n", softwareModel);
} else {
printf("softwareModel = nullptr\n");
}
const char *hardWareModel = GetHardwareModel();
if (hardWareModel != nullptr) {
printf("HardwareModel = %s\n", hardWareModel);
} else {
printf("HardwareModel = nullptr\n");
}
const char *buildRootHash = GetBuildRootHash();
if (buildRootHash != nullptr) {
printf("BuildRootHash = %s\n", buildRootHash);
} else {
printf("BuildRootHash = nullptr\n");
}
const char *marketName = GetMarketName();
if (marketName != nullptr) {
printf("marketName = %s\n", marketName);
} else {
printf("marketName = nullptr\n");
}
ObtainProductParms();

View File

@ -30,46 +30,64 @@ void ObtainProductParms(void)
int sdkApiVersion = GetSdkApiVersion();
if (sdkApiVersion != 0) {
printf("SdkApiVersion = %d\n", sdkApiVersion);
} else {
printf("SdkApiVersion = 0\n");
}
int firstApiVersion = GetFirstApiVersion();
if (firstApiVersion != 0) {
printf("firstApiVersion = %d\n", firstApiVersion);
} else {
printf("firstApiVersion = 0\n");
}
const char *bootloaderVersion = GetBootloaderVersion();
if (bootloaderVersion != nullptr) {
printf("bootloaderVersion = %s\n", bootloaderVersion);
} else {
printf("bootloaderVersion = nullptr\n");
}
const char *incrementalVersion = GetIncrementalVersion();
if (incrementalVersion != nullptr) {
printf("incrementalVersion = %s\n", incrementalVersion);
} else {
printf("incrementalVersion = nullptr\n");
}
const char *buildType = GetBuildType();
if (buildType != nullptr) {
printf("buildType = %s\n", buildType);
} else {
printf("buildType = nullptr\n");
}
const char *buildUser = GetBuildUser();
if (buildUser != nullptr) {
printf("buildUser = %s\n", buildUser);
} else {
printf("buildUser = nullptr\n");
}
const char *buildHost = GetBuildHost();
if (buildHost != nullptr) {
printf("buildHost = %s\n", buildHost);
} else {
printf("buildHost = nullptr\n");
}
const char *buildTime = GetBuildTime();
if (buildTime != nullptr) {
printf("buildTime = %s\n", buildTime);
} else {
printf("buildTime = nullptr\n");
}
const char *abiList = GetAbiList();
if (abiList != nullptr) {
printf("AbiList = %s\n", abiList);
} else {
printf("AbiList = nullptr\n");
}
}
@ -79,26 +97,36 @@ int main()
const char *productType = GetDeviceType();
if (productType != nullptr) {
printf("Device Type = %s\n", productType);
} else {
printf("Device Type = nullptr\n");
}
const char *securityPatchTag = GetSecurityPatchTag();
if (securityPatchTag != nullptr) {
printf("Security Patch = %s\n", securityPatchTag);
} else {
printf("Security Patch = nullptr\n");
}
const char *osName = GetOSFullName();
if (osName != nullptr) {
printf("OsFullName = %s\n", osName);
} else {
printf("OsFullName = nullptr\n");
}
const char *displayVersion = GetDisplayVersion();
if (displayVersion != nullptr) {
printf("DisplayVersion = %s\n", displayVersion);
} else {
printf("DisplayVersion = nullptr\n");
}
const char *versionId = GetVersionId();
if (versionId != nullptr) {
printf("VersionID = %s\n", versionId);
} else {
printf("VersionID = nullptr\n");
}
AttestResultInfo attestResultInfo;
@ -110,51 +138,71 @@ int main()
int ret = GetDevUdid(udid, UDIDSIZE_LEN + 1);
if (ret == 0) {
printf("DevUdid = %s\n", udid);
} else {
printf("DevUdid = nullptr\n");
}
const char *manuFacture = GetManufacture();
if (manuFacture != nullptr) {
printf("manuFacture = %s\n", manuFacture);
} else {
printf("manuFacture = nullptr\n");
}
const char *productModel = GetProductModel();
if (productModel != nullptr) {
printf("productModel = %s\n", productModel);
} else {
printf("productModel = nullptr\n");
}
const char *serial = GetSerial();
if (serial != nullptr) {
printf("serial = %s\n", serial);
} else {
printf("serial = nullptr\n");
}
const char *brand = GetBrand();
if (brand != nullptr) {
printf("brand = %s\n", brand);
} else {
printf("brand = nullptr\n");
}
const char *productSeries = GetProductSeries();
if (productSeries != nullptr) {
printf("productSeries = %s\n", productSeries);
} else {
printf("productSeries = nullptr\n");
}
const char *softwareModel = GetSoftwareModel();
if (softwareModel != nullptr) {
printf("softwareModel = %s\n", softwareModel);
} else {
printf("softwareModel = nullptr\n");
}
const char *hardWareModel = GetHardwareModel();
if (hardWareModel != nullptr) {
printf("HardwareModel = %s\n", hardWareModel);
} else {
printf("HardwareModel = nullptr\n");
}
const char *buildRootHash = GetBuildRootHash();
if (buildRootHash != nullptr) {
printf("BuildRootHash = %s\n", buildRootHash);
} else {
printf("BuildRootHash = nullptr\n");
}
const char *marketName = GetMarketName();
if (marketName != nullptr) {
printf("marketName = %s\n", marketName);
} else {
printf("marketName = nullptr\n");
}
ObtainProductParms();

View File

@ -1,19 +0,0 @@
@rem Copyright (c) 2024 Huawei Device Co., Ltd.
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem http://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@echo off
hdc file recv /system/etc/security/trusted_root_ca.json
python add_trust_root.py
hdc shell mount -o rw,remount /
hdc file send trusted_root_ca.json /system/etc/security/trusted_root_ca.json
pause

View File

@ -1,22 +0,0 @@
#!/bin/bash
#
# Copyright (C) 2024 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
set -e
hdc file recv /system/etc/security/trusted_root_ca.json
python add_trust_root.py
hdc shell mount -o rw,remount /
hdc file send trusted_root_ca.json /system/etc/security/trusted_root_ca.json

View File

@ -1,32 +0,0 @@
#!/usr/bin/env python3
# coding=utf-8
#
# Copyright (c) 2024 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
import os
import json
OPEN_HARMONY_KEY = 'C=CN, O=OpenHarmony, OU=OpenHarmony Team, CN=OpenHarmony Application Root CA'
OPEN_HARMONY_VALUE = '-----BEGIN CERTIFICATE-----\nMIICRDCCAcmgAwIBAgIED+E4izAMBggqhkjOPQQDAwUAMGgxCzAJBgNVBAYTAkNO\nMRQwEgYDVQQKEwtPcGVuSGFybW9ueTEZMBcGA1UECxMQT3Blbkhhcm1vbnkgVGVh\nbTEoMCYGA1UEAxMfT3Blbkhhcm1vbnkgQXBwbGljYXRpb24gUm9vdCBDQTAeFw0y\nMTAyMDIxMjE0MThaFw00OTEyMzExMjE0MThaMGgxCzAJBgNVBAYTAkNOMRQwEgYD\nVQQKEwtPcGVuSGFybW9ueTEZMBcGA1UECxMQT3Blbkhhcm1vbnkgVGVhbTEoMCYG\nA1UEAxMfT3Blbkhhcm1vbnkgQXBwbGljYXRpb24gUm9vdCBDQTB2MBAGByqGSM49\nAgEGBSuBBAAiA2IABE023XmRaw2DnO8NSsb+KG/uY0FtS3u5LQucdr3qWVnRW5ui\nQIL6ttNZBEeLTUeYcJZCpayg9Llf+1SmDA7dY4iP2EcRo4UN3rilovtfFfsmH4ty\n3SApHVFzWUl+NwdH8KNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC\nAQYwHQYDVR0OBBYEFBc6EKGrGXzlAE+s0Zgnsphadw7NMAwGCCqGSM49BAMDBQAD\nZwAwZAIwd1p3JzHN93eoPped1li0j64npgqNzwy4OrkehYAqNXpcpaEcLZ7UxW8E\nI2lZJ3SbAjAkqySHb12sIwdSFKSN9KCMMEo/eUT5dUXlcKR2nZz0MJdxT5F51qcX\n1CumzkcYhgU=\n-----END CERTIFICATE-----\n'
file_descriptor = os.open('trusted_root_ca.json', os.O_RDWR, 0o666)
with os.fdopen(file_descriptor, 'r+') as file:
data = json.load(file)
data[OPEN_HARMONY_KEY] = OPEN_HARMONY_VALUE
file.seek(0)
json.dump(data, file, indent=4)
file.truncate()