Home
last modified time | relevance | path

Searched refs:nonce (Results 1 - 25 of 44) sorted by relevance

12

/base/security/device_security_level/services/dslm/
H A Ddslm_inner_process.c45 if ((curr <= device->nonceTimeStamp) || (curr - device->nonceTimeStamp > NONCE_ALIVE_TIME) || device->nonce == 0) { in CheckAndGenerateChallenge()
46 SECURITY_LOG_INFO("update nonce for device %{public}x", device->machine.machineId); in CheckAndGenerateChallenge()
49 device->nonce = *(uint64_t *)&rand.value[0]; in CheckAndGenerateChallenge()
63 int32_t ret = BuildDeviceSecInfoRequest(device->nonce, &buff); in SendDeviceInfoRequest()
74 (uint32_t)device->nonce, (uint32_t)device->transNum); in SendDeviceInfoRequest()
86 uint64_t nonce = 0; in VerifyDeviceInfoResponse() local
92 ret = ParseDeviceSecInfoResponse(buff, &nonce, &version, &cred); in VerifyDeviceInfoResponse()
98 if (nonce != device->nonce || nonce in VerifyDeviceInfoResponse()
[all...]
H A Ddslm_msg_utils.c56 char *nonce = &challengeStr[0]; in GenerateSecInfoResponseJson() local
57 DslmByteToHexString((uint8_t *)&challenge, sizeof(challenge), (uint8_t *)nonce, CHALLENGE_STRING_LENGTH); in GenerateSecInfoResponseJson()
59 DslmAddFieldStringToJson(body, FIELD_CHALLENGE, nonce); in GenerateSecInfoResponseJson()
93 char *nonce = &challengeStr[0]; in GenerateSecInfoRequestJson() local
94 DslmByteToHexString((uint8_t *)&challenge, sizeof(challenge), (uint8_t *)nonce, CHALLENGE_STRING_LENGTH); in GenerateSecInfoRequestJson()
101 DslmAddFieldStringToJson(body, FIELD_CHALLENGE, nonce); in GenerateSecInfoRequestJson()
H A Ddslm_core_defines.h44 uint64_t nonce; member
/base/security/device_security_level/oem_property/ohos/common/
H A Ddslm_ohos_verify.c68 static int32_t ParseNonceOfCertChain(const char *jsonBuffer, struct NonceOfCertChain *nonce) in ParseNonceOfCertChain() argument
82 DslmHexStringToByte(challengeStr, strlen(challengeStr), (uint8_t *)&nonce->challenge, sizeof(nonce->challenge)); 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 in FreeNonceOfCertChain()
154 CheckNonceOfCertChain(const struct NonceOfCertChain *nonce, uint64_t challenge, const char *pbkInfoList) CheckNonceOfCertChain() argument
172 struct NonceOfCertChain nonce; VerifyNonceOfCertChain() local
[all...]
/base/security/device_auth/services/legacy/authenticators/src/account_unrelated/pake_task/standard_exchange_task/
H A Dstandard_exchange_message_util.c25 int32_t PackageNonceAndCipherToJson(const Uint8Buff *nonce, const Uint8Buff *cipher, CJson *data, const char *key) 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()
36 LOGE("memcpy nonce failed"); 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 char *key) in ParseNonceAndCipherFromJson() argument
74 if (memcpy_s(nonce->val, nonce in ParseNonceAndCipherFromJson()
[all...]
H A 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()
248 res = pakeParams->baseParams.loader->generateRandom(&(exchangeParams->nonce)); in EncryptAuthAndSignInfo()
257 .nonce = exchangeParams->nonce in EncryptAuthAndSignInfo()
[all...]
H A Dstandard_server_bind_exchange_task.c91 GOTO_ERR_AND_SET_RET(ParseNonceAndCipherFromJson(&(realTask->params.nonce), &(realTask->params.exInfoCipher), in ExchangeResponse()
112 GOTO_ERR_AND_SET_RET(PackageNonceAndCipherToJson(&(realTask->params.nonce), &(realTask->params.exInfoCipher), in ExchangeResponse()
H A Dstandard_client_bind_exchange_task.c65 GOTO_ERR_AND_SET_RET(PackageNonceAndCipherToJson(&(realTask->params.nonce), &(realTask->params.exInfoCipher), in ExchangeRequest()
95 int res = ParseNonceAndCipherFromJson(&(realTask->params.nonce), in ExchangeConfirm()
/base/useriam/user_auth_framework/test/unittest/services/src/
H A Duser_idm_session_controller_test.cpp86 std::vector<uint8_t> nonce = {1, 3, 2, 5, 7}; in HWTEST_F() local
90 auto fillUpChallenge = [&nonce](std::vector<uint8_t> &challenge) { challenge = nonce; }; in HWTEST_F()
98 EXPECT_THAT(challenge, ElementsAreArray(nonce)); in HWTEST_F()
106 std::vector<uint8_t> nonce = {1, 3, 2, 5, 7}; in HWTEST_F() local
110 auto fillUpChallenge = [&nonce](std::vector<uint8_t> &challenge) { challenge = nonce; }; in HWTEST_F()
127 std::vector<uint8_t> nonce = {1, 3, 2, 5, 7}; in HWTEST_F() local
131 auto fillUpChallenge = [&nonce](std::vector<uint8_t> &challenge) { challenge = nonce; }; in HWTEST_F()
[all...]
/base/security/device_auth/services/legacy/authenticators/src/account_unrelated/iso_task/lite_exchange_task/
H A Diso_client_bind_exchange_task.c54 gcmParam.nonce = nonceBuf->val; in DecAndImportInner()
89 uint8_t *nonce = NULL; in DecAndImportAuthCode() local
94 nonce = (uint8_t *)HcMalloc(NONCE_SIZE, 0); in DecAndImportAuthCode()
95 if (nonce == NULL) { in DecAndImportAuthCode()
104 GOTO_ERR_AND_SET_RET(GetByteFromJson(in, FIELD_NONCE, nonce, NONCE_SIZE), res); in DecAndImportAuthCode()
114 Uint8Buff nonceBuf = { nonce, NONCE_SIZE }; in DecAndImportAuthCode()
121 HcFree(nonce); in DecAndImportAuthCode()
163 uint8_t **encData, uint8_t **nonce) in ClientBindAesEncrypt()
171 *nonce = (uint8_t *)HcMalloc(NONCE_SIZE, 0); in ClientBindAesEncrypt()
172 if (*nonce in ClientBindAesEncrypt()
162 ClientBindAesEncrypt(IsoClientBindExchangeTask *task, const IsoParams *params, uint8_t **encData, uint8_t **nonce) ClientBindAesEncrypt() argument
208 uint8_t *nonce = NULL; ClientBindExchangeStart() local
[all...]
H A 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()
114 HcFree(nonce); in DecryptChallenge()
161 LOGE("generate nonce failed, res:%d", res); in GenAndEncAuthCode()
189 uint8_t *nonce = NULL; in GenerateAuthCodeAndImport() local
194 nonce in GenerateAuthCodeAndImport()
[all...]
/base/security/device_auth/services/legacy/authenticators/inc/account_unrelated/pake_task/
H A Dstandard_exchange_message_util.h27 int32_t PackageNonceAndCipherToJson(const Uint8Buff *nonce, const Uint8Buff *cipher, CJson *data, const char *key);
28 int32_t ParseNonceAndCipherFromJson(Uint8Buff *nonce, Uint8Buff *cipher, const CJson *in, const char *key);
H A Dcommon_standard_bind_exchange.h32 Uint8Buff nonce; member
H A Dpake_base_cur_task.h53 Uint8Buff nonce; member
/base/security/device_auth/services/session_manager/src/session/v2/expand_sub_session/
H A Dexpand_sub_session.c54 Uint8Buff nonce; member
105 GcmParam gcmParam = { impl->nonce.val, impl->nonce.length, in EncryptMsg()
128 GcmParam gcmParam = { impl->nonce.val, impl->nonce.length, in DecryptMsg()
492 ClearFreeUint8Buff(&(impl->nonce)); in DestroyExpandSubSession()
503 int32_t CreateExpandSubSession(const Uint8Buff *nonce, const Uint8Buff *encKey, ExpandSubSession **returnObj) in CreateExpandSubSession() argument
505 if ((nonce == NULL) || (nonce->val == NULL)) { in CreateExpandSubSession()
506 LOGE("nonce i in CreateExpandSubSession()
[all...]
/base/security/device_auth/services/legacy/authenticators/src/account_unrelated/pake_task/
H A Dpake_task_common.c242 params->nonce.length = PAKE_NONCE_LEN; in FillNonce()
243 params->nonce.val = (uint8_t *)HcMalloc(params->nonce.length, 0); in FillNonce()
244 if (params->nonce.val == NULL) { in FillNonce()
245 LOGE("Malloc for nonce failed."); in FillNonce()
249 params->nonce.length = 0; in FillNonce()
250 params->nonce.val = NULL; in FillNonce()
H A Dpake_message_util.c96 res = AddByteToJson(payload, FIELD_NONCE, params->nonce.val, params->nonce.length); in PackagePakeResponseData()
98 LOGE("Add nonce failed, res: %d.", res); in PackagePakeResponseData()
144 res = GetByteFromJson(in, FIELD_NONCE, params->nonce.val, params->nonce.length); in ParsePakeResponseMessage()
146 LOGE("Get nonce failed, res: %d.", res); in ParsePakeResponseMessage()
/base/security/device_auth/services/legacy/authenticators/src/account_unrelated/iso_task/iso_task_common/
H A Diso_task_common.c88 uint8_t nonce[NONCE_SIZE] = { 0 }; in GenerateEncResult() local
89 Uint8Buff nonceBuf = { nonce, sizeof(nonce) }; in GenerateEncResult()
92 LOGE("Generate nonce failed, res: %x.", ret); in GenerateEncResult()
99 encryptInfo.nonce = nonce; in GenerateEncResult()
123 GOTO_ERR_AND_SET_RET(AddByteToJson(payload, FIELD_NONCE, nonce, sizeof(nonce)), ret); in GenerateEncResult()
223 uint8_t *nonce = NULL; in CheckEncResult() local
226 nonce in CheckEncResult()
[all...]
/base/security/device_auth/services/session_manager/inc/session/v2/expand_sub_session/
H A Dexpand_sub_session.h42 int32_t CreateExpandSubSession(const Uint8Buff *nonce, const Uint8Buff *encKey, ExpandSubSession **returnObj);
/base/security/huks/services/huks_standard/huks_engine/main/core/src/
H A Dhks_keyblob_lite.c107 /* get nonce, derive from random + tag("derive_nonce") */ in BuildKeyBlobUsageSpec()
108 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()
114 HKS_LOG_E("get derive material nonce failed, ret = %" LOG_PUBLIC "d", ret); in BuildKeyBlobUsageSpec()
115 HKS_FREE(nonce.data); in BuildKeyBlobUsageSpec()
126 aeadParam->nonce = nonce; in BuildKeyBlobUsageSpec()
179 HKS_FREE_BLOB(aeadParam.nonce); in EncryptAndDecryptKeyBlob()
H A Dhks_keyblob.c45 uint8_t nonce[HKS_KEY_BLOB_NONCE_SIZE]; member
185 aeadParam->nonce.data = keyBlobInfo->nonce; in BuildKeyBlobUsageSpec()
186 aeadParam->nonce.size = HKS_KEY_BLOB_NONCE_SIZE; in BuildKeyBlobUsageSpec()
294 struct HksBlob nonce = { HKS_KEY_BLOB_NONCE_SIZE, keyBlobInfo->nonce }; in InitKeyBlobInfo() local
295 ret = HksCryptoHalFillRandom(&nonce); in InitKeyBlobInfo()
296 HKS_IF_NOT_SUCC_LOGE_BREAK(ret, "get nonce randomly failed, ret = %" LOG_PUBLIC "d", ret) in InitKeyBlobInfo()
519 aeadParam->nonce.data = authToken->iv; in HksDecryptAuthToken()
520 aeadParam->nonce in HksDecryptAuthToken()
[all...]
/base/security/device_auth/test/fuzztest/authenticators/account_unrelated/pake/standardexchangetask_fuzzer/
H A Dstandardexchangetask_fuzzer.cpp110 exchangeParams.nonce.val = nonceVal; in StandardExchangeTaskTest003()
111 exchangeParams.nonce.length = NONCE_LENGTH; in StandardExchangeTaskTest003()
/base/security/device_auth/test/unittest/deviceauth/source/
H A Dstandard_exchange_task_test.cpp111 exchangeParams.nonce.val = nonceVal; in HWTEST_F()
112 exchangeParams.nonce.length = NONCE_LENGTH; in HWTEST_F()
/base/security/asset/services/crypto_manager/src/
H A Dhuks_wrapper.c257 struct HksBlob nonce = { NONCE_SIZE, inData->data + (inData->size - NONCE_SIZE) }; in DecryptData() local
267 { .tag = HKS_TAG_NONCE, .blob = nonce }, in DecryptData()
322 struct HksBlob nonce = { NONCE_SIZE, inData->data + (inData->size - NONCE_SIZE) }; in ExecCrypt() local
331 { .tag = HKS_TAG_NONCE, .blob = nonce }, in ExecCrypt()
/base/security/huks/frameworks/huks_standard/main/crypto_engine/mbedtls/src/
H A Dhks_mbedtls_aes.c48 uint8_t *nonce; member
569 aeadParam->nonce.data, in AesEncryptGcm()
570 aeadParam->nonce.size, in AesEncryptGcm()
607 ret = mbedtls_gcm_starts(gcmCtx, MBEDTLS_GCM_ENCRYPT, aeadParam->nonce.data, in AesEncryptGcmInit()
608 aeadParam->nonce.size); in AesEncryptGcmInit()
713 aeadParam->nonce.data, in AesDecryptGcm()
714 aeadParam->nonce.size, in AesDecryptGcm()
750 ret = mbedtls_gcm_starts(gcmCtx, MBEDTLS_GCM_DECRYPT, aeadParam->nonce.data, in AesDecryptGcmInit()
751 aeadParam->nonce.size); in AesDecryptGcmInit()
870 aeadParam->nonce in AesEncryptCcm()
[all...]

Completed in 13 milliseconds

12