/ohos5.0/base/security/crypto_framework/test/unittest/src/aes_cipher/ |
H A D | crypto_aes_gcm_cipher_test.cpp | 58 spec.aad.data = aad; 59 spec.aad.len = sizeof(aad); 112 spec.aad.data = aad; 166 spec.aad.data = aad; 220 spec.aad.data = aad; 274 spec.aad.data = aad; 328 spec.aad.data = aad; 382 spec.aad.data = aad; 435 spec.aad.data = aad; 600 spec.aad.data = aad; [all …]
|
H A D | crypto_aes_ccm_cipher_test.cpp | 57 spec.aad.data = aad; 58 spec.aad.len = sizeof(aad); 110 spec.aad.data = aad; 163 spec.aad.data = aad; 216 spec.aad.data = aad; 269 spec.aad.data = aad; 323 spec.aad.data = aad; 376 spec.aad.data = aad; 428 spec.aad.data = aad; 554 spec.aad.data = aad; [all …]
|
/ohos5.0/base/security/crypto_framework/test/unittest/src/ |
H A D | crypto_sm4_gcm_cipher_test.cpp | 60 spec.aad.data = aad; 61 spec.aad.len = sizeof(aad); 114 spec.aad.data = aad; 168 spec.aad.data = aad; 222 spec.aad.data = aad; 276 spec.aad.data = aad; 330 spec.aad.data = aad; 496 spec.aad.data = aad; 539 spec.aad.data = aad; 635 spec.aad.data = aad; [all …]
|
/ohos5.0/base/security/asset/services/crypto_manager/src/ |
H A D | crypto.rs | 26 …fn EncryptData(keyId: *const KeyId, aad: *const HksBlob, in_data: *const HksBlob, out_data: *mut O… in EncryptData() 27 …fn DecryptData(keyId: *const KeyId, aad: *const HksBlob, in_data: *const HksBlob, out_data: *mut O… in DecryptData() 31 aad: *const HksBlob, in ExecCrypt() 89 …pub fn exec_crypt(&self, cipher: &Vec<u8>, aad: &Vec<u8>, auth_token: &Vec<u8>) -> Result<Vec<u8>>… in exec_crypt() 94 let aad = HksBlob { size: aad.len() as u32, data: aad.as_ptr() }; in exec_crypt() localVariable 104 &aad as *const HksBlob, in exec_crypt() 117 pub fn encrypt(key: &SecretKey, msg: &Vec<u8>, aad: &Vec<u8>) -> Result<Vec<u8>> { in encrypt() 120 let aad_data = HksBlob { size: aad.len() as u32, data: aad.as_ptr() }; in encrypt() 140 pub fn decrypt(key: &SecretKey, cipher: &Vec<u8>, aad: &Vec<u8>) -> Result<Vec<u8>> { in decrypt() 147 let aad_data = HksBlob { size: aad.len() as u32, data: aad.as_ptr() }; in decrypt()
|
H A D | huks_wrapper.h | 48 int32_t EncryptData(const struct KeyId *keyId, const struct HksBlob *aad, const struct HksBlob *inD… 50 int32_t DecryptData(const struct KeyId *keyId, const struct HksBlob *aad, const struct HksBlob *inD… 53 int32_t ExecCrypt(const struct HksBlob *handle, const struct HksBlob *aad, const struct HksBlob *au…
|
H A D | huks_wrapper.c | 217 int32_t EncryptData(const struct KeyId *keyId, const struct HksBlob *aad, const struct HksBlob *inD… in EncryptData() argument 226 { .tag = HKS_TAG_ASSOCIATED_DATA, .blob = *aad }, in EncryptData() 252 int32_t DecryptData(const struct KeyId *keyId, const struct HksBlob *aad, const struct HksBlob *inD… in DecryptData() argument 266 { .tag = HKS_TAG_ASSOCIATED_DATA, .blob = *aad }, in DecryptData() 318 int32_t ExecCrypt(const struct HksBlob *handle, const struct HksBlob *aad, const struct HksBlob *au… in ExecCrypt() argument 330 { .tag = HKS_TAG_ASSOCIATED_DATA, .blob = { .size = aad->size, .data = aad->data } }, in ExecCrypt()
|
/ohos5.0/base/security/device_auth/frameworks/deviceauth_lite/source/auth_info/ |
H A D | auth_info.c | 76 const char *aad, struct uint8_buff *payload) in encrypt_payload() argument 80 if (strcpy_s((char *)aes_aad.aad, sizeof(aes_aad.aad), aad) != EOK) { in encrypt_payload() 83 aes_aad.length = strlen(aad); in encrypt_payload() 94 const char *aad, struct uint8_buff *plain) in decrypt_payload() argument 106 if (strcpy_s((char *)aes_aad.aad, sizeof(aes_aad.aad), aad) != EOK) { in decrypt_payload() 109 aes_aad.length = strlen(aad); in decrypt_payload()
|
/ohos5.0/base/security/crypto_framework/plugin/openssl_plugin/crypto_operation/cipher/src/ |
H A D | cipher_aes_openssl.c | 220 … if ((params->aad.data == NULL) || (params->aad.len == 0) || (params->aad.len > CCM_AAD_MAX_LEN)) { in IsCcmParamsValid() 255 if (params->aad.data != NULL && params->aad.len != 0) { in InitAadAndTagFromGcmParams() 256 data->aad = (uint8_t *)HcfMalloc(params->aad.len, 0); in InitAadAndTagFromGcmParams() 261 (void)memcpy_s(data->aad, params->aad.len, params->aad.data, params->aad.len); in InitAadAndTagFromGcmParams() 265 data->aad = NULL; in InitAadAndTagFromGcmParams() 275 HcfFree(data->aad); in InitAadAndTagFromGcmParams() 276 data->aad = NULL; in InitAadAndTagFromGcmParams() 291 data->aad = (uint8_t *)HcfMalloc(params->aad.len, 0); in InitAadAndTagFromCcmParams() 296 (void)memcpy_s(data->aad, params->aad.len, params->aad.data, params->aad.len); in InitAadAndTagFromCcmParams() 306 HcfFree(data->aad); in InitAadAndTagFromCcmParams() [all …]
|
H A D | cipher_sm4_openssl.c | 184 if (params->aad.data != NULL && params->aad.len != 0) { in InitAadAndTagFromGcmParams() 185 data->aad = (uint8_t *)HcfMalloc(params->aad.len, 0); in InitAadAndTagFromGcmParams() 186 if (data->aad == NULL) { in InitAadAndTagFromGcmParams() 190 (void)memcpy_s(data->aad, params->aad.len, params->aad.data, params->aad.len); in InitAadAndTagFromGcmParams() 191 data->aadLen = params->aad.len; in InitAadAndTagFromGcmParams() 194 data->aad = NULL; in InitAadAndTagFromGcmParams() 204 HcfFree(data->aad); in InitAadAndTagFromGcmParams() 205 data->aad = NULL; in InitAadAndTagFromGcmParams() 417 …int32_t ret = OpensslEvpCipherUpdate(data->ctx, NULL, (int *)&output->len, data->aad, data->aadLen… in AeadUpdate() 545 if (data->aad != NULL && data->aadLen != 0) { in GcmDoFinal()
|
H A D | cipher_aes_common.c | 71 if ((*data)->aad != NULL) { in FreeCipherData() 72 HcfFree((*data)->aad); in FreeCipherData() 73 (*data)->aad = NULL; in FreeCipherData()
|
/ohos5.0/base/security/huks/services/huks_standard/huks_engine/main/core/src/ |
H A D | hks_keyblob.c | 183 aeadParam->aad = *aad; in BuildKeyBlobUsageSpec() 263 return EncryptAndDecryptKeyBlob(aad, paramSet, true); in EncryptKeyBlob() 276 return EncryptAndDecryptKeyBlob(aad, paramSet, false); in DecryptKeyBlob() 409 aad->data = keyBlob; in GetAadAndParamSet() 421 struct HksBlob aad = { 0, NULL }; in HksGenerateKeyNode() local 426 ret = DecryptKeyBlob(&aad, keyBlobParamSet); in HksGenerateKeyNode() 427 HKS_FREE_BLOB(aad); in HksGenerateKeyNode() 522 aeadParam->aad.size = (uint32_t)strlen(aadValue); in HksDecryptAuthToken() 546 ret = EncryptKeyBlob(&aad, keyBlobParamSet); in HksBuildKeyBlob2() 597 return GetAadAndParamSet(inData, aad, paramSet); in HksGetAadAndParamSet() [all …]
|
H A D | hks_keynode.c | 505 static void FreeParamsForBuildKeyNode(struct HksBlob *aad, struct HksParamSet **runtimeParamSet, in FreeParamsForBuildKeyNode() argument 508 if (aad != NULL && aad->data != NULL) { in FreeParamsForBuildKeyNode() 509 HKS_FREE_BLOB(*aad); in FreeParamsForBuildKeyNode() 531 struct HksBlob aad = { 0, NULL }; in HksCreateKeyNode() local 541 ret = HksGetAadAndParamSet(key, &aad, &keyBlobParamSet); in HksCreateKeyNode() 544 ret = HksDecryptKeyBlob(&aad, keyBlobParamSet); in HksCreateKeyNode() 552 FreeParamsForBuildKeyNode(&aad, &runtimeParamSet, &keyBlobParamSet, keyNode); in HksCreateKeyNode() 560 HKS_FREE_BLOB(aad); in HksCreateKeyNode()
|
/ohos5.0/base/security/asset/services/core_service/src/operations/ |
H A D | common.rs | 144 let mut aad = Vec::new(); in build_aad_v1() localVariable 147 Some(Value::Bytes(bytes)) => aad.extend(bytes), in build_aad_v1() 148 Some(Value::Number(num)) => aad.extend(num.to_le_bytes()), in build_aad_v1() 149 Some(Value::Bool(num)) => aad.push(*num as u8), in build_aad_v1() 153 aad in build_aad_v1() 171 let mut aad = Vec::new(); in build_aad_v2() localVariable 173 aad.extend(format!("{}:", column).as_bytes()); in build_aad_v2() 175 Some(Value::Bytes(bytes)) => aad.extend(to_hex(bytes)?), in build_aad_v2() 177 Some(Value::Bool(num)) => aad.push(*num as u8), in build_aad_v2() 180 aad.push(b'_'); in build_aad_v2() [all …]
|
/ohos5.0/base/security/device_auth/frameworks/deviceauth_lite/test/unittest/ |
H A D | huks_adapter_test.cpp | 965 struct aes_aad aad; variable 966 (void)memset_s(&aad, sizeof(aad), 0, sizeof(aad)); 1025 struct aes_aad aad; variable 1026 (void)memset_s(&aad, sizeof(aad), 0, sizeof(aad)); 1027 aad.length = 64; 1051 struct aes_aad aad; variable 1052 (void)memset_s(&aad, sizeof(aad), 0, sizeof(aad)); 1053 aad.length = 1; 1077 struct aes_aad aad; variable 1078 (void)memset_s(&aad, sizeof(aad), 0, sizeof(aad)); [all …]
|
/ohos5.0/base/security/device_auth/services/legacy/authenticators/inc/account_unrelated/iso_task/ |
H A D | iso_task_common.h | 34 int GenerateEncResult(const IsoParams *params, int message, CJson *sendToPeer, const char *aad); 35 int GenEncResult(IsoParams *params, int message, CJson *out, const char *aad, bool isNeedReturnKey); 37 int CheckEncResult(IsoParams *params, const CJson *in, const char *aad);
|
/ohos5.0/base/security/asset/test/unittest/module_test/src/crypto_manager/ |
H A D | lib.rs | 87 let aad = vec![0; AAD_SIZE as usize]; in encrypt_and_decrypt() localVariable 88 let cipher = Crypto::encrypt(&secret_key, &msg, &aad).unwrap(); in encrypt_and_decrypt() 92 let plaintext = Crypto::decrypt(&secret_key, &cipher, &aad).unwrap(); in encrypt_and_decrypt() 121 let aad = vec![0; AAD_SIZE as usize]; in crypto_exec() localVariable 122 let cipher = Crypto::encrypt(&secret_key, &msg, &aad).unwrap(); in crypto_exec() 127 assert!(crypto.exec_crypt(&cipher, &aad, &authtoken).is_err()); in crypto_exec()
|
/ohos5.0/drivers/peripheral/user_auth/hdi_service/adaptor/src/ |
H A D | adaptor_algorithm.c | 295 if (aesGcmParam->aad == NULL) { in CheckAesGcmParam() 299 if (!IsBufferValid(aesGcmParam->aad)) { in CheckAesGcmParam() 302 … if (aesGcmParam->aad->contentSize == 0 || aesGcmParam->aad->contentSize > AES_GCM_AAD_MAX_SIZE) { in CheckAesGcmParam() 324 if (aesGcmParam->aad != NULL) { in SetAesEncryptParam() 327 … (unsigned char *)(aesGcmParam->aad->buf), aesGcmParam->aad->contentSize) != OPENSSL_SUCCESS) { in SetAesEncryptParam() 406 if (aesGcmParam->aad != NULL) { in SetAesDecryptParam() 409 … (unsigned char *)(aesGcmParam->aad->buf), aesGcmParam->aad->contentSize) != OPENSSL_SUCCESS) { in SetAesDecryptParam()
|
/ohos5.0/base/security/huks/test/unittest/huks_standard_test/three_stage_test/src/ |
H A D | hks_chipset_platform_decrypt_test.cpp | 58 .aad = { 88 .aad = { 118 .aad = { 148 .aad = { 180 .aad = { 272 .aad = { 302 .aad = { 332 .aad = { 362 .aad = { 394 .aad = { [all …]
|
/ohos5.0/base/security/huks/test/unittest/huks_standard_test/interface_inner_test/alg_module_test/src/ |
H A D | openssl_aes_helper.c | 242 struct HksParam *aad = NULL; in AesGcmEncrypt() local 243 HksGetParam(paramSetIn, HKS_TAG_ASSOCIATED_DATA, &aad); in AesGcmEncrypt() 267 if (EVP_EncryptUpdate(ctx, NULL, &outLen, aad->blob.data, aad->blob.size) != 1) { in AesGcmEncrypt() 297 struct HksParam *aad = NULL; in AesGcmDecrypt() local 298 HksGetParam(paramSetIn, HKS_TAG_ASSOCIATED_DATA, &aad); in AesGcmDecrypt() 322 if (EVP_DecryptUpdate(ctx, NULL, &outLen, aad->blob.data, aad->blob.size) != 1) { in AesGcmDecrypt()
|
/ohos5.0/base/security/asset/services/db_key_operator/src/ |
H A D | lib.rs | 70 let aad: Vec<u8> = TRIVIAL_AAD_FOR_DB_KEY.as_bytes().to_vec(); in decrypt_db_key_cipher() localVariable 71 let db_key = Crypto::decrypt(&secret_key, db_key_cipher, &aad)?; in decrypt_db_key_cipher() 88 let aad: Vec<u8> = TRIVIAL_AAD_FOR_DB_KEY.as_bytes().to_vec(); in encrypt_db_key() localVariable 89 let db_key_cipher = Crypto::encrypt(&secret_key, &self.db_key, &aad)?; in encrypt_db_key()
|
/ohos5.0/base/security/asset/test/unittest/module_test/src/ |
H A D | huks_wrapper_test.cpp | 109 uint8_t aad[8] = { 0 }; variable 110 struct HksBlob aadData = { 8, aad }; 134 uint8_t aad[8] = { 0 }; variable 135 struct HksBlob aadData = { 8, aad };
|
/ohos5.0/drivers/peripheral/pin_auth/hdi_service/adaptor/src/ |
H A D | adaptor_algorithm.c | 407 if (param->aad == NULL) { in CheckAes256GcmParams() 411 if (!IsBufferValid(param->aad)) { in CheckAes256GcmParams() 415 if ((param->aad->contentSize == 0) || (param->aad->contentSize > AES_GCM_256_AAD_MAX_SIZE)) { in CheckAes256GcmParams() 441 if ((param->aad != NULL) && in SetAesEncryptParam() 442 …(EVP_EncryptUpdate(ctx, NULL, &outLen, param->aad->buf, param->aad->contentSize) != OPENSSL_SUCCES… in SetAesEncryptParam() 542 if ((param->aad != NULL) && in SetAesDecryptParam() 543 …(EVP_DecryptUpdate(ctx, NULL, &outLen, param->aad->buf, param->aad->contentSize) != OPENSSL_SUCCES… in SetAesDecryptParam()
|
/ohos5.0/foundation/filemanagement/storage_service/services/storage_daemon/crypto/src/ |
H A D | base_key.cpp | 74 KeyBlob tempAad(sourceCtx.aad); in DoTempStore() 78 targetCtx.aad = std::move(tempAad); in DoTempStore() 299 !GenerateKeyBlob(keyCtx.aad, GCM_MAC_BYTES)) { in StoreKey() 308 KeyBlob storeKey(keyCtx.nonce.size + keyCtx.rndEnc.size + keyCtx.aad.size); in StoreKey() 309 if (!CombKeyCtx(keyCtx.nonce, keyCtx.rndEnc, keyCtx.aad, storeKey)) { in StoreKey() 635 ctxNone.aad.Alloc(GCM_MAC_BYTES); in StoreKey() 995 keyCtx.aad.Clear(); in StoreKey() 1017 if (nonce.IsEmpty() || aad.IsEmpty() || rndEnc.IsEmpty()) { in StoreKey() 1024 std::vector<uint8_t> aadVct(aad.data.get(), aad.data.get() + aad.size); in StoreKey() 1038 if (keyIn.size < (nonce.size + aad.size)) { in StoreKey() [all …]
|
H A D | huks_master.cpp | 482 ctx.aad = HashWithPrefix("AAD SHA512 prefix", ctx.secDiscard, CRYPTO_AES_AAD_LEN); in AppendNonceAad() 485 { .tag = HKS_TAG_ASSOCIATED_DATA, .blob = { ctx.aad.size, ctx.aad.data.get() } } in AppendNonceAad() 496 { .tag = HKS_TAG_ASSOCIATED_DATA, .blob = { ctx.aad.size, ctx.aad.data.get() } } in AppendNonceAadTokenEx() 503 { .tag = HKS_TAG_ASSOCIATED_DATA, .blob = { ctx.aad.size, ctx.aad.data.get() } }, in AppendNonceAadTokenEx() 516 ctx.aad = HashWithPrefix("AAD SHA512 prefix", ctx.secDiscard, CRYPTO_AES_AAD_LEN); in AppendNewNonceAadToken() 524 { .tag = HKS_TAG_ASSOCIATED_DATA, .blob = {ctx.aad.size, ctx.aad.data.get() } }, in AppendNewNonceAadToken() 539 ctx.aad = HashWithPrefix("AAD SHA512 prefix", ctx.secDiscard, CRYPTO_AES_AAD_LEN); in AppendNonceAadToken() 549 { ctx.aad.size, ctx.aad.data.get() } in AppendNonceAadToken()
|
/ohos5.0/base/security/huks/test/unittest/huks_standard_test/three_stage_test/include/ |
H A D | hks_chipset_platform_test.h | 33 std::vector<uint8_t> aad {}; 63 … { .tag = HKS_TAG_ASSOCIATED_DATA, .blob = { .size = t.aad.size(), .data = t.aad.data() } }, in CipherMaterialsToDecryptInputParams()
|