Lines Matching refs:res
93 TEE_Result res = TEE_SUCCESS; in check_update_version() local
109 res = ops->open(&pobj, NULL, &fh); in check_update_version()
110 if (res != TEE_SUCCESS && res != TEE_ERROR_ITEM_NOT_FOUND) in check_update_version()
113 if (res == TEE_ERROR_ITEM_NOT_FOUND) { in check_update_version()
115 res = ops->create(&pobj, false, NULL, 0, NULL, 0, &db_hdr, NULL, in check_update_version()
117 if (res != TEE_SUCCESS) in check_update_version()
122 res = ops->read(fh, 0, &db_hdr, NULL, &len); in check_update_version()
123 if (res != TEE_SUCCESS) in check_update_version()
131 res = ops->write(fh, 0, &db_hdr, NULL, sizeof(db_hdr)); in check_update_version()
132 if (res != TEE_SUCCESS) in check_update_version()
135 res = TEE_ERROR_BAD_STATE; in check_update_version()
143 res = ops->read(fh, sizeof(db_hdr) + (i * len), &db_entry, in check_update_version()
145 if (res != TEE_SUCCESS) { in check_update_version()
148 res = TEE_ERROR_BAD_STATE; in check_update_version()
160 res = TEE_ERROR_ACCESS_CONFLICT; in check_update_version()
166 res = ops->write(fh, sizeof(db_hdr) + (i * len), in check_update_version()
168 if (res != TEE_SUCCESS) in check_update_version()
175 res = ops->write(fh, sizeof(db_hdr) + (db_hdr.nb_entries * len), in check_update_version()
177 if (res != TEE_SUCCESS) in check_update_version()
181 res = ops->write(fh, 0, &db_hdr, NULL, sizeof(db_hdr)); in check_update_version()
182 if (res != TEE_SUCCESS) in check_update_version()
189 return res; in check_update_version()
199 TEE_Result res; in rpc_load() local
210 res = thread_rpc_cmd(OPTEE_RPC_CMD_LOAD_TA, 2, params); in rpc_load()
211 if (res != TEE_SUCCESS) in rpc_load()
212 return res; in rpc_load()
220 res = TEE_ERROR_SHORT_BUFFER; in rpc_load()
233 res = thread_rpc_cmd(OPTEE_RPC_CMD_LOAD_TA, 2, params); in rpc_load()
235 if (res != TEE_SUCCESS) in rpc_load()
238 return res; in rpc_load()
252 TEE_Result res = TEE_SUCCESS; in ree_fs_ta_open() local
266 res = rpc_load(uuid, &ta, &ta_size, &mobj); in ree_fs_ta_open()
267 if (res != TEE_SUCCESS) in ree_fs_ta_open()
273 res = TEE_ERROR_SECURITY; in ree_fs_ta_open()
278 FTMN_CALL_FUNC(res, &ftmn, FTMN_INCR0, shdr_verify_signature, shdr); in ree_fs_ta_open()
280 if (res != TEE_SUCCESS) in ree_fs_ta_open()
285 res = TEE_ERROR_SECURITY; in ree_fs_ta_open()
294 res = TEE_ERROR_SECURITY; in ree_fs_ta_open()
298 res = shdr_load_pub_key(shdr, offs, (const void *)ta, in ree_fs_ta_open()
301 if (res) in ree_fs_ta_open()
307 res = TEE_ERROR_SECURITY; in ree_fs_ta_open()
314 res = check_update_version(subkey_ver_db, pub_key.uuid, in ree_fs_ta_open()
316 if (res) { in ree_fs_ta_open()
317 res = TEE_ERROR_SECURITY; in ree_fs_ta_open()
324 res = TEE_ERROR_SECURITY; in ree_fs_ta_open()
326 FTMN_CALL_FUNC(res, &ftmn, FTMN_INCR0, in ree_fs_ta_open()
331 if (res) in ree_fs_ta_open()
336 res = TEE_ERROR_SECURITY; in ree_fs_ta_open()
341 res = TEE_ERROR_SECURITY; in ree_fs_ta_open()
348 res = TEE_ERROR_SECURITY; in ree_fs_ta_open()
363 res = TEE_ERROR_SECURITY; in ree_fs_ta_open()
372 res = crypto_hash_alloc_ctx(&hash_ctx, in ree_fs_ta_open()
374 if (res != TEE_SUCCESS) in ree_fs_ta_open()
376 res = crypto_hash_init(hash_ctx); in ree_fs_ta_open()
377 if (res != TEE_SUCCESS) in ree_fs_ta_open()
379 res = crypto_hash_update(hash_ctx, (uint8_t *)shdr, sizeof(*shdr)); in ree_fs_ta_open()
380 if (res != TEE_SUCCESS) in ree_fs_ta_open()
389 res = TEE_ERROR_SECURITY; in ree_fs_ta_open()
395 res = TEE_ERROR_OUT_OF_MEMORY; in ree_fs_ta_open()
409 res = TEE_ERROR_SECURITY; in ree_fs_ta_open()
413 res = crypto_hash_update(hash_ctx, (uint8_t *)bs_hdr, in ree_fs_ta_open()
415 if (res != TEE_SUCCESS) in ree_fs_ta_open()
429 res = TEE_ERROR_SECURITY; in ree_fs_ta_open()
438 res = TEE_ERROR_SECURITY; in ree_fs_ta_open()
447 res = TEE_ERROR_SECURITY; in ree_fs_ta_open()
453 res = TEE_ERROR_OUT_OF_MEMORY; in ree_fs_ta_open()
462 res = crypto_hash_update(hash_ctx, (uint8_t *)ehdr, ehdr_sz); in ree_fs_ta_open()
463 if (res != TEE_SUCCESS) in ree_fs_ta_open()
466 res = tee_ta_decrypt_init(&handle->enc_ctx, ehdr, in ree_fs_ta_open()
468 if (res != TEE_SUCCESS) in ree_fs_ta_open()
476 res = TEE_ERROR_SECURITY; in ree_fs_ta_open()
500 FTMN_SET_CHECK_RES_NOT_ZERO(&ftmn, FTMN_INCR1, res); in ree_fs_ta_open()
502 FTMN_STEP_COUNT(incr0_count, 1), res); in ree_fs_ta_open()
503 return res; in ree_fs_ta_open()
534 TEE_Result res; in check_digest() local
539 res = crypto_hash_final(h->hash_ctx, digest, h->shdr->hash_size); in check_digest()
540 if (res != TEE_SUCCESS) { in check_digest()
541 res = TEE_ERROR_SECURITY; in check_digest()
546 res = TEE_ERROR_SECURITY; in check_digest()
549 return res; in check_digest()
559 TEE_Result res = TEE_SUCCESS; in ree_fs_ta_read() local
590 res = tee_ta_decrypt_update(handle->enc_ctx, dst, in ree_fs_ta_read()
592 if (res) { in ree_fs_ta_read()
593 res = TEE_ERROR_SECURITY; in ree_fs_ta_read()
600 res = crypto_hash_update(handle->hash_ctx, dst, n); in ree_fs_ta_read()
601 if (res) { in ree_fs_ta_read()
602 res = TEE_ERROR_SECURITY; in ree_fs_ta_read()
606 res = copy_to_user((uint8_t *)data_user + num_bytes, in ree_fs_ta_read()
608 if (res) { in ree_fs_ta_read()
609 res = TEE_ERROR_SECURITY; in ree_fs_ta_read()
623 res = tee_ta_decrypt_final(handle->enc_ctx, in ree_fs_ta_read()
625 if (res != TEE_SUCCESS) { in ree_fs_ta_read()
626 res = TEE_ERROR_SECURITY; in ree_fs_ta_read()
634 res = check_digest(handle); in ree_fs_ta_read()
635 if (res != TEE_SUCCESS) in ree_fs_ta_read()
639 res = check_update_version(ta_ver_db, in ree_fs_ta_read()
645 return res; in ree_fs_ta_read()
697 TEE_Result res = TEE_SUCCESS; in buf_ta_open() local
703 res = ree_fs_ta_open(uuid, &handle->h); in buf_ta_open()
704 if (!res) in buf_ta_open()
705 FTMN_SET_CHECK_RES_FROM_CALL(&ftmn, FTMN_INCR0, res); in buf_ta_open()
707 if (res) in buf_ta_open()
711 res = ree_fs_ta_get_size(handle->h, &handle->ta_size); in buf_ta_open()
712 if (res) in buf_ta_open()
715 res = ree_fs_ta_get_tag(handle->h, NULL, &handle->tag_len); in buf_ta_open()
716 if (res != TEE_ERROR_SHORT_BUFFER) { in buf_ta_open()
717 res = TEE_ERROR_GENERIC; in buf_ta_open()
722 res = TEE_ERROR_OUT_OF_MEMORY; in buf_ta_open()
725 res = ree_fs_ta_get_tag(handle->h, handle->tag, &handle->tag_len); in buf_ta_open()
726 if (res) in buf_ta_open()
731 res = TEE_ERROR_OUT_OF_MEMORY; in buf_ta_open()
737 res = TEE_ERROR_OUT_OF_MEMORY; in buf_ta_open()
742 res = ree_fs_ta_read(handle->h, handle->buf, NULL, handle->ta_size); in buf_ta_open()
743 if (!res) in buf_ta_open()
744 FTMN_SET_CHECK_RES_FROM_CALL(&ftmn, FTMN_INCR0, res); in buf_ta_open()
746 if (res) in buf_ta_open()
760 return res; in buf_ta_open()
777 TEE_Result res = TEE_SUCCESS; in buf_ta_read() local
787 res = copy_to_user(data_user, src, len); in buf_ta_read()
788 if (res) in buf_ta_read()
789 return res; in buf_ta_read()