Home
last modified time | relevance | path

Searched refs:nonce (Results 1 – 25 of 41) 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()
112 ret = DefaultVerifyDslmCred(&device->identity, device->nonce, cred, &device->credInfo); in VerifyDeviceInfoResponse()
116 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/common/
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_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_bind_exchange_task.c65 …GOTO_ERR_AND_SET_RET(PackageNonceAndCipherToJson(&(realTask->params.nonce), &(realTask->params.exI… in ExchangeRequest()
95 int res = ParseNonceAndCipherFromJson(&(realTask->params.nonce), 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 …]
/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 __anon08eb12f90102()
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 __anon08eb12f90202()
127 std::vector<uint8_t> nonce = {1, 3, 2, 5, 7}; variable
131 auto fillUpChallenge = [&nonce](std::vector<uint8_t> &challenge) { challenge = nonce; }; in __anon08eb12f90302()
/base/security/device_auth/services/authenticators/inc/account_unrelated/pake_task/
Dstandard_exchange_message_util.h27 int32_t PackageNonceAndCipherToJson(const Uint8Buff *nonce, const Uint8Buff *cipher, CJson *data, c…
28 int32_t ParseNonceAndCipherFromJson(Uint8Buff *nonce, Uint8Buff *cipher, const CJson *in, const cha…
Dpake_base_cur_task.h37 Uint8Buff nonce; member
Dcommon_standard_bind_exchange.h32 Uint8Buff nonce; member
/base/security/device_auth/services/session_manager/src/session/v2/expand_sub_session/
Dexpand_sub_session.c53 Uint8Buff nonce; member
104 GcmParam gcmParam = { impl->nonce.val, impl->nonce.length, in EncryptMsg()
127 GcmParam gcmParam = { impl->nonce.val, impl->nonce.length, in DecryptMsg()
488 ClearFreeUint8Buff(&(impl->nonce)); in DestroyExpandSubSession()
499 int32_t CreateExpandSubSession(const Uint8Buff *nonce, const Uint8Buff *encKey, ExpandSubSession **… in CreateExpandSubSession() argument
501 if ((nonce == NULL) || (nonce->val == NULL)) { in CreateExpandSubSession()
518 if (DeepCopyUint8Buff(nonce, &(impl->nonce)) != HC_SUCCESS) { in CreateExpandSubSession()
525 ClearFreeUint8Buff(&impl->nonce); in CreateExpandSubSession()
/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/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()
/base/security/device_auth/services/session_manager/inc/session/v2/expand_sub_session/
Dexpand_sub_session.h42 int32_t CreateExpandSubSession(const Uint8Buff *nonce, const Uint8Buff *encKey, ExpandSubSession **…
/base/security/huks/services/huks_standard/huks_engine/main/core/src/
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()
519 aeadParam->nonce.data = authToken->iv; in HksDecryptAuthToken()
520 aeadParam->nonce.size = sizeof(authToken->iv); in HksDecryptAuthToken()
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()
/base/security/device_auth/test/unittest/deviceauth/source/
Dstandard_exchange_task_test.cpp110 exchangeParams.nonce.val = nonceVal;
111 exchangeParams.nonce.length = NONCE_LENGTH;
/base/security/huks/frameworks/huks_standard/main/crypto_engine/mbedtls/src/
Dhks_mbedtls_aes.c48 uint8_t *nonce; member
558 aeadParam->nonce.data, in AesEncryptGcm()
559 aeadParam->nonce.size, in AesEncryptGcm()
596 ret = mbedtls_gcm_starts(gcmCtx, MBEDTLS_GCM_ENCRYPT, aeadParam->nonce.data, in AesEncryptGcmInit()
597 aeadParam->nonce.size); in AesEncryptGcmInit()
702 aeadParam->nonce.data, in AesDecryptGcm()
703 aeadParam->nonce.size, in AesDecryptGcm()
739 ret = mbedtls_gcm_starts(gcmCtx, MBEDTLS_GCM_DECRYPT, aeadParam->nonce.data, in AesDecryptGcmInit()
740 aeadParam->nonce.size); in AesDecryptGcmInit()
859 aeadParam->nonce.data, in AesEncryptCcm()
[all …]
/base/security/huks/test/unittest/huks_standard_test/module_test/framework_test/common_test/src/
Dhks_base_check_test.cpp327 struct HksBlob nonce = { .size = strlen(aadData), .data = (uint8_t *)nonceData }; variable
328 struct HksParam param = { .tag = HKS_TAG_NONCE, .blob = nonce };

12