Lines Matching refs:res

45 	TEE_Result res;  in do_hmac()  local
51 res = crypto_mac_alloc_ctx(&ctx, TEE_FS_KM_HMAC_ALG); in do_hmac()
52 if (res != TEE_SUCCESS) in do_hmac()
53 return res; in do_hmac()
55 res = crypto_mac_init(ctx, in_key, in_key_size); in do_hmac()
56 if (res != TEE_SUCCESS) in do_hmac()
59 res = crypto_mac_update(ctx, message, message_size); in do_hmac()
60 if (res != TEE_SUCCESS) in do_hmac()
63 res = crypto_mac_final(ctx, out_key, out_key_size); in do_hmac()
64 if (res != TEE_SUCCESS) in do_hmac()
67 res = TEE_SUCCESS; in do_hmac()
71 return res; in do_hmac()
78 TEE_Result res; in tee_fs_fek_crypt() local
93 res = do_hmac(tsk, sizeof(tsk), tee_fs_ssk.key, in tee_fs_fek_crypt()
95 if (res != TEE_SUCCESS) in tee_fs_fek_crypt()
96 return res; in tee_fs_fek_crypt()
104 res = do_hmac(tsk, sizeof(tsk), tee_fs_ssk.key, in tee_fs_fek_crypt()
106 if (res != TEE_SUCCESS) in tee_fs_fek_crypt()
107 return res; in tee_fs_fek_crypt()
110 res = crypto_cipher_alloc_ctx(&ctx, TEE_FS_KM_ENC_FEK_ALG); in tee_fs_fek_crypt()
111 if (res != TEE_SUCCESS) in tee_fs_fek_crypt()
112 return res; in tee_fs_fek_crypt()
114 res = crypto_cipher_init(ctx, mode, tsk, sizeof(tsk), NULL, 0, NULL, 0); in tee_fs_fek_crypt()
115 if (res != TEE_SUCCESS) in tee_fs_fek_crypt()
118 res = crypto_cipher_update(ctx, mode, true, in_key, size, dst_key); in tee_fs_fek_crypt()
119 if (res != TEE_SUCCESS) in tee_fs_fek_crypt()
131 return res; in tee_fs_fek_crypt()
141 TEE_Result res = TEE_SUCCESS; in tee_fs_init_key_manager() local
145 res = huk_subkey_derive(HUK_SUBKEY_SSK, NULL, 0, in tee_fs_init_key_manager()
147 if (res == TEE_SUCCESS) in tee_fs_init_key_manager()
152 return res; in tee_fs_init_key_manager()
157 TEE_Result res; in tee_fs_generate_fek() local
162 res = generate_fek(buf, TEE_FS_KM_FEK_SIZE); in tee_fs_generate_fek()
163 if (res != TEE_SUCCESS) in tee_fs_generate_fek()
164 return res; in tee_fs_generate_fek()
181 TEE_Result res; in aes_ecb() local
184 res = crypto_cipher_alloc_ctx(&ctx, TEE_ALG_AES_ECB_NOPAD); in aes_ecb()
185 if (res != TEE_SUCCESS) in aes_ecb()
186 return res; in aes_ecb()
188 res = crypto_cipher_init(ctx, TEE_MODE_ENCRYPT, key, in aes_ecb()
190 if (res != TEE_SUCCESS) in aes_ecb()
193 res = crypto_cipher_update(ctx, TEE_MODE_ENCRYPT, true, in, in aes_ecb()
195 if (res != TEE_SUCCESS) in aes_ecb()
199 res = TEE_SUCCESS; in aes_ecb()
203 return res; in aes_ecb()
210 TEE_Result res; in essiv() local
214 res = sha256(sha, sizeof(sha), fek, TEE_FS_KM_FEK_SIZE); in essiv()
215 if (res != TEE_SUCCESS) in essiv()
216 return res; in essiv()
221 res = aes_ecb(iv, pad_blkid, sha, 16); in essiv()
224 return res; in essiv()
235 TEE_Result res; in tee_fs_crypt_block() local
244 res = tee_fs_fek_crypt(uuid, TEE_MODE_DECRYPT, encrypted_fek, in tee_fs_crypt_block()
246 if (res != TEE_SUCCESS) in tee_fs_crypt_block()
250 res = essiv(iv, fek, blk_idx); in tee_fs_crypt_block()
251 if (res != TEE_SUCCESS) in tee_fs_crypt_block()
255 res = crypto_cipher_alloc_ctx(&ctx, TEE_ALG_AES_CBC_NOPAD); in tee_fs_crypt_block()
256 if (res != TEE_SUCCESS) in tee_fs_crypt_block()
259 res = crypto_cipher_init(ctx, mode, fek, sizeof(fek), NULL, in tee_fs_crypt_block()
261 if (res != TEE_SUCCESS) in tee_fs_crypt_block()
263 res = crypto_cipher_update(ctx, mode, true, in, size, out); in tee_fs_crypt_block()
264 if (res != TEE_SUCCESS) in tee_fs_crypt_block()
274 return res; in tee_fs_crypt_block()