diff --git a/frameworks/huks_standard/main/common/include/hks_common_check.h b/frameworks/huks_standard/main/common/include/hks_common_check.h index 2c72c6ad..9fef2adf 100644 --- a/frameworks/huks_standard/main/common/include/hks_common_check.h +++ b/frameworks/huks_standard/main/common/include/hks_common_check.h @@ -66,7 +66,7 @@ int32_t HksGetBlobFromWrappedData(const struct HksBlob *wrappedData, uint32_t bl int32_t HksCheckKeyNeedStored(const struct HksParamSet *paramSet, bool *isNeedStorage); -int32_t HksCheckParamsetOneAndPatamsetTwoExist(const struct HksParamSet *keyBlobParamSet, +int32_t HksCheckKeyBlobParamSetEqualRuntimeParamSet(const struct HksParamSet *keyBlobParamSet, const struct HksParamSet *runtimeParamSet, uint32_t tag); void SetRsaPssSaltLenType(const struct HksParamSet *paramSet, struct HksUsageSpec *usageSpec); diff --git a/frameworks/huks_standard/main/common/src/hks_common_check.c b/frameworks/huks_standard/main/common/src/hks_common_check.c index 068064e5..2407b20d 100644 --- a/frameworks/huks_standard/main/common/src/hks_common_check.c +++ b/frameworks/huks_standard/main/common/src/hks_common_check.c @@ -239,7 +239,7 @@ int32_t HksCheckKeyNeedStored(const struct HksParamSet *paramSet, bool *isNeedSt return ret; } -int32_t HksCheckParamsetOneAndPatamsetTwoExist(const struct HksParamSet *keyBlobParamSet, +int32_t HksCheckKeyBlobParamSetEqualRuntimeParamSet(const struct HksParamSet *keyBlobParamSet, const struct HksParamSet *runtimeParamSet, uint32_t tag) { if (keyBlobParamSet == NULL || runtimeParamSet == NULL) { @@ -249,13 +249,13 @@ int32_t HksCheckParamsetOneAndPatamsetTwoExist(const struct HksParamSet *keyBlob bool isExistInParamsetOne = true; struct HksParam *paramInParamsetOne = NULL; int32_t ret = HksGetParam(keyBlobParamSet, tag, ¶mInParamsetOne); - if (ret == HKS_ERROR_PARAM_NOT_EXIST) { + if (ret != HKS_SUCCESS) { isExistInParamsetOne = false; } bool isExistInParamsetTwo = true; struct HksParam *paramInParamsetTwo = NULL; ret = HksGetParam(runtimeParamSet, tag, ¶mInParamsetTwo); - if (ret == HKS_ERROR_PARAM_NOT_EXIST) { + if (ret != HKS_SUCCESS) { isExistInParamsetTwo = false; } if (isExistInParamsetOne && (!isExistInParamsetTwo)) { diff --git a/services/huks_standard/huks_engine/main/core/src/hks_core_service.c b/services/huks_standard/huks_engine/main/core/src/hks_core_service.c index 10f9946c..fc5ecf47 100644 --- a/services/huks_standard/huks_engine/main/core/src/hks_core_service.c +++ b/services/huks_standard/huks_engine/main/core/src/hks_core_service.c @@ -341,8 +341,9 @@ static int32_t SignVerifyAuth(const struct HksKeyNode *keyNode, const struct Hks ret = HksGetParam(paramSet, HKS_TAG_PADDING, &padding); HKS_IF_NOT_SUCC_LOGE_RETURN(ret, ret, "append sign/verify get padding param failed!") if (padding->uint32Param == HKS_PADDING_PSS) { - ret = HksCheckParamsetOneAndPatamsetTwoExist(keyNode->paramSet, paramSet, HKS_TAG_RSA_PSS_SALT_LEN_TYPE); - HKS_IF_NOT_SUCC_LOGE_RETURN(ret, ret, "HksCheckParamsetOneAndPatamsetTwoExist failed!") + ret = HksCheckKeyBlobParamSetEqualRuntimeParamSet(keyNode->paramSet, + paramSet, HKS_TAG_RSA_PSS_SALT_LEN_TYPE); + HKS_IF_NOT_SUCC_LOGE_RETURN(ret, ret, "HksCheckKeyBlobParamSetEqualRuntimeParamSet failed!") } return HksAuth(HKS_AUTH_ID_SIGN_VERIFY_RSA, keyNode, paramSet); } else if (algParam->uint32Param == HKS_ALG_ECC) { diff --git a/services/huks_standard/huks_engine/main/core/src/hks_core_service_three_stage.c b/services/huks_standard/huks_engine/main/core/src/hks_core_service_three_stage.c index 4396d628..62fe4525 100644 --- a/services/huks_standard/huks_engine/main/core/src/hks_core_service_three_stage.c +++ b/services/huks_standard/huks_engine/main/core/src/hks_core_service_three_stage.c @@ -230,9 +230,9 @@ static int32_t SignVerifyAuth(const struct HuksKeyNode *keyNode, const struct Hk ret = HksGetParam(paramSet, HKS_TAG_PADDING, &padding); HKS_IF_NOT_SUCC_LOGE_RETURN(ret, ret, "append sign/verify get padding param failed!") if (padding->uint32Param == HKS_PADDING_PSS) { - ret = HksCheckParamsetOneAndPatamsetTwoExist(keyNode->keyBlobParamSet, keyNode->runtimeParamSet, - HKS_TAG_RSA_PSS_SALT_LEN_TYPE); - HKS_IF_NOT_SUCC_LOGE_RETURN(ret, ret, "HksCheckParamsetOneAndPatamsetTwoExist failed!") + ret = HksCheckKeyBlobParamSetEqualRuntimeParamSet(keyNode->keyBlobParamSet, + keyNode->runtimeParamSet, HKS_TAG_RSA_PSS_SALT_LEN_TYPE); + HKS_IF_NOT_SUCC_LOGE_RETURN(ret, ret, "HksCheckKeyBlobParamSetEqualRuntimeParamSet failed!") } return HksThreeStageAuth(HKS_AUTH_ID_SIGN_VERIFY_RSA, keyNode); } else if (algParam->uint32Param == HKS_ALG_ED25519) {