mirror of
https://gitee.com/openharmony/security_deviceauth
synced 2024-11-23 04:40:12 +00:00
Fix codex.
Signed-off-by: heyinshen <heyinshen1@huawei.com>
This commit is contained in:
parent
db9d213c57
commit
2dc14422d4
@ -54,7 +54,7 @@ Element* VPushBack##ClassName(ClassName* obj, const Element *e) { \
|
||||
} \
|
||||
\
|
||||
if (ParcelWrite(&obj->parcel, e, sizeof(Element))) { \
|
||||
int size = obj->size(obj); \
|
||||
uint32_t size = obj->size(obj); \
|
||||
return obj->getp(obj, size-1); \
|
||||
} else { \
|
||||
return NULL; \
|
||||
@ -66,7 +66,7 @@ Element* VPushBackT##ClassName(ClassName* obj, Element e) { \
|
||||
} \
|
||||
\
|
||||
if (ParcelWrite(&obj->parcel, &e, sizeof(Element))) { \
|
||||
int size = obj->size(obj); \
|
||||
uint32_t size = obj->size(obj); \
|
||||
return obj->getp(obj, size-1); \
|
||||
} else { \
|
||||
return NULL; \
|
||||
|
@ -151,7 +151,7 @@ int32_t ExtractPakePeerId(PakeAuthParams *params, const CJson *in)
|
||||
LOGE("Input params is invalid.");
|
||||
return HC_ERR_INVALID_PARAMS;
|
||||
}
|
||||
int32_t deviceIdPeerLen = HcStrlen((const char *)params->deviceIdPeer.val);
|
||||
uint32_t deviceIdPeerLen = HcStrlen((const char *)params->deviceIdPeer.val);
|
||||
if (InitCharStringBuff(¶ms->pakeParams.idPeer,
|
||||
params->devIdPeer.length + deviceIdPeerLen) != HC_SUCCESS) {
|
||||
LOGE("InitCharStringBuff: idPeer failed.");
|
||||
@ -170,7 +170,7 @@ int32_t ExtractPakeSelfId(PakeAuthParams *params)
|
||||
LOGE("Input params NULL.");
|
||||
return HC_ERR_INVALID_PARAMS;
|
||||
}
|
||||
int32_t deviceIdSelfLen = HcStrlen((const char *)params->deviceIdSelf.val);
|
||||
uint32_t deviceIdSelfLen = HcStrlen((const char *)params->deviceIdSelf.val);
|
||||
if (InitCharStringBuff(¶ms->pakeParams.idSelf,
|
||||
params->devIdSelf.length + deviceIdSelfLen) != HC_SUCCESS) {
|
||||
LOGE("InitCharStringBuff: idSelf failed.");
|
||||
@ -225,7 +225,7 @@ int32_t ExtractPeerDeviceId(PakeAuthParams *params, const CJson *in)
|
||||
LOGE("Get peer deviceId failed.");
|
||||
return HC_ERR_JSON_GET;
|
||||
}
|
||||
int32_t len = HcStrlen(deviceId);
|
||||
uint32_t len = HcStrlen(deviceId);
|
||||
if (InitCharStringBuff(¶ms->deviceIdPeer, len) != HC_SUCCESS) {
|
||||
LOGE("InitCharStringBuff: deviceIdPeer failed.");
|
||||
return HC_ERR_AUTH_INTERNAL;
|
||||
@ -237,7 +237,7 @@ int32_t ExtractPeerDeviceId(PakeAuthParams *params, const CJson *in)
|
||||
for (uint32_t i = 0; i < params->deviceIdPeer.length; i++) {
|
||||
// Change a - f charactor to upper charactor.
|
||||
if (params->deviceIdPeer.val[i] >= 'a' && params->deviceIdPeer.val[i] <= 'f') {
|
||||
params->deviceIdPeer.val[i] = toupper(params->deviceIdPeer.val[i]);
|
||||
params->deviceIdPeer.val[i] = (uint8_t)toupper(params->deviceIdPeer.val[i]);
|
||||
}
|
||||
}
|
||||
return HC_SUCCESS;
|
||||
@ -279,7 +279,7 @@ int32_t ExtractPeerDevId(PakeAuthParams *params, const CJson *in)
|
||||
LOGE("Get PeerDevId failed.");
|
||||
return HC_ERR_JSON_GET;
|
||||
}
|
||||
int32_t len = HcStrlen(devId);
|
||||
uint32_t len = HcStrlen(devId);
|
||||
// Peer devId type is hex string, no need to transfer.
|
||||
if (InitCharStringBuff(¶ms->devIdPeer, len) != HC_SUCCESS) {
|
||||
LOGE("InitCharStringBuff: idPeer failed.");
|
||||
@ -304,7 +304,7 @@ int32_t GetPkInfoPeer(PakeAuthParams *params, const CJson *in)
|
||||
LOGE("Failed to get peer pkInfo string.");
|
||||
return HC_ERR_JSON_GET;
|
||||
}
|
||||
int32_t len = HcStrlen(pkInfoPeerStr) + 1;
|
||||
uint32_t len = HcStrlen(pkInfoPeerStr) + 1;
|
||||
if (InitSingleParam(¶ms->pkInfoPeer, len) != HC_SUCCESS) {
|
||||
LOGE("Failed to malloc for peer pkInfo.");
|
||||
return HC_ERR_ALLOC_MEMORY;
|
||||
@ -347,7 +347,7 @@ static int32_t GetAsyPubKeyInfo(PakeAuthParams *params)
|
||||
LOGE("Get token from local error.");
|
||||
break;
|
||||
}
|
||||
int32_t pkInfoLen = token->pkInfoStr.length;
|
||||
uint32_t pkInfoLen = token->pkInfoStr.length;
|
||||
if (pkInfoLen >= PUBLIC_KEY_INFO_SIZE) {
|
||||
LOGE("Length of pkInfo from local is error.");
|
||||
break;
|
||||
@ -411,7 +411,7 @@ int32_t InitPakeAuthParams(const CJson *in, PakeAuthParams *params, const Accoun
|
||||
LOGE("Self deviceId is NULL.");
|
||||
return HC_ERR_INVALID_PARAMS;
|
||||
}
|
||||
int32_t deviceIdLen = HcStrlen(deviceId);
|
||||
uint32_t deviceIdLen = HcStrlen(deviceId);
|
||||
GOTO_IF_ERR(GetIntFromJson(in, FIELD_OS_ACCOUNT_ID, ¶ms->osAccountId));
|
||||
GOTO_IF_ERR(InitPakeV2BaseParams(¶ms->pakeParams));
|
||||
GOTO_IF_ERR(InitSingleParam(¶ms->pakeParams.epkPeer, P256_PUBLIC_SIZE));
|
||||
|
@ -260,7 +260,7 @@ static int32_t WriteTokensJsonToFile(int32_t osAccountId, CJson *tokensJson)
|
||||
FreeJsonString(storeJsonString);
|
||||
return ret;
|
||||
}
|
||||
int32_t fileSize = HcStrlen(storeJsonString) + 1;
|
||||
int32_t fileSize = (int32_t)(HcStrlen(storeJsonString) + 1);
|
||||
if (HcFileWrite(file, storeJsonString, fileSize) == fileSize) {
|
||||
ret = HC_SUCCESS;
|
||||
} else {
|
||||
|
@ -334,7 +334,7 @@ static int32_t ComputeSharedSecret(PakeBaseParams *params, const Uint8Buff *sid,
|
||||
return HC_ERR_ALLOC_MEMORY;
|
||||
}
|
||||
|
||||
int32_t usedLen = 0;
|
||||
uint32_t usedLen = 0;
|
||||
if (memcpy_s(sharedSecretMsg.val, sharedSecretMsg.length, sid->val, sid->length) != EOK) {
|
||||
LOGE("Memcpy for sidHex failed.");
|
||||
res = HC_ERR_MEMORY_COPY;
|
||||
|
Loading…
Reference in New Issue
Block a user