未验证 提交 0f38cffd 编写于 作者: O openharmony_ci 提交者: Gitee

!6111 【OpenHarmony 3.2.8.1】【安全子系统】【master】security代码维护

Merge pull request !6111 from qiaozzzh/1025_1
......@@ -28,7 +28,7 @@
int32_t HksGenerateKeyRun(const struct HksBlob *keyAlias, const struct HksParamSet *paramSetIn,
struct HksParamSet *paramSetOut, uint32_t performTimes)
{
int32_t ret;
int32_t ret = 0;
/* if keyAlias exist, the key will be generated and refreshed */
for (uint32_t i = 0; i < performTimes; ++i) {
ret = HksGenerateKey(keyAlias, paramSetIn, paramSetOut);
......@@ -42,7 +42,7 @@ int32_t HksGenerateKeyRun(const struct HksBlob *keyAlias, const struct HksParamS
int32_t HksEncryptRun(const struct HksBlob *key, const struct HksParamSet *paramSet,
const struct HksBlob *plainText, struct HksBlob *cipherText, uint32_t performTimes)
{
int32_t ret;
int32_t ret = 0;
uint32_t oriCipherTestSize = 0;
if (cipherText != NULL) {
oriCipherTestSize = cipherText->size;
......@@ -65,7 +65,7 @@ int32_t HksEncryptRun(const struct HksBlob *key, const struct HksParamSet *param
int32_t HksDecryptRun(const struct HksBlob *key, const struct HksParamSet *paramSet,
const struct HksBlob *cipherText, struct HksBlob *plainText, uint32_t performTimes)
{
int32_t ret;
int32_t ret = 0;
uint32_t oriPlainTextSize = 0;
if (plainText != NULL) {
oriPlainTextSize = plainText->size;
......@@ -87,7 +87,7 @@ int32_t HksDecryptRun(const struct HksBlob *key, const struct HksParamSet *param
int32_t HksMacRun(const struct HksBlob *key, const struct HksParamSet *paramSet,
const struct HksBlob *srcData, struct HksBlob *mac, uint32_t performTimes)
{
int32_t ret;
int32_t ret = 0;
uint32_t oriMacSize = 0;
if (mac != NULL) {
oriMacSize = mac->size;
......@@ -109,7 +109,7 @@ int32_t HksMacRun(const struct HksBlob *key, const struct HksParamSet *paramSet,
int32_t HksDeriveKeyRun(const struct HksParamSet *paramSet, const struct HksBlob *masterKey,
struct HksBlob *derivedKey, uint32_t performTimes)
{
int32_t ret;
int32_t ret = 0;
uint32_t oriDerivedKeySize = 0;
if (derivedKey != NULL) {
oriDerivedKeySize = derivedKey->size;
......@@ -136,7 +136,7 @@ int32_t HksDeleteKeyRun(const struct HksBlob *keyAlias, uint32_t performTimes)
int32_t HksKeyExistRun(const struct HksBlob *keyAlias, uint32_t performTimes)
{
int32_t ret;
int32_t ret = 0;
for (uint32_t i = 0; i < performTimes; ++i) {
ret = HksKeyExist(keyAlias, NULL);
if (ret != HKS_SUCCESS) {
......@@ -148,7 +148,7 @@ int32_t HksKeyExistRun(const struct HksBlob *keyAlias, uint32_t performTimes)
int32_t HksGenerateRandomRun(struct HksBlob *random, uint32_t performTimes)
{
int32_t ret;
int32_t ret = 0;
uint32_t oriRandomSize = 0;
if (random != NULL) {
oriRandomSize = random->size;
......@@ -170,7 +170,7 @@ int32_t HksGenerateRandomRun(struct HksBlob *random, uint32_t performTimes)
int32_t HksAgreeKeyRun(const struct HksParamSet *paramSet, const struct HksBlob *privateKey,
const struct HksBlob *peerPublicKey, struct HksBlob *agreedKey, uint32_t performTimes)
{
int32_t ret;
int32_t ret = 0;
uint32_t oriAgreedKeySize = 0;
if (agreedKey != NULL) {
oriAgreedKeySize = agreedKey->size;
......@@ -192,7 +192,7 @@ int32_t HksAgreeKeyRun(const struct HksParamSet *paramSet, const struct HksBlob
int32_t HksHashRun(const struct HksParamSet *paramSet,
const struct HksBlob *srcData, struct HksBlob *hash, uint32_t performTimes)
{
int32_t ret;
int32_t ret = 0;
uint32_t oriHashSize = 0;
if (hash != NULL) {
oriHashSize = hash->size;
......@@ -215,7 +215,7 @@ int32_t HksHashRun(const struct HksParamSet *paramSet,
int32_t HksBnExpModRun(struct HksBlob *x, const struct HksBlob *a,
const struct HksBlob *e, const struct HksBlob *n, uint32_t performTimes)
{
int32_t ret;
int32_t ret = 0;
uint32_t oriXSize = 0;
if (x != NULL) {
oriXSize = x->size;
......
......@@ -508,7 +508,7 @@ char *GetCurrentPath()
int CheckFsMount(const char *topDir, const char *topDirMountInfo)
{
const int lenMax = 100;
int len;
int len = 0;
char buf[lenMax] = {0};
const char mountInfoFile[] = "/proc/mounts";
// check topDir exist
......
......@@ -344,7 +344,7 @@ static int CapgetWithCaps(pid_t pid, unsigned int caps)
*/
HWTEST_F(CapabilityTestSuite, CapabilityTest0600, Function | MediumTest | Level2)
{
int ret;
int ret = 0;
int status1 = 0;
int status2 = 0;
// Preset action: Fork a sub process pid1
......@@ -404,7 +404,7 @@ HWTEST_F(CapabilityTestSuite, CapabilityTest0600, Function | MediumTest | Level2
*/
HWTEST_F(CapabilityTestSuite, CapabilityTest0700, Function | MediumTest | Level2)
{
int ret;
int ret = 0;
int status = 0;
pid_t pid = fork(); // Preset action: Fork a sub process
ASSERT_TRUE(pid >= 0) << "======== Fork Error! =========";
......@@ -454,7 +454,7 @@ HWTEST_F(CapabilityTestSuite, CapabilityTest0700, Function | MediumTest | Level2
*/
HWTEST_F(CapabilityTestSuite, CapabilityTest0800, Function | MediumTest | Level2)
{
int ret;
int ret = 0;
int status = 0;
// Preset action: Fork a sub process
pid_t pid = fork();
......@@ -522,7 +522,7 @@ HWTEST_F(CapabilityTestSuite, CapabilityTest0800, Function | MediumTest | Level2
*/
HWTEST_F(CapabilityTestSuite, CapabilityTest0900, Security | MediumTest | Level2)
{
int ret;
int ret = 0;
int status = 0;
// Preset action: Fork a sub process
pid_t pid = fork();
......@@ -559,7 +559,7 @@ HWTEST_F(CapabilityTestSuite, CapabilityTest0900, Security | MediumTest | Level2
*/
HWTEST_F(CapabilityTestSuite, CapabilityTest1000, Function | MediumTest | Level2)
{
int ret;
int ret = 0;
int status1 = 0;
int status2 = 0;
// Preset action: Fork a sub process pid1
......@@ -623,7 +623,7 @@ HWTEST_F(CapabilityTestSuite, CapabilityTest1000, Function | MediumTest | Level2
*/
HWTEST_F(CapabilityTestSuite, CapabilityTest1100, Function | MediumTest | Level2)
{
int ret;
int ret = 0;
int status = 0;
struct timespec tp = { 0 };
// Preset action: Fork a sub process
......@@ -821,7 +821,7 @@ HWTEST_F(CapabilityTestSuite, CapabilityTest1500, Reliability | MediumTest | Lev
*/
HWTEST_F(CapabilityTestSuite, CapabilityTest1600, Reliability | MediumTest | Level3)
{
int ret;
int ret = 0;
int status = 0;
// Preset action: Fork a sub process
pid_t pid = fork();
......@@ -901,7 +901,7 @@ HWTEST_F(CapabilityTestSuite, CapabilityTest1700, Reliability | MediumTest | Lev
*/
HWTEST_F(CapabilityTestSuite, CapabilityTest1800, Reliability | MediumTest | Level3)
{
int ret;
int ret = 0;
int status = 0;
// Preset action: Fork a sub process
pid_t pid = fork();
......@@ -939,7 +939,7 @@ HWTEST_F(CapabilityTestSuite, CapabilityTest1800, Reliability | MediumTest | Lev
*/
HWTEST_F(CapabilityTestSuite, CapabilityTest1900, Reliability | MediumTest | Level2)
{
int ret;
int ret = 0;
int status = 0;
// Preset action: Fork a sub process
pid_t pid = fork();
......
......@@ -642,7 +642,7 @@ HWTEST_F(DacTestSuite, DACTest0020, Function | MediumTest | Level1)
*/
HWTEST_F(DacTestSuite, DACTest0030, Function | MediumTest | Level1)
{
int ret;
int ret = 0;
gid_t grouplist[SIZE255];
// Preset action: Obtain the groups of the current process
unsigned int groupsize = getgroups(0, grouplist);
......@@ -677,7 +677,7 @@ HWTEST_F(DacTestSuite, DACTest0030, Function | MediumTest | Level1)
*/
HWTEST_F(DacTestSuite, DACTest0040, Function | MediumTest | Level2)
{
int ret;
int ret = 0;
gid_t grouplist[SIZE255];
// Preset action: Obtain the groups of the current process
unsigned int groupsize = getgroups(0, grouplist);
......@@ -712,7 +712,7 @@ HWTEST_F(DacTestSuite, DACTest0040, Function | MediumTest | Level2)
*/
HWTEST_F(DacTestSuite, DACTest0050, Function | MediumTest | Level3)
{
int ret;
int ret = 0;
gid_t grouplist[SIZE255];
// Preset action: Obtain the groups of the current process
unsigned int groupsize = getgroups(0, grouplist);
......@@ -747,7 +747,7 @@ HWTEST_F(DacTestSuite, DACTest0050, Function | MediumTest | Level3)
*/
HWTEST_F(DacTestSuite, DACTest0060, Function | MediumTest | Level3)
{
int ret;
int ret = 0;
gid_t grouplist[SIZE255];
// Preset action: Obtain the groups of the current process
size_t groupsize = getgroups(0, grouplist);
......@@ -787,7 +787,7 @@ HWTEST_F(DacTestSuite, DACTest0060, Function | MediumTest | Level3)
*/
HWTEST_F(DacTestSuite, DACTest0070, Security | MediumTest | Level2)
{
int ret;
int ret = 0;
int status = 0;
// Preset action: Fork three sub processes
pid_t pid;
......@@ -849,7 +849,7 @@ HWTEST_F(DacTestSuite, DACTest0070, Security | MediumTest | Level2)
*/
HWTEST_F(DacTestSuite, DACTest0080, Function | MediumTest | Level2)
{
int ret;
int ret = 0;
uid_t ruid = 0; uid_t euid = 0; uid_t suid = 0;
uid_t newruid = 0; uid_t neweuid = 0; uid_t newsuid = 0;
gid_t rgid = 0; gid_t egid = 0; gid_t sgid = 0;
......@@ -909,7 +909,7 @@ HWTEST_F(DacTestSuite, DACTest0080, Function | MediumTest | Level2)
*/
HWTEST_F(DacTestSuite, DACTest0120, Security | MediumTest | Level2)
{
int ret;
int ret = 0;
int status = 0;
// Preset action: Fork a sub process
pid_t pid = fork();
......
......@@ -171,7 +171,7 @@ HWTEST_F(ActsPMSLoadTest, testSecPMPMS_0540, Function | MediumTest | Level1)
HWTEST_F(ActsPMSLoadTest, testSecPMPMS_0550, Function | MediumTest | Level0)
{
SaveOrUpdatePermissions(TEST_APP_ID, g_systemPers, SYS_PERM_NUM, FIRST_INSTALL);
int i;
int i = 0;
for (i = 0; i < SYS_PERM_NUM; i++) {
g_interface->GrantPermission(TEST_APP_ID, g_systemPers[i].name);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册