Home
last modified time | relevance | path

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

1234

/base/security/crypto_framework/test/unittest/src/
Dcrypto_rsa_cipher_test.cpp149 static HcfResult RsaCipherSpec(HcfCipher *cipher) in RsaCipherSpec() argument
153 HcfResult res = cipher->setCipherSpecUint8Array(cipher, OAEP_MGF1_PSRC_UINT8ARR, pSource); in RsaCipherSpec()
157 res = cipher->getCipherSpecString(cipher, OAEP_MD_NAME_STR, &returnMdName); in RsaCipherSpec()
161 res = cipher->getCipherSpecString(cipher, OAEP_MGF_NAME_STR, &returnMgF1Name); in RsaCipherSpec()
165 res = cipher->getCipherSpecString(cipher, OAEP_MGF1_MD_STR, &returnMgf1MdName); in RsaCipherSpec()
170 res = cipher->getCipherSpecUint8Array(cipher, OAEP_MGF1_PSRC_UINT8ARR, &pSourceReturn); in RsaCipherSpec()
182 static HcfResult RsaSpecpSource(HcfCipher *cipher, uint8_t *pSourceData, HcfBlob pSource) in RsaSpecpSource() argument
187 HcfResult res = cipher->setCipherSpecUint8Array(cipher, OAEP_MGF1_PSRC_UINT8ARR, pSource); in RsaSpecpSource()
189 res = cipher->getCipherSpecUint8Array(cipher, OAEP_MGF1_PSRC_UINT8ARR, &pSourceReturn); in RsaSpecpSource()
194 res = cipher->setCipherSpecUint8Array(cipher, OAEP_MGF1_PSRC_UINT8ARR, cleanP); in RsaSpecpSource()
[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_ecb_cipher_test.cpp52 HcfCipher *cipher = nullptr; variable
67 ret = HcfCipherCreate("SM4_128|ECB|NoPadding", &cipher);
73 ret = Sm4Encrypt(cipher, key, nullptr, cipherText, &cipherTextLen);
79 ret = Sm4Decrypt(cipher, key, nullptr, cipherText, cipherTextLen);
87 HcfObjDestroy((HcfObjectBase *)cipher);
99 HcfCipher *cipher = nullptr; variable
114 ret = HcfCipherCreate("SM4_128|ECB|PKCS5", &cipher);
120 ret = Sm4Encrypt(cipher, key, nullptr, cipherText, &cipherTextLen);
126 ret = Sm4Decrypt(cipher, key, nullptr, cipherText, cipherTextLen);
135 HcfObjDestroy((HcfObjectBase *)cipher);
[all …]
Dcrypto_sm4_cipher_test.cpp57 HcfCipher *cipher = nullptr; variable
73 ret = HcfCipherCreate("SM4_128|CBC|NoPadding", &cipher);
79 ret = Sm4Encrypt(cipher, key, nullptr, cipherText, &cipherTextLen);
85 ret = Sm4Decrypt(cipher, key, nullptr, cipherText, cipherTextLen);
93 HcfObjDestroy((HcfObjectBase *)cipher);
105 HcfCipher *cipher = nullptr; variable
121 ret = HcfCipherCreate("SM4_128|CBC|PKCS5", &cipher);
127 ret = Sm4Encrypt(cipher, key, nullptr, cipherText, &cipherTextLen);
132 ret = Sm4Decrypt(cipher, key, nullptr, cipherText, cipherTextLen);
140 HcfObjDestroy((HcfObjectBase *)cipher);
[all …]
Dcrypto_sm4_cfb_cipher_test.cpp52 HcfCipher *cipher = nullptr; variable
68 ret = HcfCipherCreate("SM4_128|CFB|NoPadding", &cipher);
74 ret = Sm4Encrypt(cipher, key, nullptr, cipherText, &cipherTextLen);
80 ret = Sm4Decrypt(cipher, key, nullptr, cipherText, cipherTextLen);
88 HcfObjDestroy((HcfObjectBase *)cipher);
100 HcfCipher *cipher = nullptr; variable
116 ret = HcfCipherCreate("SM4_128|CFB|PKCS5", &cipher);
122 ret = Sm4Encrypt(cipher, key, nullptr, cipherText, &cipherTextLen);
128 ret = Sm4Decrypt(cipher, key, nullptr, cipherText, cipherTextLen);
136 HcfObjDestroy((HcfObjectBase *)cipher);
[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 …]
Dsm4_common.cpp72 int32_t Sm4EncryptWithInput(HcfCipher *cipher, HcfSymKey *key, HcfBlob *input, in Sm4EncryptWithInput() argument
77 int32_t ret = cipher->init(cipher, ENCRYPT_MODE, &(key->key), nullptr); in Sm4EncryptWithInput()
83 ret = cipher->update(cipher, input, &output); in Sm4EncryptWithInput()
97 ret = cipher->doFinal(cipher, nullptr, &output); in Sm4EncryptWithInput()
115 int32_t Sm4DecryptEmptyMsg(HcfCipher *cipher, HcfSymKey *key, HcfParamsSpec *params, in Sm4DecryptEmptyMsg() argument
120 int32_t ret = cipher->init(cipher, DECRYPT_MODE, &(key->key), params); in Sm4DecryptEmptyMsg()
126 ret = cipher->doFinal(cipher, &input, &output); in Sm4DecryptEmptyMsg()
141 int32_t Sm4Encrypt(HcfCipher *cipher, HcfSymKey *key, HcfParamsSpec *params, in Sm4Encrypt() argument
148 int32_t ret = cipher->init(cipher, ENCRYPT_MODE, reinterpret_cast<HcfKey *>(key), params); in Sm4Encrypt()
154 ret = cipher->update(cipher, &input, &output); in Sm4Encrypt()
[all …]
Dcrypto_rsa_cipher_sub_test.cpp175 HcfCipher *cipher = nullptr; variable
176 res = HcfCipherCreate("RSA|PKCS1_OAEP|SHA256|MGF1_SHA256", &cipher);
178 res = cipher->init(cipher, ENCRYPT_MODE, (HcfKey *)keyPair->pubKey, nullptr);
184 res = cipher->setCipherSpecUint8Array(reinterpret_cast<HcfCipher *>(&g_obj),
187 res = cipher->doFinal(cipher, &input, &encoutput);
189 HcfObjDestroy(cipher);
214 HcfCipher *cipher = nullptr; variable
216 res = HcfCipherCreate("RSA|PKCS1_OAEP|SHA256|MGF1_SHA256", &cipher);
218 … res = cipher->getCipherSpecString(reinterpret_cast<HcfCipher *>(&g_obj), OAEP_MD_NAME_STR, &ret);
222 HcfObjDestroy(cipher);
[all …]
/base/security/crypto_framework/test/unittest/src/aes_cipher/
Dcrypto_aes_ecb_cipher_test.cpp58 HcfCipher *cipher = nullptr; variable
73 ret = HcfCipherCreate("AES128|ECB|NoPadding", &cipher);
79 ret = AesEncrypt(cipher, key, nullptr, cipherText, &cipherTextLen);
85 ret = AesDecrypt(cipher, key, nullptr, cipherText, cipherTextLen);
92 HcfObjDestroy((HcfObjectBase *)cipher);
110 HcfCipher *cipher = nullptr; variable
124 ret = HcfCipherCreate("AES128|ECB|PKCS5", &cipher);
130 ret = AesEncrypt(cipher, key, nullptr, cipherText, &cipherTextLen);
136 ret = AesDecrypt(cipher, key, nullptr, cipherText, cipherTextLen);
143 HcfObjDestroy((HcfObjectBase *)cipher);
[all …]
Dcrypto_aes_cfb_cipher_test.cpp54 HcfCipher *cipher = nullptr; variable
71 ret = HcfCipherCreate("AES128|CFB|NoPadding", &cipher);
77 ret = AesEncrypt(cipher, key, (HcfParamsSpec *)&ivSpec, cipherText, &cipherTextLen);
83 ret = AesDecrypt(cipher, key, (HcfParamsSpec *)&ivSpec, cipherText, cipherTextLen);
91 HcfObjDestroy((HcfObjectBase *)cipher);
105 HcfCipher *cipher = nullptr; variable
122 ret = HcfCipherCreate("AES128|CFB|PKCS5", &cipher);
128 ret = AesEncrypt(cipher, key, (HcfParamsSpec *)&ivSpec, cipherText, &cipherTextLen);
134 ret = AesDecrypt(cipher, key, (HcfParamsSpec *)&ivSpec, cipherText, cipherTextLen);
142 HcfObjDestroy((HcfObjectBase *)cipher);
[all …]
Dcrypto_aes_ofb_cipher_test.cpp54 HcfCipher *cipher = nullptr; variable
71 ret = HcfCipherCreate("AES128|OFB|NoPadding", &cipher);
77 ret = AesEncrypt(cipher, key, (HcfParamsSpec *)&ivSpec, cipherText, &cipherTextLen);
83 ret = AesDecrypt(cipher, key, (HcfParamsSpec *)&ivSpec, cipherText, cipherTextLen);
91 HcfObjDestroy((HcfObjectBase *)cipher);
105 HcfCipher *cipher = nullptr; variable
122 ret = HcfCipherCreate("AES128|OFB|PKCS5", &cipher);
128 ret = AesEncrypt(cipher, key, (HcfParamsSpec *)&ivSpec, cipherText, &cipherTextLen);
134 ret = AesDecrypt(cipher, key, (HcfParamsSpec *)&ivSpec, cipherText, cipherTextLen);
142 HcfObjDestroy((HcfObjectBase *)cipher);
[all …]
Dcrypto_aes_cbc_cipher_test.cpp54 HcfCipher *cipher = nullptr; variable
71 ret = HcfCipherCreate("AES128|CBC|NoPadding", &cipher);
77 ret = AesEncrypt(cipher, key, (HcfParamsSpec *)&ivSpec, cipherText, &cipherTextLen);
83 ret = AesDecrypt(cipher, key, (HcfParamsSpec *)&ivSpec, cipherText, cipherTextLen);
91 HcfObjDestroy((HcfObjectBase *)cipher);
105 HcfCipher *cipher = nullptr; variable
122 ret = HcfCipherCreate("AES128|CBC|PKCS5", &cipher);
128 ret = AesEncrypt(cipher, key, (HcfParamsSpec *)&ivSpec, cipherText, &cipherTextLen);
134 ret = AesDecrypt(cipher, key, (HcfParamsSpec *)&ivSpec, cipherText, cipherTextLen);
142 HcfObjDestroy((HcfObjectBase *)cipher);
[all …]
Dcrypto_aes_ctr_cipher_test.cpp54 HcfCipher *cipher = nullptr; variable
71 ret = HcfCipherCreate("AES128|CTR|NoPadding", &cipher);
77 ret = AesEncrypt(cipher, key, (HcfParamsSpec *)&ivSpec, cipherText, &cipherTextLen);
83 ret = AesDecrypt(cipher, key, (HcfParamsSpec *)&ivSpec, cipherText, cipherTextLen);
91 HcfObjDestroy((HcfObjectBase *)cipher);
105 HcfCipher *cipher = nullptr; variable
122 ret = HcfCipherCreate("AES128|CTR|PKCS5", &cipher);
128 ret = AesEncrypt(cipher, key, (HcfParamsSpec *)&ivSpec, cipherText, &cipherTextLen);
134 ret = AesDecrypt(cipher, key, (HcfParamsSpec *)&ivSpec, cipherText, cipherTextLen);
142 HcfObjDestroy((HcfObjectBase *)cipher);
[all …]
Daes_common.cpp148 int32_t AesMultiBlockEncrypt(HcfCipher *cipher, HcfSymKey *key, HcfParamsSpec *params) in AesMultiBlockEncrypt() argument
162 int32_t ret = cipher->init(cipher, ENCRYPT_MODE, reinterpret_cast<HcfKey *>(key), params); in AesMultiBlockEncrypt()
169 ret = cipher->update(cipher, &input, &output); in AesMultiBlockEncrypt()
182 ret = cipher->doFinal(cipher, nullptr, &output); in AesMultiBlockEncrypt()
202 int32_t AesMultiBlockDecrypt(HcfCipher *cipher, HcfSymKey *key, HcfParamsSpec *params) in AesMultiBlockDecrypt() argument
216 int32_t ret = cipher->init(cipher, DECRYPT_MODE, reinterpret_cast<HcfKey *>(key), params); in AesMultiBlockDecrypt()
223 ret = cipher->update(cipher, &input, &output); in AesMultiBlockDecrypt()
236 ret = cipher->doFinal(cipher, nullptr, &output); in AesMultiBlockDecrypt()
257 int32_t AesEncryptWithInput(HcfCipher *cipher, HcfSymKey *key, HcfBlob *input, in AesEncryptWithInput() argument
262 int32_t ret = cipher->init(cipher, ENCRYPT_MODE, &(key->key), nullptr); in AesEncryptWithInput()
[all …]
Dcrypto_aes_gcm_cipher_test.cpp54 HcfCipher *cipher = nullptr; variable
71 ret = HcfCipherCreate("AES128|GCM|NoPadding", &cipher);
77 ret = AesEncrypt(cipher, key, (HcfParamsSpec *)&spec, cipherText, &cipherTextLen);
87 ret = AesDecrypt(cipher, key, (HcfParamsSpec *)&spec, cipherText, cipherTextLen);
95 HcfObjDestroy((HcfObjectBase *)cipher);
108 HcfCipher *cipher = nullptr; variable
125 ret = HcfCipherCreate("AES128|GCM|PKCS5", &cipher);
131 ret = AesEncrypt(cipher, key, (HcfParamsSpec *)&spec, cipherText, &cipherTextLen);
141 ret = AesDecrypt(cipher, key, (HcfParamsSpec *)&spec, cipherText, cipherTextLen);
149 HcfObjDestroy((HcfObjectBase *)cipher);
[all …]
Dcrypto_aes_ccm_cipher_test.cpp54 HcfCipher *cipher = nullptr; variable
70 ret = HcfCipherCreate("AES128|CCM|NoPadding", &cipher);
76 ret = AesEncrypt(cipher, key, (HcfParamsSpec *)&spec, cipherText, &cipherTextLen);
86 ret = AesDecrypt(cipher, key, (HcfParamsSpec *)&spec, cipherText, cipherTextLen);
94 HcfObjDestroy((HcfObjectBase *)cipher);
107 HcfCipher *cipher = nullptr; variable
123 ret = HcfCipherCreate("AES128|CCM|PKCS5", &cipher);
129 ret = AesEncrypt(cipher, key, (HcfParamsSpec *)&spec, cipherText, &cipherTextLen);
139 ret = AesDecrypt(cipher, key, (HcfParamsSpec *)&spec, cipherText, cipherTextLen);
147 HcfObjDestroy((HcfObjectBase *)cipher);
[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/
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 …]
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 …]
Dexchange_response.c51 exchange_response->cipher.length = (uint32_t)(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()
/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/crypto_framework/test/unittest/include/
Daes_common.h54 int32_t AesMultiBlockEncrypt(HcfCipher *cipher, HcfSymKey *key, HcfParamsSpec *params);
55 int32_t AesMultiBlockDecrypt(HcfCipher *cipher, HcfSymKey *key, HcfParamsSpec *params);
58 int32_t AesEncryptWithInput(HcfCipher *cipher, HcfSymKey *key, HcfBlob *input,
60 int32_t AesEncrypt(HcfCipher *cipher, HcfSymKey *key, HcfParamsSpec *params,
62 int32_t AesDecrypt(HcfCipher *cipher, HcfSymKey *key, HcfParamsSpec *params,
64 int32_t AesNoUpdateEncWithInput(HcfCipher *cipher, HcfSymKey *key, HcfBlob *input,
68 int32_t AesDecryptEmptyMsg(HcfCipher *cipher, HcfSymKey *key, HcfParamsSpec *params,
70 int32_t AesNoUpdateEncrypt(HcfCipher *cipher, HcfSymKey *key, HcfParamsSpec *params,
72 int32_t AesNoUpdateDecrypt(HcfCipher *cipher, HcfSymKey *key, HcfParamsSpec *params,
Dsm4_common.h36 int32_t Sm4EncryptWithInput(HcfCipher *cipher, HcfSymKey *key, HcfBlob *input,
40 int32_t Sm4DecryptEmptyMsg(HcfCipher *cipher, HcfSymKey *key, HcfParamsSpec *params,
42 int32_t Sm4Encrypt(HcfCipher *cipher, HcfSymKey *key, HcfParamsSpec *params,
44 int32_t Sm4Decrypt(HcfCipher *cipher, HcfSymKey *key, HcfParamsSpec *params,
46 int32_t Sm4NoUpdateEncrypt(HcfCipher *cipher, HcfSymKey *key, HcfParamsSpec *params,
48 int32_t Sm4NoUpdateDecrypt(HcfCipher *cipher, HcfSymKey *key, HcfParamsSpec *params,
/base/security/huks/test/unittest/huks_standard_test/three_stage_test/src/
Dhks_chipset_platform_decrypt_test.cpp64 .cipher = {
94 .cipher = {
124 .cipher = {
154 .cipher = {
186 .cipher = {
278 .cipher = {
308 .cipher = {
338 .cipher = {
368 .cipher = {
400 .cipher = {
[all …]
/base/security/asset/services/crypto_manager/src/
Dcrypto.rs87 …pub fn exec_crypt(&self, cipher: &Vec<u8>, aad: &Vec<u8>, auth_token: &Vec<u8>) -> Result<Vec<u8>>… in exec_crypt()
88 if cipher.len() <= (TAG_SIZE + NONCE_SIZE) { in exec_crypt()
95 let in_data = HksBlob { size: cipher.len() as u32, data: cipher.as_ptr() }; in exec_crypt()
96 let mut msg: Vec<u8> = vec![0; cipher.len() - TAG_SIZE - NONCE_SIZE]; in exec_crypt()
116 let mut cipher: Vec<u8> = vec![0; msg.len() + TAG_SIZE + NONCE_SIZE]; in encrypt() localVariable
120 let mut out_data = OutBlob { size: cipher.len() as u32, data: cipher.as_mut_ptr() }; in encrypt()
132 SUCCESS => Ok(cipher), in encrypt()
138 pub fn decrypt(key: &SecretKey, cipher: &Vec<u8>, aad: &Vec<u8>) -> Result<Vec<u8>> { in decrypt()
139 if cipher.len() <= (TAG_SIZE + NONCE_SIZE) { in decrypt()
143 let mut plain: Vec<u8> = vec![0; cipher.len() - TAG_SIZE - NONCE_SIZE]; in decrypt()
[all …]

1234