mirror of
https://gitee.com/openharmony/security_certificate_manager
synced 2024-11-24 08:00:00 +00:00
RSA PSS-padding 默认修改saltlen为digest Len
Signed-off-by: haixiangw <wanghaixiang@huawei.com>
This commit is contained in:
parent
7704a9ab0f
commit
e767eb1876
@ -286,6 +286,19 @@ static int32_t AddParamsToParamSet(const struct CmBlob *commonUri, const struct
|
|||||||
CM_LOG_E("add params failed");
|
CM_LOG_E("add params failed");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* In the case of RSA PSS-Padding, set the salt length to the digest length */
|
||||||
|
if ((keySpec.algType == HKS_ALG_RSA) && (inputKeyProp.padding == HKS_PADDING_PSS)) {
|
||||||
|
struct HksParam saltLenParam = {
|
||||||
|
.tag = HKS_TAG_RSA_PSS_SALT_LEN_TYPE,
|
||||||
|
.uint32Param = HKS_RSA_PSS_SALTLEN_DIGEST
|
||||||
|
};
|
||||||
|
ret = HksAddParams(paramSet, &saltLenParam, 1);
|
||||||
|
if (ret != HKS_SUCCESS) {
|
||||||
|
CM_LOG_E("add saltLen tag failed");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
} while (0);
|
} while (0);
|
||||||
|
|
||||||
CM_FREE_PTR(outParamSet);
|
CM_FREE_PTR(outParamSet);
|
||||||
|
@ -576,7 +576,7 @@ HWTEST_F(CmFinishTest, CmFinishTest028, TestSize.Level0)
|
|||||||
*/
|
*/
|
||||||
HWTEST_F(CmFinishTest, CmFinishTest029, TestSize.Level0)
|
HWTEST_F(CmFinishTest, CmFinishTest029, TestSize.Level0)
|
||||||
{
|
{
|
||||||
struct CmSignatureSpec spec = { CM_KEY_PURPOSE_SIGN, CM_PADDING_PSS, CM_DIGEST_SHA256 };
|
struct CmSignatureSpec spec = { CM_KEY_PURPOSE_SIGN, CM_PADDING_PSS, CM_DIGEST_SHA224 };
|
||||||
TestSignVerify(CERT_KEY_ALG_RSA_512, true, &spec);
|
TestSignVerify(CERT_KEY_ALG_RSA_512, true, &spec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user