/ohos5.0/base/security/device_security_level/oem_property/ohos/common/ |
H A D | dslm_ohos_verify.c | 82 …StringToByte(challengeStr, strlen(challengeStr), (uint8_t *)&nonce->challenge, sizeof(nonce->chall… in ParseNonceOfCertChain() 95 if (nonce->pbkInfoList == NULL) { in ParseNonceOfCertChain() 102 FREE(nonce->pbkInfoList); in ParseNonceOfCertChain() 103 nonce->pbkInfoList = NULL; in ParseNonceOfCertChain() 113 if (nonce == NULL) { in FreeNonceOfCertChain() 116 if (nonce->pbkInfoList != NULL) { in FreeNonceOfCertChain() 117 FREE(nonce->pbkInfoList); in FreeNonceOfCertChain() 118 nonce->pbkInfoList = NULL; in FreeNonceOfCertChain() 156 if (challenge != nonce->challenge) { in CheckNonceOfCertChain() 172 struct NonceOfCertChain nonce; in VerifyNonceOfCertChain() local [all …]
|
/ohos5.0/base/security/device_auth/services/legacy/authenticators/src/account_unrelated/pake_task/standard_exchange_task/ |
H A D | standard_exchange_message_util.c | 25 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()
|
H A D | common_standard_bind_exchange.c | 46 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.val, in EncryptAuthAndSignInfo() 258 .nonceLen = exchangeParams->nonce.length in EncryptAuthAndSignInfo() 291 .nonce = exchangeParams->nonce.val, in DecryptAuthAndSignInfo() [all …]
|
/ohos5.0/base/security/device_security_level/services/dslm/ |
H A D | dslm_inner_process.c | 45 …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() 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 == 0) { in VerifyDeviceInfoResponse() 114 ret = DefaultVerifyDslmCred(&device->identity, device->nonce, cred, &device->credInfo); in VerifyDeviceInfoResponse() 118 SECURITY_LOG_INFO("challenge is %{public}x***, ret is %{public}d", (uint32_t)nonce, ret); in VerifyDeviceInfoResponse()
|
H A D | dslm_msg_utils.c | 56 char *nonce = &challengeStr[0]; in GenerateSecInfoResponseJson() local 57 …DslmByteToHexString((uint8_t *)&challenge, sizeof(challenge), (uint8_t *)nonce, CHALLENGE_STRING_L… 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_L… in GenerateSecInfoRequestJson() 101 DslmAddFieldStringToJson(body, FIELD_CHALLENGE, nonce); in GenerateSecInfoRequestJson()
|
/ohos5.0/base/security/device_auth/services/legacy/authenticators/src/account_unrelated/iso_task/lite_exchange_task/ |
H A D | iso_client_bind_exchange_task.c | 54 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() 114 Uint8Buff nonceBuf = { nonce, NONCE_SIZE }; in DecAndImportAuthCode() 121 HcFree(nonce); in DecAndImportAuthCode() 163 uint8_t **encData, uint8_t **nonce) in ClientBindAesEncrypt() argument 172 if (*nonce == NULL) { in ClientBindAesEncrypt() 189 gcmParams.nonce = *nonce; in ClientBindAesEncrypt() 208 uint8_t *nonce = NULL; in ClientBindExchangeStart() local [all …]
|
H A D | iso_server_bind_exchange_task.c | 81 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() 189 uint8_t *nonce = NULL; in GenerateAuthCodeAndImport() local 194 nonce = (uint8_t *)HcMalloc(NONCE_SIZE, 0); in GenerateAuthCodeAndImport() 195 if (nonce == NULL) { in GenerateAuthCodeAndImport() 205 Uint8Buff nonceBuf = { nonce, NONCE_SIZE }; in GenerateAuthCodeAndImport() [all …]
|
/ohos5.0/base/useriam/user_auth_framework/test/unittest/services/src/ |
H A D | user_idm_session_controller_test.cpp | 86 std::vector<uint8_t> nonce = {1, 3, 2, 5, 7}; variable 90 auto fillUpChallenge = [&nonce](std::vector<uint8_t> &challenge) { challenge = nonce; }; in __anonad6838d20102() 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 __anonad6838d20202() 127 std::vector<uint8_t> nonce = {1, 3, 2, 5, 7}; variable 131 auto fillUpChallenge = [&nonce](std::vector<uint8_t> &challenge) { challenge = nonce; }; in __anonad6838d20302()
|
/ohos5.0/foundation/filemanagement/storage_service/services/storage_daemon/crypto/src/ |
H A D | base_key.cpp | 75 KeyBlob tempNonce(sourceCtx.nonce); in DoTempStore() 79 targetCtx.nonce = std::move(tempNonce); in DoTempStore() 298 if (!GenerateKeyBlob(keyCtx.nonce, GCM_NONCE_BYTES) || in StoreKey() 636 ctxNone.nonce.Alloc(GCM_NONCE_BYTES); in StoreKey() 986 nonce.Alloc(keyIn.size - start); in StoreKey() 996 keyCtx.nonce.Clear(); in StoreKey() 1022 std::vector<uint8_t> nonceVct(nonce.data.get(), nonce.data.get() + nonce.size); in StoreKey() 1038 if (keyIn.size < (nonce.size + aad.size)) { in StoreKey() 1043 rndEnc.Alloc(keyIn.size - nonce.size - aad.size); in StoreKey() 1045 std::copy(keyInVct.begin(), keyInVct.begin() + nonce.size, nonce.data.get()); in StoreKey() [all …]
|
H A D | huks_master.cpp | 481 ctx.nonce = HashWithPrefix("NONCE SHA512 prefix", ctx.secDiscard, CRYPTO_AES_NONCE_LEN); in AppendNonceAad() 484 { .tag = HKS_TAG_NONCE, .blob = { ctx.nonce.size, ctx.nonce.data.get() } }, in AppendNonceAad() 495 { .tag = HKS_TAG_NONCE, .blob = { ctx.nonce.size, ctx.nonce.data.get() } }, in AppendNonceAadTokenEx() 502 { .tag = HKS_TAG_NONCE, .blob = { ctx.nonce.size, ctx.nonce.data.get() } }, in AppendNonceAadTokenEx() 513 ctx.nonce = HuksMaster::GenerateRandomKey(CRYPTO_HKS_NONCE_LEN); in AppendNewNonceAadToken() 514 LOGI("Encrypt generate new nonce size: %{public}d", ctx.nonce.size); in AppendNewNonceAadToken() 523 { .tag = HKS_TAG_NONCE, .blob = { ctx.nonce.size, ctx.nonce.data.get() } }, in AppendNewNonceAadToken() 538 ctx.nonce = HashWithPrefix("NONCE SHA512 prefix", auth.secret, CRYPTO_AES_NONCE_LEN); in AppendNonceAadToken() 545 { ctx.nonce.size, ctx.nonce.data.get() } in AppendNonceAadToken()
|
/ohos5.0/foundation/communication/wifi/wifi/test/wifi_utils/unittest/ |
H A D | wifi_common_util_test.cpp | 105 std::vector<uint8_t> nonce(str.begin(), str.end()); variable 106 uint8_t autsLen = nonce.size(); 107 Byte2HexString(&nonce[offset], autsLen, autsBuf, sizeof(autsBuf)); 116 std::vector<uint8_t> nonce(str.begin(), str.end()); variable 117 uint8_t autsLen = nonce.size(); 137 std::vector<uint8_t> nonce(srcStr.begin(), srcStr.end()); variable 138 uint8_t autsLen = nonce.size(); 139 Byte2HexString(&nonce[0], autsLen, autsBuf, sizeof(autsBuf));
|
/ohos5.0/base/security/device_auth/services/session_manager/src/session/v2/expand_sub_session/ |
H A D | expand_sub_session.c | 54 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 **… in CreateExpandSubSession() argument 505 if ((nonce == NULL) || (nonce->val == NULL)) { in CreateExpandSubSession() 522 if (DeepCopyUint8Buff(nonce, &(impl->nonce)) != HC_SUCCESS) { in CreateExpandSubSession() 529 ClearFreeUint8Buff(&impl->nonce); in CreateExpandSubSession()
|
/ohos5.0/foundation/communication/wifi/wifi/services/wifi_standard/wifi_framework/wifi_toolkit/utils/ |
H A D | wifi_encryption_util.cpp | 98 uint8_t nonce[NONCE_SIZE] = {0}; in WifiEncryption() local 99 struct HksBlob randomIV = {NONCE_SIZE, nonce}; in WifiEncryption() 106 { .tag = HKS_TAG_NONCE, .blob = { .size = NONCE_SIZE, .data = nonce } }, in WifiEncryption() 134 encryptedData.IV = ConvertArrayToHex(nonce, NONCE_SIZE); in WifiEncryption() 153 uint8_t nonce[NONCE_SIZE] = {0}; in WifiDecryption() local 155 retStrToArrat = HexStringToVec(encryptedData.IV, nonce, NONCE_SIZE, lengthIV); in WifiDecryption() 160 { .tag = HKS_TAG_NONCE, .blob = { .size = NONCE_SIZE, .data = nonce } }, in WifiDecryption() 320 uint8_t nonce[AES_256_NONCE_SIZE] = { 0 }; in EncryptParamSet() local 326 struct HksBlob encryptNonce = { nonceLength, nonce }; in EncryptParamSet() 349 uint8_t nonce[AES_256_NONCE_SIZE] = { 0 }; in DecryptParamSet() local [all …]
|
/ohos5.0/base/security/device_auth/services/legacy/authenticators/src/account_unrelated/iso_task/iso_task_common/ |
H A D | iso_task_common.c | 88 uint8_t nonce[NONCE_SIZE] = { 0 }; in GenerateEncResult() local 89 Uint8Buff nonceBuf = { nonce, sizeof(nonce) }; 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 = (uint8_t *)HcMalloc(NONCE_SIZE, 0); in CheckEncResult() 227 if (nonce == NULL) { in CheckEncResult() 231 GOTO_ERR_AND_SET_RET(GetByteFromJson(in, FIELD_NONCE, nonce, NONCE_SIZE), res); in CheckEncResult() 243 gcmParam.nonce = nonce; in CheckEncResult() 257 HcFree(nonce); in CheckEncResult()
|
/ohos5.0/base/security/device_auth/services/legacy/authenticators/src/account_unrelated/pake_task/ |
H A D | pake_task_common.c | 242 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() 249 params->nonce.length = 0; in FillNonce() 250 params->nonce.val = NULL; in FillNonce()
|
H A D | pake_message_util.c | 96 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()
|
/ohos5.0/base/security/device_auth/services/legacy/authenticators/inc/account_unrelated/pake_task/ |
H A D | standard_exchange_message_util.h | 27 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…
|
/ohos5.0/foundation/communication/bluetooth_service/services/bluetooth/service/src/obex/ |
H A D | obex_utils.cpp | 240 std::string nonce = timeStamp + ":" + priKey; in MakeNonce() local 244 return digest->Digest((uint8_t *)nonce.data(), nonce.size()); in MakeNonce() 247 std::vector<uint8_t> ObexUtils::MakeRequestDigest(const uint8_t *nonce, int sz, const std::string &… in MakeRequestDigest() argument 252 (void)memcpy_s(nonceBuf, sizeof(nonceBuf), nonce, sz); in MakeRequestDigest()
|
/ohos5.0/base/security/huks/services/huks_standard/huks_engine/main/core/src/ |
H A D | hks_keyblob.c | 45 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()
|
H A D | hks_keyblob_lite.c | 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() 115 HKS_FREE(nonce.data); in BuildKeyBlobUsageSpec() 126 aeadParam->nonce = nonce; in BuildKeyBlobUsageSpec() 179 HKS_FREE_BLOB(aeadParam.nonce); in EncryptAndDecryptKeyBlob()
|
/ohos5.0/foundation/filemanagement/storage_service/services/storage_daemon/include/crypto/ |
H A D | base_key.h | 109 … bool CombKeyCtx(const KeyBlob &nonce, const KeyBlob &rndEnc, const KeyBlob &aad, KeyBlob &keyOut); 110 bool SplitKeyCtx(const KeyBlob &keyIn, KeyBlob &nonce, KeyBlob &rndEnc, KeyBlob &aad); 112 void SplitKeyBlob(const KeyBlob &keyIn, KeyBlob &encAad, KeyBlob &nonce, uint32_t start);
|
/ohos5.0/base/security/huks/frameworks/huks_standard/main/crypto_engine/mbedtls/src/ |
H A D | hks_mbedtls_aes.c | 48 uint8_t *nonce; member 558 aeadParam->nonce.data, in AesEncryptGcm() 559 aeadParam->nonce.size, in AesEncryptGcm() 601 aeadParam->nonce.size); in AesEncryptGcmInit() 735 aeadParam->nonce.data, in AesDecryptGcm() 736 aeadParam->nonce.size, in AesDecryptGcm() 777 aeadParam->nonce.size); in AesDecryptGcmInit() 885 aeadParam->nonce.data, in AesEncryptCcm() 886 aeadParam->nonce.size, in AesEncryptCcm() 926 aeadParam->nonce.data, in AesDecryptCcm() [all …]
|
/ohos5.0/foundation/communication/wifi/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta/ |
H A D | sta_state_machine.cpp | 2304 std::vector<uint8_t> nonce; in GetGsmAuthResponseWithLength() local 2305 if (!DecodeBase64(response, nonce)) { in GetGsmAuthResponseWithLength() 2311 uint8_t sresLen = nonce[0]; in GetGsmAuthResponseWithLength() 2312 if (sresLen >= nonce.size()) { in GetGsmAuthResponseWithLength() 2326 if (kcOffset >= nonce.size()) { in GetGsmAuthResponseWithLength() 2330 uint8_t kcLen = nonce[kcOffset]; in GetGsmAuthResponseWithLength() 2397 std::vector<uint8_t> nonce; in GetGsmAuthResponseWithoutLength() local 2398 if (!DecodeBase64(response, nonce)) { in GetGsmAuthResponseWithoutLength() 2415 if (kcOffset >= nonce.size()) { in GetGsmAuthResponseWithoutLength() 2637 std::vector<uint8_t> nonce; in DealWpaEapUmtsAuthEvent() local [all …]
|
/ohos5.0/base/security/device_auth/frameworks/deviceauth_lite/test/unittest/unittest_mock/ |
H A D | huks_adapter_mock.c | 469 struct random_value *nonce, struct aes_aad *aad, uint32_t key_byte_size) in init_aes_gcm_encrypt_param_set() argument 486 .blob = { nonce->length, nonce->random_value } in init_aes_gcm_encrypt_param_set() 509 struct random_value nonce = generate_random(HC_AES_GCM_NONCE_LEN); in aes_gcm_encrypt() local 510 if (nonce.length == 0) { in aes_gcm_encrypt() 518 if (memcpy_s(out_cipher->val, out_cipher->size, nonce.random_value, nonce.length) != EOK) { in aes_gcm_encrypt() 523 struct HksBlob tag_cipher = { out_cipher->size - nonce.length, out_cipher->val + nonce.length }; in aes_gcm_encrypt() 525 int32_t status = init_aes_gcm_encrypt_param_set(¶m_set, &nonce, aad, hks_key.size); in aes_gcm_encrypt() 538 out_cipher->length = tag_cipher.size + nonce.length; in aes_gcm_encrypt()
|
/ohos5.0/base/security/device_auth/test/fuzztest/authenticators/account_unrelated/pake/standardexchangetask_fuzzer/ |
H A D | standardexchangetask_fuzzer.cpp | 110 exchangeParams.nonce.val = nonceVal; in StandardExchangeTaskTest003() 111 exchangeParams.nonce.length = NONCE_LENGTH; in StandardExchangeTaskTest003()
|