Home
last modified time | relevance | path

Searched refs:cipher (Results 1 – 25 of 58) sorted by relevance

123

/base/security/crypto_framework/test/unittest/src/
Dcrypto_rsa_cipher_test.cpp161 HcfCipher *cipher = nullptr; variable
162 res = HcfCipherCreate("RSA1024|NoPadding", &cipher);
164 EXPECT_NE(cipher, nullptr);
165 EXPECT_NE(cipher->base.getClass(), nullptr);
166 EXPECT_NE(cipher->base.destroy, nullptr);
167 EXPECT_NE(cipher->init, nullptr);
168 EXPECT_NE(cipher->update, nullptr);
169 EXPECT_NE(cipher->doFinal, nullptr);
170 EXPECT_NE(cipher->getAlgorithm, nullptr);
171 HcfObjDestroy(cipher);
[all …]
Dcrypto_sm2_cipher_test.cpp80 HcfCipher *cipher = nullptr; variable
81 res = HcfCipherCreate("SM2|SM3", &cipher);
83 EXPECT_NE(cipher, nullptr);
84 EXPECT_NE(cipher->base.getClass(), nullptr);
85 EXPECT_NE(cipher->base.destroy, nullptr);
86 EXPECT_NE(cipher->init, nullptr);
87 EXPECT_NE(cipher->update, nullptr);
88 EXPECT_NE(cipher->doFinal, nullptr);
89 EXPECT_NE(cipher->getAlgorithm, nullptr);
90 HcfObjDestroy(cipher);
[all …]
Dcrypto_sm4_cipher_test.cpp96 static int32_t Sm4EncryptWithInput(HcfCipher *cipher, HcfSymKey *key, HcfBlob *input, in Sm4EncryptWithInput() argument
101 int32_t ret = cipher->init(cipher, ENCRYPT_MODE, &(key->key), nullptr); in Sm4EncryptWithInput()
107 ret = cipher->update(cipher, input, &output); in Sm4EncryptWithInput()
121 ret = cipher->doFinal(cipher, nullptr, &output); in Sm4EncryptWithInput()
139 static int32_t Sm4DecryptEmptyMsg(HcfCipher *cipher, HcfSymKey *key, HcfParamsSpec *params, in Sm4DecryptEmptyMsg() argument
144 int32_t ret = cipher->init(cipher, DECRYPT_MODE, &(key->key), params); in Sm4DecryptEmptyMsg()
150 ret = cipher->doFinal(cipher, &input, &output); in Sm4DecryptEmptyMsg()
165 static int32_t Sm4Encrypt(HcfCipher *cipher, HcfSymKey *key, HcfParamsSpec *params, in Sm4Encrypt() argument
172 int32_t ret = cipher->init(cipher, ENCRYPT_MODE, (HcfKey *)key, params); in Sm4Encrypt()
178 ret = cipher->update(cipher, &input, &output); in Sm4Encrypt()
[all …]
Dcrypto_3des_cipher_test.cpp73 static int32_t DesEncrypt(HcfCipher *cipher, HcfSymKey *key, HcfParamsSpec *params, in DesEncrypt() argument
80 int32_t ret = cipher->init(cipher, ENCRYPT_MODE, (HcfKey *)key, params); in DesEncrypt()
86 ret = cipher->update(cipher, &input, &output); in DesEncrypt()
100 ret = cipher->doFinal(cipher, nullptr, &output); in DesEncrypt()
116 static int32_t DesDecrypt(HcfCipher *cipher, HcfSymKey *key, HcfParamsSpec *params, in DesDecrypt() argument
123 int32_t ret = cipher->init(cipher, DECRYPT_MODE, (HcfKey *)key, params); in DesDecrypt()
129 ret = cipher->update(cipher, &input, &output); in DesDecrypt()
143 ret = cipher->doFinal(cipher, nullptr, &output); in DesDecrypt()
163 static int32_t DesNoUpdateEncrypt(HcfCipher *cipher, HcfSymKey *key, HcfParamsSpec *params, in DesNoUpdateEncrypt() argument
170 int32_t ret = cipher->init(cipher, ENCRYPT_MODE, (HcfKey *)key, params); in DesNoUpdateEncrypt()
[all …]
Dcrypto_aes_cipher_test.cpp184 static int32_t AesMultiBlockEncrypt(HcfCipher *cipher, HcfSymKey *key, HcfParamsSpec *params) in AesMultiBlockEncrypt() argument
198 int32_t ret = cipher->init(cipher, ENCRYPT_MODE, (HcfKey *)key, params); in AesMultiBlockEncrypt()
205 ret = cipher->update(cipher, &input, &output); in AesMultiBlockEncrypt()
218 ret = cipher->doFinal(cipher, nullptr, &output); in AesMultiBlockEncrypt()
238 static int32_t AesMultiBlockDecrypt(HcfCipher *cipher, HcfSymKey *key, HcfParamsSpec *params) in AesMultiBlockDecrypt() argument
252 int32_t ret = cipher->init(cipher, DECRYPT_MODE, (HcfKey *)key, params); in AesMultiBlockDecrypt()
259 ret = cipher->update(cipher, &input, &output); in AesMultiBlockDecrypt()
272 ret = cipher->doFinal(cipher, nullptr, &output); in AesMultiBlockDecrypt()
293 static int32_t AesEncryptWithInput(HcfCipher *cipher, HcfSymKey *key, HcfBlob *input, in AesEncryptWithInput() argument
298 int32_t ret = cipher->init(cipher, ENCRYPT_MODE, &(key->key), nullptr); in AesEncryptWithInput()
[all …]
/base/security/crypto_framework/test/fuzztest/crypto_operation/hcfciphercreate_fuzzer/
Dhcfciphercreate_fuzzer.cpp33 static int32_t AesEncrypt(HcfCipher *cipher, HcfSymKey *key, HcfParamsSpec *params, in AesEncrypt() argument
40 int32_t ret = cipher->init(cipher, ENCRYPT_MODE, &(key->key), params); in AesEncrypt()
45 ret = cipher->update(cipher, &input, &output); in AesEncrypt()
57 ret = cipher->doFinal(cipher, nullptr, &output); in AesEncrypt()
72 static int32_t AesDecrypt(HcfCipher *cipher, HcfSymKey *key, HcfParamsSpec *params, in AesDecrypt() argument
79 int32_t ret = cipher->init(cipher, DECRYPT_MODE, &(key->key), params); in AesDecrypt()
84 ret = cipher->update(cipher, &input, &output); in AesDecrypt()
97 ret = cipher->doFinal(cipher, nullptr, &output); in AesDecrypt()
121 HcfCipher *cipher = nullptr; in TestAesCipher() local
132 ret = HcfCipherCreate("AES128|ECB|NoPadding", &cipher); in TestAesCipher()
[all …]
/base/security/device_auth/frameworks/deviceauth_lite/source/struct/
Dadd_auth_info_request.c50 add_auth_info_request->cipher.length = len_add_auth_info / BYTE_TO_HEX_OPER_LENGTH; in parse_add_auth_info_request()
51 add_auth_info_request->cipher.size = add_auth_info_request->cipher.length; in parse_add_auth_info_request()
52 add_auth_info_request->cipher.val = (uint8_t *)MALLOC(add_auth_info_request->cipher.size); in parse_add_auth_info_request()
54 if (add_auth_info_request->cipher.val == NULL) { in parse_add_auth_info_request()
58 (void)memset_s(add_auth_info_request->cipher.val, add_auth_info_request->cipher.size, in parse_add_auth_info_request()
59 0, add_auth_info_request->cipher.size); in parse_add_auth_info_request()
60 …if (hex_string_to_byte(add_auth_info, len_add_auth_info, add_auth_info_request->cipher.val) != HC_… in parse_add_auth_info_request()
75 if (data->cipher.val != NULL) { in free_add_auth_info_request()
76 FREE(data->cipher.val); in free_add_auth_info_request()
86 uint8_t *tmp_data_hex = raw_byte_to_hex_string(add_auth_info_request->cipher.val, in make_add_auth_info_request()
[all …]
Dexchange_request.c50 exchange_request->cipher.length = len_ex_auth_info / BYTE_TO_HEX_OPER_LENGTH; in parse_exchange_request()
51 exchange_request->cipher.size = exchange_request->cipher.length; in parse_exchange_request()
52 exchange_request->cipher.val = (uint8_t *)MALLOC(exchange_request->cipher.size); in parse_exchange_request()
53 if (exchange_request->cipher.val == NULL) { in parse_exchange_request()
57 …(void)memset_s(exchange_request->cipher.val, exchange_request->cipher.size, 0, exchange_request->c… in parse_exchange_request()
58 if (hex_string_to_byte(ex_auth_info, len_ex_auth_info, exchange_request->cipher.val) != HC_OK) { in parse_exchange_request()
73 if (data->cipher.val != NULL) { in free_exchange_request()
74 FREE(data->cipher.val); in free_exchange_request()
83 … *tmp_data_hex = raw_byte_to_hex_string(exchange_request->cipher.val, exchange_request->cipher.len… in make_exchange_request()
Drmv_auth_info_request.c50 rmv_auth_info_request->cipher.length = len_rmv_return / BYTE_TO_HEX_OPER_LENGTH; in parse_rmv_auth_info_request()
51 rmv_auth_info_request->cipher.size = rmv_auth_info_request->cipher.length; in parse_rmv_auth_info_request()
52 rmv_auth_info_request->cipher.val = (uint8_t *)MALLOC(rmv_auth_info_request->cipher.size); in parse_rmv_auth_info_request()
53 if (rmv_auth_info_request->cipher.val == NULL) { in parse_rmv_auth_info_request()
57 (void)memset_s(rmv_auth_info_request->cipher.val, rmv_auth_info_request->cipher.size, in parse_rmv_auth_info_request()
58 0, rmv_auth_info_request->cipher.size); in parse_rmv_auth_info_request()
59 … if (hex_string_to_byte(add_return, len_rmv_return, rmv_auth_info_request->cipher.val) != HC_OK) { in parse_rmv_auth_info_request()
74 if (data->cipher.val != NULL) { in free_rmv_auth_info_request()
75 FREE(data->cipher.val); in free_rmv_auth_info_request()
85 uint8_t *tmp_data_hex = raw_byte_to_hex_string(rmv_auth_info_request->cipher.val, in make_rmv_auth_info_request()
[all …]
Drmv_auth_info_response.c50 rmv_auth_info_response->cipher.length = len_rmv_return / BYTE_TO_HEX_OPER_LENGTH; in parse_rmv_auth_info_response()
51 rmv_auth_info_response->cipher.size = rmv_auth_info_response->cipher.length; in parse_rmv_auth_info_response()
52 rmv_auth_info_response->cipher.val = (uint8_t *)MALLOC(rmv_auth_info_response->cipher.size); in parse_rmv_auth_info_response()
53 if (rmv_auth_info_response->cipher.val == NULL) { in parse_rmv_auth_info_response()
57 (void)memset_s(rmv_auth_info_response->cipher.val, rmv_auth_info_response->cipher.size, in parse_rmv_auth_info_response()
58 0, rmv_auth_info_response->cipher.size); in parse_rmv_auth_info_response()
59 … if (hex_string_to_byte(rmv_return, len_rmv_return, rmv_auth_info_response->cipher.val) != HC_OK) { in parse_rmv_auth_info_response()
74 if (data->cipher.val != NULL) { in free_rmv_auth_info_response()
75 FREE(data->cipher.val); in free_rmv_auth_info_response()
85 uint8_t *tmp_data_hex = raw_byte_to_hex_string(rmv_auth_info_response_data->cipher.val, in make_rmv_auth_info_response()
[all …]
Dexchange_response.c51 exchange_response->cipher.length = len_ex_auth_info / BYTE_TO_HEX_OPER_LENGTH; in parse_exchange_response()
52 exchange_response->cipher.size = exchange_response->cipher.length; in parse_exchange_response()
53 exchange_response->cipher.val = (uint8_t *)MALLOC(exchange_response->cipher.size); in parse_exchange_response()
54 if (exchange_response->cipher.val == NULL) { in parse_exchange_response()
58 …(void)memset_s(exchange_response->cipher.val, exchange_response->cipher.size, 0, exchange_response… in parse_exchange_response()
59 … if (hex_string_to_byte(ex_auth_info, len_ex_auth_info, exchange_response->cipher.val) != HC_OK) { in parse_exchange_response()
74 if (data->cipher.val != NULL) { in free_exchange_response()
75 FREE(data->cipher.val); in free_exchange_response()
85 …*tmp_data_hex = raw_byte_to_hex_string(exchange_response->cipher.val, exchange_response->cipher.le… in make_exchange_response()
Dadd_auth_info_response.c50 add_auth_info_response->cipher.length = len_add_return / BYTE_TO_HEX_OPER_LENGTH; in parse_add_auth_info_response()
51 add_auth_info_response->cipher.size = add_auth_info_response->cipher.length; in parse_add_auth_info_response()
52 add_auth_info_response->cipher.val = (uint8_t *)MALLOC(add_auth_info_response->cipher.size); in parse_add_auth_info_response()
53 if (add_auth_info_response->cipher.val == NULL) { in parse_add_auth_info_response()
57 (void)memset_s(add_auth_info_response->cipher.val, add_auth_info_response->cipher.size, in parse_add_auth_info_response()
58 0, add_auth_info_response->cipher.size); in parse_add_auth_info_response()
59 … if (hex_string_to_byte(add_return, len_add_return, add_auth_info_response->cipher.val) != HC_OK) { in parse_add_auth_info_response()
74 if (data->cipher.val != NULL) { in free_add_auth_info_response()
75 FREE(data->cipher.val); in free_add_auth_info_response()
85 uint8_t *tmp_data_hex = raw_byte_to_hex_string(add_auth_info_response->cipher.val, in make_add_auth_info_response()
[all …]
/base/security/crypto_framework/frameworks/crypto_operation/
Dcipher.c54 static void SetKeyType(HcfAlgParaValue value, void *cipher) in SetKeyType() argument
56 CipherAttr *cipherAttr = (CipherAttr *)cipher; in SetKeyType()
82 static void SetKeyLength(HcfAlgParaValue value, void *cipher) in SetKeyLength() argument
84 CipherAttr *cipherAttr = (CipherAttr *)cipher; in SetKeyLength()
118 static void SetMode(HcfAlgParaValue value, void *cipher) in SetMode() argument
120 CipherAttr *cipherAttr = (CipherAttr *)cipher; in SetMode()
124 static void SetPadding(HcfAlgParaValue value, void *cipher) in SetPadding() argument
126 CipherAttr *cipherAttr = (CipherAttr *)cipher; in SetPadding()
130 static void SetDigest(HcfAlgParaValue value, CipherAttr *cipher) in SetDigest() argument
132 cipher->md = value; in SetDigest()
[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()
41 cipher->val, cipher->length) != EOK) { in PackageNonceAndCipherToJson()
52 int32_t ParseNonceAndCipherFromJson(Uint8Buff *nonce, Uint8Buff *cipher, const CJson *in, const cha… in ParseNonceAndCipherFromJson() argument
80 res = InitSingleParam(cipher, exAuthInfoLen - nonce->length); in ParseNonceAndCipherFromJson()
85 if (memcpy_s(cipher->val, cipher->length, exAuthInfoVal + nonce->length, in ParseNonceAndCipherFromJson()
/base/security/huks/test/unittest/huks_standard_test/three_stage_test/src/
Dhks_chipset_platform_decrypt_test.cpp63 .cipher = {
93 .cipher = {
123 .cipher = {
153 .cipher = {
185 .cipher = {
277 .cipher = {
307 .cipher = {
337 .cipher = {
367 .cipher = {
399 .cipher = {
[all …]
/base/security/crypto_framework/frameworks/js/napi/crypto/src/
Dnapi_cipher.cpp41 HcfCipher *cipher = nullptr; member
120 context->cipher = nullptr; in FreeCipherFwkCtx()
147 context->cipher = napiCipher->GetCipher(); in BuildContextForInit()
203 context->cipher = napiCipher->GetCipher(); in BuildContextForUpdate()
243 context->cipher = napiCipher->GetCipher(); in BuildContextForFinal()
300 HcfCipher *cipher = context->cipher; in AsyncInitProcess() local
304 context->errCode = cipher->init(cipher, context->opMode, key, params); in AsyncInitProcess()
315 HcfCipher *cipher = context->cipher; in AsyncUpdateProcess() local
316 context->errCode = cipher->update(cipher, &context->input, &context->output); in AsyncUpdateProcess()
326 HcfCipher *cipher = context->cipher; in AsyncDoFinalProcess() local
[all …]
/base/security/huks/frameworks/crypto_lite/cipher/src/
Dcipher_rsa.c320 static int32_t RsaEncrypt(RsaKeyData *key, const RsaData *plain, RsaData *cipher) in RsaEncrypt() argument
348 if (cipher->data == NULL) { in RsaEncrypt()
349 cipher->length = rsaLen * count + (remain ? rsaLen : 0); in RsaEncrypt()
350 cipher->length = (cipher->length / NUM_THREE + 1) * NUM_FOUR + 1; in RsaEncrypt()
355 if (RsaEncryptMultipleBlock(rsa, plain->data, cipher->data, cipher->length) != 0) { in RsaEncrypt()
365 static int32_t CheckParamAndMallocBuf(size_t rsaLen, const RsaData *cipher, unsigned char **buf, un… in CheckParamAndMallocBuf() argument
367 if ((rsaLen == 0) || (cipher->length == 0)) { in CheckParamAndMallocBuf()
374 *tembuf = (unsigned char*)malloc(cipher->length); in CheckParamAndMallocBuf()
383 static int32_t RsaPkcs1Decrypt(mbedtls_rsa_context *rsa, size_t rsaLen, RsaData *cipher, RsaData *p… in RsaPkcs1Decrypt() argument
391 int32_t ret = CheckParamAndMallocBuf(rsaLen, cipher, &buf, &tembuf); in RsaPkcs1Decrypt()
[all …]
/base/security/device_auth/frameworks/deviceauth_lite/source/auth_info/
Dauth_info.c130 data->cipher.val = (uint8_t *)MALLOC(size); in malloc_auth_info_msg()
131 if (data->cipher.val == NULL) { in malloc_auth_info_msg()
136 (void)memset_s(data->cipher.val, size, 0, size); in malloc_auth_info_msg()
137 data->cipher.size = size; in malloc_auth_info_msg()
138 data->cipher.length = 0; in malloc_auth_info_msg()
144 FREE(data->cipher.val); in free_auth_info_msg()
145 data->cipher.val = NULL; in free_auth_info_msg()
/base/security/crypto_framework/plugin/
Dplugin.gni23 "${plugin_path}/openssl_plugin/crypto_operation/cipher/inc",
60 "${plugin_path}/openssl_plugin/crypto_operation/cipher/src/cipher_rsa_openssl.c",
61 "${plugin_path}/openssl_plugin/crypto_operation/cipher/src/cipher_3des_openssl.c",
62 "${plugin_path}/openssl_plugin/crypto_operation/cipher/src/cipher_aes_openssl.c",
63 "${plugin_path}/openssl_plugin/crypto_operation/cipher/src/cipher_aes_common.c",
64 "${plugin_path}/openssl_plugin/crypto_operation/cipher/src/cipher_sm4_openssl.c",
65 "${plugin_path}/openssl_plugin/crypto_operation/cipher/src/cipher_sm2_openssl.c",
/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…
/base/security/huks/test/unittest/huks_standard_test/three_stage_test/include/
Dhks_chipset_platform_test.h33 std::vector<uint8_t> cipher {};
61 … { .tag = HKS_TAG_CIPHER_TEXT, .blob = { .size = t.cipher.size(), .data = t.cipher.data() } }}; in CipherMaterialsToDecryptInputParams()
/base/security/dlp_permission_service/frameworks/test/mock/
Dopenssl_mock.cpp35 typedef int (*EvpEncryptInitEx)(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, ENGINE *impl,
37 typedef int (*EvpDecryptInitEx)(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, ENGINE *impl,
162 int EVP_EncryptInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, ENGINE *impl, in EVP_EncryptInit_ex() argument
173 return (*func)(ctx, cipher, impl, key, iv); in EVP_EncryptInit_ex()
176 int EVP_DecryptInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, ENGINE *impl, in EVP_DecryptInit_ex() argument
187 return (*func)(ctx, cipher, impl, key, iv); in EVP_DecryptInit_ex()
/base/security/huks/test/unittest/huks_standard_test/three_stage_test/src/symmetric_alg_test/
Dhks_aes_cipher_test_common.cpp129 uint8_t cipher[AES_COMMON_SIZE] = {0}; in HksAesCipherTestCaseOther() local
130 struct HksBlob cipherText = { AES_COMMON_SIZE, cipher }; in HksAesCipherTestCaseOther()
161 uint8_t cipher[AES_COMMON_SIZE] = {0}; in HksAesCipherTestCaseGcm2() local
162 struct HksBlob cipherText = { AES_COMMON_SIZE, cipher }; in HksAesCipherTestCaseGcm2()
226 uint8_t cipher[AES_COMMON_SIZE] = {0};
227 struct HksBlob cipherText = { AES_COMMON_SIZE, cipher };
297 uint8_t cipher[AES_COMMON_SIZE] = {0};
298 struct HksBlob cipherText = { AES_COMMON_SIZE, cipher };
/base/security/huks/frameworks/crypto_lite/js/napi/
DBUILD.gn29 "//base/security/huks/frameworks/crypto_lite/cipher/include",
33 deps = [ "//base/security/huks/frameworks/crypto_lite/cipher:cipher_shared" ]
/base/security/huks/frameworks/crypto_lite/js/builtin/
DBUILD.gn29 "//base/security/huks/frameworks/crypto_lite/cipher/include",
35 "//base/security/huks/frameworks/crypto_lite/cipher:cipher_shared",

123