/base/security/crypto_framework/test/unittest/src/ |
H A D | crypto_sm4_gcm_cipher_test.cpp | 50 uint8_t aad[8] = {0}; in HWTEST_F() local 60 spec.aad.data = aad; in HWTEST_F() 61 spec.aad.len = sizeof(aad); in HWTEST_F() 104 uint8_t aad[8] = {0}; in HWTEST_F() local 114 spec.aad.data = aad; in HWTEST_F() 115 spec.aad.len = sizeof(aad); in HWTEST_F() 158 uint8_t aad[8] = {0}; HWTEST_F() local 212 uint8_t aad[8] = {0}; HWTEST_F() local 266 uint8_t aad[8] = {0}; HWTEST_F() local 320 uint8_t aad[8] = {0}; HWTEST_F() local 442 uint8_t aad[GCM_AAD_LEN] = { 0 }; HWTEST_F() local 486 uint8_t aad[GCM_AAD_LEN] = { 0 }; HWTEST_F() local 529 uint8_t aad[GCM_AAD_LEN] = { 0 }; HWTEST_F() local 625 uint8_t aad[GCM_AAD_LONG_LEN] = { 0 }; HWTEST_F() local 679 uint8_t aad[GCM_AAD_LONG_LEN] = { 0 }; HWTEST_F() local 733 uint8_t aad[GCM_AAD_SHORT_LEN] = { 0 }; HWTEST_F() local 841 uint8_t aad[8] = {0}; HWTEST_F() local 887 uint8_t aad[8] = {0}; HWTEST_F() local [all...] |
/base/security/crypto_framework/test/unittest/src/aes_cipher/ |
H A D | crypto_aes_ccm_cipher_test.cpp | 48 uint8_t aad[8] = {0}; in HWTEST_F() local 57 spec.aad.data = aad; in HWTEST_F() 58 spec.aad.len = sizeof(aad); in HWTEST_F() 101 uint8_t aad[8] = {0}; in HWTEST_F() local 110 spec.aad.data = aad; in HWTEST_F() 111 spec.aad.len = sizeof(aad); in HWTEST_F() 154 uint8_t aad[8] = {0}; HWTEST_F() local 207 uint8_t aad[8] = {0}; HWTEST_F() local 260 uint8_t aad[8] = {0}; HWTEST_F() local 314 uint8_t aad[8] = {0}; HWTEST_F() local 367 uint8_t aad[CCM_AAD_LEN] = { 0 }; HWTEST_F() local 419 uint8_t aad[CCM_AAD_LEN] = { 0 }; HWTEST_F() local 503 uint8_t aad[CCM_AAD_LEN] = { 0 }; HWTEST_F() local 545 uint8_t aad[CCM_AAD_LEN] = { 0 }; HWTEST_F() local 587 uint8_t aad[CCM_AAD_LEN] = { 0 }; HWTEST_F() local [all...] |
H A D | crypto_aes_gcm_cipher_test.cpp | 48 uint8_t aad[8] = {0}; in HWTEST_F() local 58 spec.aad.data = aad; in HWTEST_F() 59 spec.aad.len = sizeof(aad); in HWTEST_F() 102 uint8_t aad[8] = {0}; in HWTEST_F() local 112 spec.aad.data = aad; in HWTEST_F() 113 spec.aad.len = sizeof(aad); in HWTEST_F() 156 uint8_t aad[8] = {0}; HWTEST_F() local 210 uint8_t aad[8] = {0}; HWTEST_F() local 264 uint8_t aad[8] = {0}; HWTEST_F() local 318 uint8_t aad[8] = {0}; HWTEST_F() local 372 uint8_t aad[GCM_AAD_LEN] = { 0 }; HWTEST_F() local 425 uint8_t aad[GCM_AAD_LEN] = { 0 }; HWTEST_F() local 546 uint8_t aad[GCM_AAD_LEN] = { 0 }; HWTEST_F() local 590 uint8_t aad[GCM_AAD_LEN] = { 0 }; HWTEST_F() local 633 uint8_t aad[GCM_AAD_LEN] = { 0 }; HWTEST_F() local 729 uint8_t aad[GCM_AAD_LONG_LEN] = { 0 }; HWTEST_F() local 783 uint8_t aad[GCM_AAD_LONG_LEN] = { 0 }; HWTEST_F() local 837 uint8_t aad[GCM_AAD_SHORT_LEN] = { 0 }; HWTEST_F() local 945 uint8_t aad[8] = {0}; HWTEST_F() local 991 uint8_t aad[8] = {0}; HWTEST_F() local [all...] |
/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() 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() 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() 75 encrypt_payload(const struct var_buffer *key, const struct uint8_buff *plain, const char *aad, struct uint8_buff *payload) encrypt_payload() argument 93 decrypt_payload(const struct var_buffer *key, const struct uint8_buff *payload, const char *aad, struct uint8_buff *plain) decrypt_payload() argument [all...] |
/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 OutBlob) -> i32; in EncryptData() 27 fn DecryptData(keyId: *const KeyId, aad: *const HksBlob, in_data: *const HksBlob, out_data: *mut OutBlob) -> i32; 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() 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 in encrypt() [all...] |
H A D | huks_wrapper.h | 48 int32_t EncryptData(const struct KeyId *keyId, const struct HksBlob *aad, const struct HksBlob *inData, 50 int32_t DecryptData(const struct KeyId *keyId, const struct HksBlob *aad, const struct HksBlob *inData, 53 int32_t ExecCrypt(const struct HksBlob *handle, const struct HksBlob *aad, const struct HksBlob *authToken,
|
/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);
|
/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() 221 LOGE("aad is invalid!"); 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() 257 if (data->aad == NULL) { in InitAadAndTagFromGcmParams() 258 LOGE("aad mallo in InitAadAndTagFromGcmParams() [all...] |
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()
|
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() 187 LOGE("aad malloc failed!"); in InitAadAndTagFromGcmParams() 190 (void)memcpy_s(data->aad, params->aad.len, params->aad.data, params->aad in InitAadAndTagFromGcmParams() [all...] |
/base/security/huks/services/huks_standard/huks_engine/main/core/src/ |
H A D | hks_keyblob.c | 169 static int32_t BuildKeyBlobUsageSpec(const struct HksBlob *aad, const struct HksParam *keyParam,
in BuildKeyBlobUsageSpec() argument 183 aeadParam->aad = *aad;
in BuildKeyBlobUsageSpec() 197 static int32_t EncryptAndDecryptKeyBlob(const struct HksBlob *aad, struct HksParamSet *paramSet, bool isEncrypt)
in EncryptAndDecryptKeyBlob() argument 211 ret = BuildKeyBlobUsageSpec(aad, keyParam, isEncrypt, usageSpec);
in EncryptAndDecryptKeyBlob() 256 * which use |-inParamSet-|-version-|-osVersion-|-patchLevel-| as aad
261 static int32_t EncryptKeyBlob(const struct HksBlob *aad, struct HksParamSet *paramSet)
in EncryptKeyBlob() argument 263 return EncryptAndDecryptKeyBlob(aad, paramSet, true);
in EncryptKeyBlob() 269 * which use |-inParamSet-|-version-|-osVersion-|-patchLevel-| as aad
274 static int32_t DecryptKeyBlob(const struct HksBlob *aad, struc argument 376 GetAadAndParamSet(const struct HksBlob *inData, struct HksBlob *aad, struct HksParamSet **paramSet) GetAadAndParamSet() argument 421 struct HksBlob aad = { 0, NULL }; HksGenerateKeyNode() local 545 struct HksBlob aad = { keyBlobParamSet->paramSetSize - keyParam->blob.size, (uint8_t *)keyBlobParamSet }; HksBuildKeyBlob2() local 595 HksGetAadAndParamSet(const struct HksBlob *inData, struct HksBlob *aad, struct HksParamSet **paramSet) HksGetAadAndParamSet() argument 600 HksDecryptKeyBlob(const struct HksBlob *aad, struct HksParamSet *paramSet) HksDecryptKeyBlob() argument [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() 542 HKS_IF_NOT_SUCC_LOGE_BREAK(ret, "get aad and paramSet failed") in HksCreateKeyNode() 544 ret = HksDecryptKeyBlob(&aad, keyBlobParamSet); in HksCreateKeyNode() 552 FreeParamsForBuildKeyNode(&aad, &runtimeParamSet, &keyBlobParamSet, keyNode); in HksCreateKeyNode() 560 HKS_FREE_BLOB(aad); in HksCreateKeyNode() [all...] |
/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() 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() 89 let db_key_cipher = Crypto::encrypt(&secret_key, &self.db_key, &aad)?; in encrypt_db_key()
|
/base/security/asset/test/unittest/module_test/src/ |
H A D | huks_wrapper_test.cpp | 109 uint8_t aad[8] = { 0 }; in HWTEST_F() local 110 struct HksBlob aadData = { 8, aad }; in HWTEST_F() 134 uint8_t aad[8] = { 0 }; in HWTEST_F() local 135 struct HksBlob aadData = { 8, aad }; in HWTEST_F()
|
/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() 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() 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()
|
/base/security/device_auth/frameworks/deviceauth_lite/inc/auth_info/ |
H A D | auth_info.h | 60 const char *aad, struct uint8_buff *payload); 62 const char *aad, struct uint8_buff *plain);
|
/base/security/device_auth/frameworks/deviceauth_lite/test/unittest/ |
H A D | auth_info_test.h | 64 const char *aad, struct uint8_buff *payload); 66 const char *aad, struct uint8_buff *plain);
|
H A D | huks_adapter_test.cpp | 940 struct aes_aad aad= {64, {0}}; in HWTEST_F() local 946 int32_t result = aes_gcm_encrypt(&key, &message, &aad, &out_plain); in HWTEST_F() 949 result = aes_gcm_encrypt(&key, &message, &aad, &out_plain); in HWTEST_F() 965 struct aes_aad aad; in HWTEST_F() local 966 (void)memset_s(&aad, sizeof(aad), 0, sizeof(aad)); in HWTEST_F() 971 int32_t result = aes_gcm_encrypt(nullptr, &message, &aad, &out_plain); in HWTEST_F() 973 result = aes_gcm_encrypt(&key, nullptr, &aad, &out_plain); in HWTEST_F() 977 result = aes_gcm_encrypt(&key, &message, &aad, nullpt in HWTEST_F() 1001 struct aes_aad aad = {1, {1}}; HWTEST_F() local 1025 struct aes_aad aad; HWTEST_F() local 1051 struct aes_aad aad; HWTEST_F() local 1077 struct aes_aad aad; HWTEST_F() local [all...] |
/base/security/huks/services/huks_standard/huks_engine/main/core/include/ |
H A D | hks_keyblob.h | 80 int32_t HksGetAadAndParamSet(const struct HksBlob *inData, struct HksBlob *aad, struct HksParamSet **paramSet); 82 int32_t HksDecryptKeyBlob(const struct HksBlob *aad, struct HksParamSet *paramSet);
|
/base/security/crypto_framework/interfaces/inner_api/algorithm_parameter/ |
H A D | detailed_ccm_params.h | 28 HcfBlob aad; member
|
H A D | detailed_gcm_params.h | 28 HcfBlob aad; member
|
/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()
|
/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()
|
/base/security/crypto_framework/frameworks/native/src/ |
H A D | sym_cipher.c | 49 HcfBlob aad; member 83 params->aad.data = value->data; in OH_CryptoSymCipherParams_SetParam() 84 params->aad.len = value->len; in OH_CryptoSymCipherParams_SetParam()
|
/base/security/device_auth/frameworks/deviceauth_lite/inc/huks_adapter/ |
H A D | huks_adapter.h | 263 * @param aad: aad for encrypt 268 struct aes_aad *aad, struct uint8_buff *out_cipher); 275 * @param aad: aad for encrypt 280 struct aes_aad *aad, struct uint8_buff *out_plain); 286 struct aes_aad *aad, struct uint8_buff *out_plain);
|