提交 6044d2ac 编写于 作者: W w00835064

HUKS init finish增加算法和长度校

Change-Id: Icb64127cf9637b4ef681f1f473867a4f9c1083cf
Signed-off-by: Nw00835064 <wangxiyang4@huawei.com>
上级 62ba6274
......@@ -65,7 +65,7 @@ static struct OH_Huks_Param g_agreeParams01Init001[] = {
.uint32Param = OH_HUKS_KEY_PURPOSE_AGREE
}, {
.tag = OH_HUKS_TAG_KEY_SIZE,
.uint32Param = OH_HUKS_DH_KEY_SIZE_2048
.uint32Param = OH_HUKS_AES_KEY_SIZE_256
}
};
static struct OH_Huks_Param g_agreeParams01Finish001[] = {
......@@ -107,7 +107,7 @@ static struct OH_Huks_Param g_agreeParams02Init001[] = {
.uint32Param = OH_HUKS_KEY_PURPOSE_AGREE
}, {
.tag = OH_HUKS_TAG_KEY_SIZE,
.uint32Param = OH_HUKS_DH_KEY_SIZE_2048
.uint32Param = OH_HUKS_AES_KEY_SIZE_256
}
};
static struct OH_Huks_Param g_agreeParams02Finish001[] = {
......
......@@ -89,10 +89,10 @@ static struct OH_Huks_Param g_hkdfFinishParams001[] = {
}
}, {
.tag = OH_HUKS_TAG_ALGORITHM,
.uint32Param = OH_HUKS_ALG_HKDF
.uint32Param = OH_HUKS_ALG_AES
}, {
.tag = OH_HUKS_TAG_KEY_SIZE,
.uint32Param = DERIVE_KEY_SIZE_32
.uint32Param = 256
}, {
.tag = OH_HUKS_TAG_PURPOSE,
.uint32Param = OH_HUKS_KEY_PURPOSE_DERIVE
......
......@@ -118,7 +118,7 @@ static struct OH_Huks_Param g_pbkdf2FinishParams001[] = {
.uint32Param = OH_HUKS_ALG_AES
}, {
.tag = OH_HUKS_TAG_KEY_SIZE,
.uint32Param = DERIVE_KEY_SIZE_32
.uint32Param = 256
}, {
.tag = OH_HUKS_TAG_PURPOSE,
.uint32Param = OH_HUKS_KEY_PURPOSE_DERIVE
......
......@@ -234,7 +234,10 @@ async function publicAgreeFunc(
HuksOptions.properties.splice(5, 1);
}
await publicAgreeInitFunc(srcKeyAliesFrist, HuksOptions);
let HuksOptionsInit = JSON.parse(JSON.stringify(HuksOptions));
HuksOptionsInit.properties.splice(2,1,HuksOptionsFinish.properties[3])
await publicAgreeInitFunc(srcKeyAliesFrist, HuksOptionsInit);
await publicAgreeUpdateFunc(HuksOptions, 1);
await publicAgreeFinishAbortFunc(HuksOptionsFinish, thirdInderfaceName);
......@@ -245,7 +248,7 @@ async function publicAgreeFunc(
value: stringToUint8Array(srcKeyAliesSecond + 'final'),
});
await publicAgreeInitFunc(srcKeyAliesSecond, HuksOptions);
await publicAgreeInitFunc(srcKeyAliesSecond, HuksOptionsInit);
await publicAgreeUpdateFunc(HuksOptions, 2);
await publicAgreeFinishAbortFunc(HuksOptionsFinishSecond, thirdInderfaceName);
......
......@@ -148,7 +148,10 @@ async function publicAgreeFunc(
HuksOptions.properties.splice(5, 1);
}
await publicAgreeInitFunc(srcKeyAliesFrist, HuksOptions);
let HuksOptionsInit = JSON.parse(JSON.stringify(HuksOptions));
HuksOptionsInit.properties.splice(2,1,HuksOptionsFinish.properties[3])
await publicAgreeInitFunc(srcKeyAliesFrist, HuksOptionsInit);
await publicAgreeUpdateFunc(HuksOptions, 1);
await publicAgreeFinishAbortFunc(HuksOptionsFinish, thirdInderfaceName);
......@@ -159,7 +162,7 @@ async function publicAgreeFunc(
value: stringToUint8Array(srcKeyAliesSecond + 'final'),
});
await publicAgreeInitFunc(srcKeyAliesSecond, HuksOptions);
await publicAgreeInitFunc(srcKeyAliesSecond, HuksOptionsInit);
await publicAgreeUpdateFunc(HuksOptions, 2);
await publicAgreeFinishAbortFunc(HuksOptionsFinishSecond, thirdInderfaceName);
......
......@@ -51,10 +51,10 @@ function makehuksOptionsFinish(srcKeyAliesFirst){
function makehuksOptionsDerive(srcKeyAliesFirst){
let huksOptionsFinish = {
properties: new Array(
HuksAgreeDH.HuksKeyALGORITHMAES,
HuksAgreeDH.HuksKeySIZE256,
HuksAgreeDH.HuksKeyALGORITHMAES,
HuksAgreeDH.HuksKeyPurposeDERIVE,
HuksAgreeDH.HuksKeyDIGESTSHA256,
HuksAgreeDH.HuksKeySIZE256,
HuksAgreeDH.HuksKeyPADDINGNONE,
HuksAgreeDH.HuksKeyBLOCKMODEECB,
{
......@@ -73,9 +73,9 @@ function makehuksOptionsHmac(srcKeyAliesFirst){
let huksOptionsFinish = {
properties: new Array(
HuksAgreeDH.HuksKeyALGORITHMHMAC,
HuksAgreeDH.HuksKeySIZE256,
HuksAgreeDH.HuksKeyPurposeMAC,
HuksAgreeDH.HuksKeyDIGESTSHA256,
HuksAgreeDH.HuksKeySIZE256,
HuksAgreeDH.HuksKeyPADDINGNONE,
HuksAgreeDH.HuksKeyBLOCKMODEECB,
{
......
......@@ -272,6 +272,7 @@ async function publicAgreeFunc(
thirdInderfaceName
) {
try {
await publicAgreeGenFunc(srcKeyAliesFrist, HuksOptions);
await publicAgreeGenFunc(srcKeyAliesSecond, HuksOptions);
await publicAgreeExport1Func(srcKeyAliesFrist, HuksOptions, 1);
......@@ -284,7 +285,10 @@ async function publicAgreeFunc(
HuksOptions.properties.splice(5, 1);
}
await publicAgreeInitFunc(srcKeyAliesFrist, HuksOptions);
let HuksOptionsInit = JSON.parse(JSON.stringify(HuksOptions));
HuksOptionsInit.properties.splice(2,1,HuksOptionsFinish.properties[3])
await publicAgreeInitFunc(srcKeyAliesFrist, HuksOptionsInit);
await publicAgreeUpdateFunc(HuksOptions, 1);
await publicAgreeFinishAbortFunc(HuksOptionsFinish, thirdInderfaceName);
......@@ -295,7 +299,7 @@ async function publicAgreeFunc(
value: stringToUint8Array(srcKeyAliesSecond + 'final'),
});
await publicAgreeInitFunc(srcKeyAliesSecond, HuksOptions);
await publicAgreeInitFunc(srcKeyAliesSecond, HuksOptionsInit);
await publicAgreeUpdateFunc(HuksOptions, 2);
await publicAgreeFinishAbortFunc(HuksOptionsFinishSecond, thirdInderfaceName);
......
......@@ -166,6 +166,7 @@ async function publicAgreeFunc(
thirdInderfaceName
) {
try {
await publicAgreeGenFunc(srcKeyAliesFrist, HuksOptions);
await publicAgreeGenFunc(srcKeyAliesSecond, HuksOptions);
await publicAgreeExport1Func(srcKeyAliesFrist, HuksOptions, 1);
......@@ -178,7 +179,10 @@ async function publicAgreeFunc(
HuksOptions.properties.splice(5, 1);
}
await publicAgreeInitFunc(srcKeyAliesFrist, HuksOptions);
let HuksOptionsInit = JSON.parse(JSON.stringify(HuksOptions));
HuksOptionsInit.properties.splice(2,1,HuksOptionsFinish.properties[3])
await publicAgreeInitFunc(srcKeyAliesFrist, HuksOptionsInit);
await publicAgreeUpdateFunc(HuksOptions, 1);
await publicAgreeFinishAbortFunc(HuksOptionsFinish, thirdInderfaceName);
......@@ -189,7 +193,7 @@ async function publicAgreeFunc(
value: stringToUint8Array(srcKeyAliesSecond + 'final'),
});
await publicAgreeInitFunc(srcKeyAliesSecond, HuksOptions);
await publicAgreeInitFunc(srcKeyAliesSecond, HuksOptionsInit);
await publicAgreeUpdateFunc(HuksOptions, 2);
await publicAgreeFinishAbortFunc(HuksOptionsFinishSecond, thirdInderfaceName);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册