Home
last modified time | relevance | path

Searched refs:nonce (Results 1 – 25 of 46) sorted by relevance

12

/base/security/device_security_level/services/dslm/
Ddslm_inner_process.c45 …ice->nonceTimeStamp) || (curr - device->nonceTimeStamp > NONCE_ALIVE_TIME) || device->nonce == 0) { in CheckAndGenerateChallenge()
49 device->nonce = *(uint64_t *)&rand.value[0]; in CheckAndGenerateChallenge()
63 int32_t ret = BuildDeviceSecInfoRequest(device->nonce, &buff); in SendDeviceInfoRequest()
72 (uint32_t)device->nonce, (uint32_t)device->transNum); in SendDeviceInfoRequest()
84 uint64_t nonce = 0; in VerifyDeviceInfoResponse() local
90 ret = ParseDeviceSecInfoResponse(buff, &nonce, &version, &cred); in VerifyDeviceInfoResponse()
96 if (nonce != device->nonce || nonce == 0) { in VerifyDeviceInfoResponse()
110 ret = DefaultVerifyDslmCred(&device->identity, device->nonce, cred, &device->credInfo); in VerifyDeviceInfoResponse()
114 SECURITY_LOG_INFO("challenge is %{public}x***, ret is %{public}d", (uint32_t)nonce, ret); in VerifyDeviceInfoResponse()
Ddslm_msg_utils.c56 char *nonce = &challengeStr[0]; in GenerateSecInfoResponseJson() local
57 …ByteToHexString((uint8_t *)&challenge, sizeof(challenge), (uint8_t *)nonce, CHALLENGE_STRING_LENGT… in GenerateSecInfoResponseJson()
59 AddFieldStringToJson(body, FIELD_CHALLENGE, nonce); in GenerateSecInfoResponseJson()
93 char *nonce = &challengeStr[0]; in GenerateSecInfoRequestJson() local
94 …ByteToHexString((uint8_t *)&challenge, sizeof(challenge), (uint8_t *)nonce, CHALLENGE_STRING_LENGT… in GenerateSecInfoRequestJson()
101 AddFieldStringToJson(body, FIELD_CHALLENGE, nonce); in GenerateSecInfoRequestJson()
Ddslm_core_defines.h45 uint64_t nonce; member
/base/security/device_security_level/oem_property/ohos/impl/
Ddslm_ohos_verify.c68 static int32_t ParseNonceOfCertChain(const char *jsonBuffer, struct NonceOfCertChain *nonce) in ParseNonceOfCertChain() argument
82 …StringToByte(challengeStr, strlen(challengeStr), (uint8_t *)&nonce->challenge, sizeof(nonce->chall… in ParseNonceOfCertChain()
94 nonce->pbkInfoList = (uint8_t *)MALLOC(strlen(pkInfoListStr) + 1); in ParseNonceOfCertChain()
95 if (nonce->pbkInfoList == NULL) { in ParseNonceOfCertChain()
100 ret = strcpy_s((char *)nonce->pbkInfoList, strlen(pkInfoListStr) + 1, pkInfoListStr); in ParseNonceOfCertChain()
102 FREE(nonce->pbkInfoList); in ParseNonceOfCertChain()
103 nonce->pbkInfoList = NULL; in ParseNonceOfCertChain()
111 static void FreeNonceOfCertChain(struct NonceOfCertChain *nonce) in FreeNonceOfCertChain() argument
113 if (nonce == NULL) { in FreeNonceOfCertChain()
116 if (nonce->pbkInfoList != NULL) { in FreeNonceOfCertChain()
[all …]
/base/security/device_auth/services/authenticators/src/account_unrelated/pake_task/standard_exchange_task/
Dstandard_exchange_message_util.c25 int32_t PackageNonceAndCipherToJson(const Uint8Buff *nonce, const Uint8Buff *cipher, CJson *data, c… in PackageNonceAndCipherToJson() argument
28 uint32_t exAuthInfoLen = nonce->length + cipher->length; in PackageNonceAndCipherToJson()
35 if (memcpy_s(exAuthInfoVal, exAuthInfoLen, nonce->val, nonce->length) != EOK) { in PackageNonceAndCipherToJson()
40 if (memcpy_s(exAuthInfoVal + nonce->length, exAuthInfoLen - nonce->length, in PackageNonceAndCipherToJson()
52 int32_t ParseNonceAndCipherFromJson(Uint8Buff *nonce, Uint8Buff *cipher, const CJson *in, const cha… in ParseNonceAndCipherFromJson() argument
74 if (memcpy_s(nonce->val, nonce->length, exAuthInfoVal, nonce->length) != EOK) { in ParseNonceAndCipherFromJson()
80 res = InitSingleParam(cipher, exAuthInfoLen - nonce->length); in ParseNonceAndCipherFromJson()
85 if (memcpy_s(cipher->val, cipher->length, exAuthInfoVal + nonce->length, in ParseNonceAndCipherFromJson()
86 exAuthInfoLen - nonce->length) != EOK) { in ParseNonceAndCipherFromJson()
Dcommon_standard_unbind_exchange.c31 params->nonce.length = STANDARD_UNBIND_EXCHANGE_NONCE_LEN; in InitStandardUnbindExchangeParams()
32 params->nonce.val = (uint8_t *)HcMalloc(params->nonce.length, 0); in InitStandardUnbindExchangeParams()
33 if (params->nonce.val == NULL) { in InitStandardUnbindExchangeParams()
68 if (params->nonce.val != NULL) { in DestroyStandardUnbindExchangeParams()
69 HcFree(params->nonce.val); in DestroyStandardUnbindExchangeParams()
70 params->nonce.val = NULL; in DestroyStandardUnbindExchangeParams()
115 res = pakeParams->baseParams.loader->generateRandom(&(exchangeParams->nonce)); in EncryptRmvInfo()
124 .nonce = exchangeParams->nonce.val, in EncryptRmvInfo()
125 .nonceLen = exchangeParams->nonce.length in EncryptRmvInfo()
148 .nonce = exchangeParams->nonce.val, in DecryptRmvInfo()
[all …]
Dcommon_standard_bind_exchange.c46 params->nonce.length = STANDARD_BIND_EXCHANGE_NONCE_LEN; in InitStandardBindExchangeParams()
47 params->nonce.val = (uint8_t *)HcMalloc(params->nonce.length, 0); in InitStandardBindExchangeParams()
48 if (params->nonce.val == NULL) { in InitStandardBindExchangeParams()
85 if (params->nonce.val != NULL) { in DestroyStandardBindExchangeParams()
86 HcFree(params->nonce.val); in DestroyStandardBindExchangeParams()
87 params->nonce.val = NULL; in DestroyStandardBindExchangeParams()
222 res = pakeParams->baseParams.loader->generateRandom(&(exchangeParams->nonce)); in EncryptAuthAndSignInfo()
231 .nonce = exchangeParams->nonce.val, in EncryptAuthAndSignInfo()
232 .nonceLen = exchangeParams->nonce.length in EncryptAuthAndSignInfo()
260 .nonce = exchangeParams->nonce.val, in DecryptAuthAndSignInfo()
[all …]
Dstandard_client_unbind_exchange_task.c69 …GOTO_ERR_AND_SET_RET(PackageNonceAndCipherToJson(&(realTask->params.nonce), &(realTask->params.exR… in ExchangeRequest()
98 … int res = ParseNonceAndCipherFromJson(&(realTask->params.nonce), &(realTask->params.resultCipher), in ExchangeConfirm()
Dstandard_server_bind_exchange_task.c91 …GOTO_ERR_AND_SET_RET(ParseNonceAndCipherFromJson(&(realTask->params.nonce), &(realTask->params.exI… in ExchangeResponse()
112 …GOTO_ERR_AND_SET_RET(PackageNonceAndCipherToJson(&(realTask->params.nonce), &(realTask->params.exI… in ExchangeResponse()
/base/security/device_auth/services/authenticators/src/account_unrelated/iso_task/lite_exchange_task/
Diso_client_bind_exchange_task.c54 gcmParam.nonce = nonceBuf->val; in DecAndImportInner()
83 uint8_t *nonce = NULL; in DecAndImportAuthCode() local
88 nonce = (uint8_t *)HcMalloc(NONCE_SIZE, 0); in DecAndImportAuthCode()
89 if (nonce == NULL) { in DecAndImportAuthCode()
98 GOTO_ERR_AND_SET_RET(GetByteFromJson(in, FIELD_NONCE, nonce, NONCE_SIZE), res); in DecAndImportAuthCode()
108 Uint8Buff nonceBuf = { nonce, NONCE_SIZE }; in DecAndImportAuthCode()
115 HcFree(nonce); in DecAndImportAuthCode()
157 uint8_t **encData, uint8_t **nonce) in ClientBindAesEncrypt() argument
165 *nonce = (uint8_t *)HcMalloc(NONCE_SIZE, 0); in ClientBindAesEncrypt()
166 if (*nonce == NULL) { in ClientBindAesEncrypt()
[all …]
Diso_server_bind_exchange_task.c81 uint8_t *nonce = NULL; in DecryptChallenge() local
89 nonce = (uint8_t *)HcMalloc(NONCE_SIZE, 0); in DecryptChallenge()
90 if (nonce == NULL) { in DecryptChallenge()
94 GOTO_ERR_AND_SET_RET(GetByteFromJson(in, FIELD_NONCE, nonce, NONCE_SIZE), res); in DecryptChallenge()
99 gcmParam.nonce = nonce; in DecryptChallenge()
110 HcFree(nonce); in DecryptChallenge()
173 uint8_t *nonce = NULL; in GenerateAuthCodeAndImport() local
178 nonce = (uint8_t *)HcMalloc(NONCE_SIZE, 0); in GenerateAuthCodeAndImport()
179 if (nonce == NULL) { in GenerateAuthCodeAndImport()
189 Uint8Buff nonceBuf = { nonce, NONCE_SIZE }; in GenerateAuthCodeAndImport()
[all …]
Diso_server_unbind_exchange_task.c107 uint8_t *nonce = NULL; in DecryptRemoveInfo() local
111 nonce = (uint8_t *)HcMalloc(NONCE_SIZE, 0); in DecryptRemoveInfo()
112 if (nonce == NULL) { in DecryptRemoveInfo()
116 GOTO_ERR_AND_SET_RET(GetByteFromJson(in, FIELD_NONCE, nonce, NONCE_SIZE), res); in DecryptRemoveInfo()
144 …GcmParam gcmParam = { nonce, NONCE_SIZE, (uint8_t *)UNBIND_ADD_REQUEST, HcStrlen(UNBIND_ADD_REQUES… in DecryptRemoveInfo()
153 HcFree(nonce); in DecryptRemoveInfo()
Diso_client_unbind_exchange_task.c149 gcmParam.nonce = nonceBuf->val; in GenerateEncRemoveInfo()
173 uint8_t *nonce = NULL; in ClientUnbindExchangeStart() local
175 nonce = (uint8_t *)HcMalloc(NONCE_SIZE, 0); in ClientUnbindExchangeStart()
176 if (nonce == NULL) { in ClientUnbindExchangeStart()
180 Uint8Buff nonceBuf = { nonce, NONCE_SIZE }; in ClientUnbindExchangeStart()
195 HcFree(nonce); in ClientUnbindExchangeStart()
/base/useriam/user_auth_framework/test/unittest/services/src/
Duser_idm_session_controller_test.cpp86 std::vector<uint8_t> nonce = {1, 3, 2, 5, 7}; variable
90 auto fillUpChallenge = [&nonce](std::vector<uint8_t> &challenge) { challenge = nonce; }; in __anon9b4d1a5c0102()
98 EXPECT_THAT(challenge, ElementsAreArray(nonce));
106 std::vector<uint8_t> nonce = {1, 3, 2, 5, 7}; variable
110 auto fillUpChallenge = [&nonce](std::vector<uint8_t> &challenge) { challenge = nonce; }; in __anon9b4d1a5c0202()
127 std::vector<uint8_t> nonce = {1, 3, 2, 5, 7}; variable
131 auto fillUpChallenge = [&nonce](std::vector<uint8_t> &challenge) { challenge = nonce; }; in __anon9b4d1a5c0302()
/base/security/device_auth/services/authenticators/inc/account_unrelated/pake_task/
Dstandard_exchange_message_util.h23 int32_t PackageNonceAndCipherToJson(const Uint8Buff *nonce, const Uint8Buff *cipher, CJson *data, c…
24 int32_t ParseNonceAndCipherFromJson(Uint8Buff *nonce, Uint8Buff *cipher, const CJson *in, const cha…
Dcommon_standard_unbind_exchange.h32 Uint8Buff nonce; member
Dpake_base_cur_task.h37 Uint8Buff nonce; member
Dcommon_standard_bind_exchange.h32 Uint8Buff nonce; member
/base/security/device_auth/services/authenticators/src/account_unrelated/iso_task/
Diso_task_common.c79 uint8_t nonce[NONCE_SIZE] = { 0 }; in GenerateEncResult() local
80 Uint8Buff nonceBuf = { nonce, sizeof(nonce) }; in GenerateEncResult()
90 encryptInfo.nonce = nonce; in GenerateEncResult()
110 GOTO_ERR_AND_SET_RET(AddByteToJson(payload, FIELD_NONCE, nonce, sizeof(nonce)), ret); in GenerateEncResult()
210 uint8_t *nonce = NULL; in CheckEncResult() local
213 nonce = (uint8_t *)HcMalloc(NONCE_SIZE, 0); in CheckEncResult()
214 if (nonce == NULL) { in CheckEncResult()
218 GOTO_ERR_AND_SET_RET(GetByteFromJson(in, FIELD_NONCE, nonce, NONCE_SIZE), res); in CheckEncResult()
230 gcmParam.nonce = nonce; in CheckEncResult()
240 HcFree(nonce); in CheckEncResult()
/base/security/device_auth/services/authenticators/src/account_unrelated/pake_task/pake_v1_task/pake_v1_protocol_task/
Dpake_v1_protocol_task_common.c47 HcFree(params->nonce.val); in DestroyDasPakeV1Params()
48 params->nonce.val = NULL; in DestroyDasPakeV1Params()
131 res = params->baseParams.loader->generateRandom(&(params->nonce)); in FillPskWithDerivedKeyHex()
163 …res = params->baseParams.loader->computeHkdf(&pskKeyAlias, &(params->nonce), &keyInfo, &pskByte, t… in FillPskWithDerivedKeyHex()
/base/security/huks/services/huks_standard/huks_engine/main/core/src/
Dhks_upgrade_key_info.c175 static int32_t GetNonce(const struct HksBlob *keyInfo, struct HksBlob *nonce) in GetNonce() argument
188 nonce->data = tmp; in GetNonce()
189 nonce->size = HKS_SEALING_NONCE_SIZE; in GetNonce()
193 static int32_t BuildDecryptMeterail(const struct HksBlob *keyInfo, const struct HksBlob *nonce, in BuildDecryptMeterail() argument
215 aeadParam->nonce = *nonce; in BuildDecryptMeterail()
366 struct HksBlob nonce = { 0, NULL }; in GetNewFormatKey() local
368 int32_t ret = GetNonce(keyInfo, &nonce); in GetNewFormatKey()
372 ret = GetKek(&nonce, &kek); in GetNewFormatKey()
382 ret = BuildDecryptMeterail(keyInfo, &nonce, &usageSpec, &cipherKey); in GetNewFormatKey()
392 HKS_FREE_BLOB(nonce); in GetNewFormatKey()
Dhks_keyblob_lite.c108 struct HksBlob nonce = { 0, NULL }; in BuildKeyBlobUsageSpec() local
109 int32_t ret = HksBlobInit(&nonce, HKS_KEY_BLOB_NONCE_SIZE); /* need free by caller function */ in BuildKeyBlobUsageSpec()
112 ret = GetDeriveMaterial(DERIVE_NONCE, random, &nonce); in BuildKeyBlobUsageSpec()
115 HKS_FREE_PTR(nonce.data); in BuildKeyBlobUsageSpec()
126 aeadParam->nonce = nonce; in BuildKeyBlobUsageSpec()
179 HKS_FREE_BLOB(aeadParam.nonce); in EncryptAndDecryptKeyBlob()
Dhks_keyblob.c44 uint8_t nonce[HKS_KEY_BLOB_NONCE_SIZE]; member
166 aeadParam->nonce.data = keyBlobInfo->nonce; in BuildKeyBlobUsageSpec()
167 aeadParam->nonce.size = HKS_KEY_BLOB_NONCE_SIZE; in BuildKeyBlobUsageSpec()
275 struct HksBlob nonce = { HKS_KEY_BLOB_NONCE_SIZE, keyBlobInfo->nonce }; in InitKeyBlobInfo() local
276 ret = HksCryptoHalFillRandom(&nonce); in InitKeyBlobInfo()
/base/security/device_auth/services/authenticators/src/account_unrelated/pake_task/
Dpake_task_common.c236 params->nonce.length = PAKE_NONCE_LEN; in FillNonce()
237 params->nonce.val = (uint8_t *)HcMalloc(params->nonce.length, 0); in FillNonce()
238 if (params->nonce.val == NULL) { in FillNonce()
243 params->nonce.length = 0; in FillNonce()
244 params->nonce.val = NULL; in FillNonce()
Dpake_message_util.c96 res = AddByteToJson(payload, FIELD_NONCE, params->nonce.val, params->nonce.length); in PackagePakeResponseData()
143 res = GetByteFromJson(in, FIELD_NONCE, params->nonce.val, params->nonce.length); in ParsePakeResponseMessage()

12