Lines Matching refs:res

65 	TEE_Result res = TEE_ERROR_GENERIC;  in derive_unique_key()  local
72 res = TEE_OpenTASession(&(const TEE_UUID)PTA_SYSTEM_UUID, in derive_unique_key()
75 if (res) in derive_unique_key()
76 return res; in derive_unique_key()
86 res = TEE_InvokeTACommand(sess, TEE_TIMEOUT_INFINITE, in derive_unique_key()
92 return res; in derive_unique_key()
98 TEE_Result res = TEE_ERROR_GENERIC; in huk_ae_encrypt() local
108 res = TEE_AEInit(crypto_op, hdr->iv, IV_SIZE, TAG_SIZE * 8, 0, 0); in huk_ae_encrypt()
109 if (res) in huk_ae_encrypt()
110 return res; in huk_ae_encrypt()
112 res = TEE_AEEncryptFinal(crypto_op, in, in_sz, hdr->enc_key, in huk_ae_encrypt()
114 if (res || tag_len != TAG_SIZE) in huk_ae_encrypt()
120 return res; in huk_ae_encrypt()
126 TEE_Result res = TEE_ERROR_GENERIC; in huk_ae_decrypt() local
134 res = TEE_AEInit(crypto_op, hdr->iv, IV_SIZE, TAG_SIZE * 8, 0, 0); in huk_ae_decrypt()
135 if (res) in huk_ae_decrypt()
136 return res; in huk_ae_decrypt()
139 res = TEE_AEDecryptFinal(crypto_op, hdr->enc_key, enc_key_len, out, in huk_ae_decrypt()
141 if (res) in huk_ae_decrypt()
142 res = TEE_ERROR_SECURITY; in huk_ae_decrypt()
144 return res; in huk_ae_decrypt()
150 TEE_Result res = TEE_ERROR_GENERIC; in huk_crypt() local
156 res = TEE_AllocateOperation(&crypto_op, TEE_ALG_AES_GCM, mode, in huk_crypt()
158 if (res) in huk_crypt()
159 return res; in huk_crypt()
161 res = derive_unique_key(huk_key, sizeof(huk_key), NULL, 0); in huk_crypt()
162 if (res) { in huk_crypt()
163 EMSG("derive_unique_key failed: returned %#"PRIx32, res); in huk_crypt()
167 res = TEE_AllocateTransientObject(TEE_TYPE_AES, sizeof(huk_key) * 8, in huk_crypt()
169 if (res) in huk_crypt()
176 res = TEE_PopulateTransientObject(hkey, &attr, 1); in huk_crypt()
177 if (res) in huk_crypt()
180 res = TEE_SetOperationKey(crypto_op, hkey); in huk_crypt()
181 if (res) in huk_crypt()
185 res = huk_ae_encrypt(crypto_op, in, in_sz, out, out_sz); in huk_crypt()
186 if (res) in huk_crypt()
187 EMSG("huk_AE_encrypt failed: returned %#"PRIx32, res); in huk_crypt()
189 res = huk_ae_decrypt(crypto_op, in, in_sz, out, out_sz); in huk_crypt()
190 if (res) in huk_crypt()
191 EMSG("huk_AE_decrypt failed: returned %#"PRIx32, res); in huk_crypt()
201 return res; in huk_crypt()
207 TEE_Result res = TEE_SUCCESS; in seal_trusted_key() local
238 res = huk_crypt(TEE_MODE_ENCRYPT, in, in_sz, out, &out_sz); in seal_trusted_key()
239 if (res == TEE_SUCCESS) { in seal_trusted_key()
244 return res; in seal_trusted_key()
250 TEE_Result res = TEE_SUCCESS; in unseal_trusted_key() local
280 res = huk_crypt(TEE_MODE_DECRYPT, in, in_sz, out, &out_sz); in unseal_trusted_key()
281 if (res == TEE_SUCCESS) { in unseal_trusted_key()
286 return res; in unseal_trusted_key()
302 TEE_Result res = TEE_ERROR_GENERIC; in TA_OpenSessionEntryPoint() local
306 res = TEE_AllocatePropertyEnumerator(&h); in TA_OpenSessionEntryPoint()
307 if (res) in TA_OpenSessionEntryPoint()
312 res = TEE_GetPropertyAsIdentity(h, NULL, &id); in TA_OpenSessionEntryPoint()
313 if (res) in TA_OpenSessionEntryPoint()
317 res = TEE_ERROR_ACCESS_DENIED; in TA_OpenSessionEntryPoint()
322 return res; in TA_OpenSessionEntryPoint()