修复有效告警

Signed-off-by: l00889714 <linzhaosheng@huawei.com>
This commit is contained in:
l00889714 2024-07-31 13:27:55 +08:00
parent 43dcbc8f6c
commit 2a3b32ebff
4 changed files with 10 additions and 9 deletions

View File

@ -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);

View File

@ -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, &paramInParamsetOne);
if (ret == HKS_ERROR_PARAM_NOT_EXIST) {
if (ret != HKS_SUCCESS) {
isExistInParamsetOne = false;
}
bool isExistInParamsetTwo = true;
struct HksParam *paramInParamsetTwo = NULL;
ret = HksGetParam(runtimeParamSet, tag, &paramInParamsetTwo);
if (ret == HKS_ERROR_PARAM_NOT_EXIST) {
if (ret != HKS_SUCCESS) {
isExistInParamsetTwo = false;
}
if (isExistInParamsetOne && (!isExistInParamsetTwo)) {

View File

@ -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) {

View File

@ -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) {