Lines Matching refs:res

295 	TEE_Result res = TEE_SUCCESS;  in tee_rpmb_key_gen()  local
298 res = TEE_ERROR_BAD_PARAMETERS; in tee_rpmb_key_gen()
306 return res; in tee_rpmb_key_gen()
364 static void get_op_result_bits(uint8_t *bytes, uint8_t *res) in get_op_result_bits() argument
366 *res = *(bytes + 1) & RPMB_RESULT_MASK; in get_op_result_bits()
374 TEE_Result res = TEE_ERROR_GENERIC; in tee_rpmb_mac_calc() local
381 res = crypto_mac_alloc_ctx(&ctx, TEE_ALG_HMAC_SHA256); in tee_rpmb_mac_calc()
382 if (res) in tee_rpmb_mac_calc()
383 return res; in tee_rpmb_mac_calc()
385 res = crypto_mac_init(ctx, key, keysize); in tee_rpmb_mac_calc()
386 if (res != TEE_SUCCESS) in tee_rpmb_mac_calc()
390 res = crypto_mac_update(ctx, datafrms[i].data, in tee_rpmb_mac_calc()
392 if (res != TEE_SUCCESS) in tee_rpmb_mac_calc()
396 res = crypto_mac_final(ctx, mac, macsize); in tee_rpmb_mac_calc()
397 if (res != TEE_SUCCESS) in tee_rpmb_mac_calc()
400 res = TEE_SUCCESS; in tee_rpmb_mac_calc()
404 return res; in tee_rpmb_mac_calc()
433 TEE_Result res = TEE_SUCCESS; in tee_rpmb_alloc() local
446 res = TEE_ERROR_OUT_OF_MEMORY; in tee_rpmb_alloc()
453 res = TEE_ERROR_GENERIC; in tee_rpmb_alloc()
461 if (res != TEE_SUCCESS) in tee_rpmb_alloc()
463 return res; in tee_rpmb_alloc()
511 TEE_Result res = TEE_SUCCESS; in decrypt() local
533 res = decrypt_block(tmp, frm->data, blk_idx, fek, uuid); in decrypt()
534 if (res == TEE_SUCCESS) in decrypt()
538 res = decrypt_block(out, frm->data, blk_idx, fek, uuid); in decrypt()
542 return res; in decrypt()
550 TEE_Result res = TEE_ERROR_GENERIC; in tee_rpmb_req_pack() local
587 res = TEE_ERROR_GENERIC; in tee_rpmb_req_pack()
603 res = encrypt_block(datafrm[i].data, in tee_rpmb_req_pack()
608 if (res != TEE_SUCCESS) in tee_rpmb_req_pack()
620 res = in tee_rpmb_req_pack()
625 if (res != TEE_SUCCESS) in tee_rpmb_req_pack()
643 res = TEE_SUCCESS; in tee_rpmb_req_pack()
646 return res; in tee_rpmb_req_pack()
653 TEE_Result res; in data_cpy_mac_calc_1b() local
660 res = tee_rpmb_mac_calc(rawdata->key_mac, RPMB_KEY_MAC_SIZE, in data_cpy_mac_calc_1b()
662 if (res != TEE_SUCCESS) in data_cpy_mac_calc_1b()
663 return res; in data_cpy_mac_calc_1b()
668 res = decrypt(data, frm, rawdata->len, rawdata->byte_offset, idx, fek, in data_cpy_mac_calc_1b()
670 return res; in data_cpy_mac_calc_1b()
680 TEE_Result res = TEE_ERROR_GENERIC; in tee_rpmb_data_cpy_mac_calc() local
699 res = crypto_mac_alloc_ctx(&ctx, TEE_ALG_HMAC_SHA256); in tee_rpmb_data_cpy_mac_calc()
700 if (res) in tee_rpmb_data_cpy_mac_calc()
703 res = crypto_mac_init(ctx, rpmb_ctx->key, RPMB_KEY_MAC_SIZE); in tee_rpmb_data_cpy_mac_calc()
704 if (res != TEE_SUCCESS) in tee_rpmb_data_cpy_mac_calc()
723 res = crypto_mac_update(ctx, localfrm.data, in tee_rpmb_data_cpy_mac_calc()
725 if (res != TEE_SUCCESS) in tee_rpmb_data_cpy_mac_calc()
738 res = decrypt(data, &localfrm, size, offset, start_idx + i, in tee_rpmb_data_cpy_mac_calc()
740 if (res != TEE_SUCCESS) in tee_rpmb_data_cpy_mac_calc()
750 res = decrypt(data, lastfrm, size, 0, start_idx + nbr_frms - 1, fek, in tee_rpmb_data_cpy_mac_calc()
752 if (res != TEE_SUCCESS) in tee_rpmb_data_cpy_mac_calc()
756 res = crypto_mac_update(ctx, lastfrm->data, RPMB_MAC_PROTECT_DATA_SIZE); in tee_rpmb_data_cpy_mac_calc()
757 if (res != TEE_SUCCESS) in tee_rpmb_data_cpy_mac_calc()
760 res = crypto_mac_final(ctx, rawdata->key_mac, RPMB_KEY_MAC_SIZE); in tee_rpmb_data_cpy_mac_calc()
761 if (res != TEE_SUCCESS) in tee_rpmb_data_cpy_mac_calc()
764 res = TEE_SUCCESS; in tee_rpmb_data_cpy_mac_calc()
768 return res; in tee_rpmb_data_cpy_mac_calc()
777 TEE_Result res = TEE_ERROR_GENERIC; in tee_rpmb_resp_unpack_verify() local
850 res = tee_rpmb_data_cpy_mac_calc(datafrm, rawdata, in tee_rpmb_resp_unpack_verify()
854 if (res != TEE_SUCCESS) in tee_rpmb_resp_unpack_verify()
855 return res; in tee_rpmb_resp_unpack_verify()
864 res = tee_rpmb_mac_calc(rawdata->key_mac, in tee_rpmb_resp_unpack_verify()
870 if (res != TEE_SUCCESS) in tee_rpmb_resp_unpack_verify()
871 return res; in tee_rpmb_resp_unpack_verify()
891 TEE_Result res = TEE_ERROR_GENERIC; in tee_rpmb_get_dev_info() local
904 res = tee_rpmb_alloc(req_size, resp_size, &mem, in tee_rpmb_get_dev_info()
906 if (res != TEE_SUCCESS) in tee_rpmb_get_dev_info()
915 res = tee_rpmb_invoke(&mem); in tee_rpmb_get_dev_info()
916 if (res != TEE_SUCCESS) in tee_rpmb_get_dev_info()
920 res = TEE_ERROR_GENERIC; in tee_rpmb_get_dev_info()
931 res = TEE_SUCCESS; in tee_rpmb_get_dev_info()
935 return res; in tee_rpmb_get_dev_info()
942 TEE_Result res = TEE_ERROR_GENERIC; in tee_rpmb_init_read_wr_cnt() local
958 res = tee_rpmb_alloc(req_size, resp_size, &mem, in tee_rpmb_init_read_wr_cnt()
960 if (res != TEE_SUCCESS) in tee_rpmb_init_read_wr_cnt()
963 res = crypto_rng_read(nonce, RPMB_NONCE_SIZE); in tee_rpmb_init_read_wr_cnt()
964 if (res != TEE_SUCCESS) in tee_rpmb_init_read_wr_cnt()
973 res = tee_rpmb_req_pack(req, &rawdata, 1, dev_id, NULL, NULL); in tee_rpmb_init_read_wr_cnt()
974 if (res != TEE_SUCCESS) in tee_rpmb_init_read_wr_cnt()
977 res = tee_rpmb_invoke(&mem); in tee_rpmb_init_read_wr_cnt()
978 if (res != TEE_SUCCESS) in tee_rpmb_init_read_wr_cnt()
990 res = tee_rpmb_resp_unpack_verify(resp, &rawdata, 1, NULL, NULL); in tee_rpmb_init_read_wr_cnt()
991 if (res != TEE_SUCCESS) in tee_rpmb_init_read_wr_cnt()
994 res = TEE_SUCCESS; in tee_rpmb_init_read_wr_cnt()
998 return res; in tee_rpmb_init_read_wr_cnt()
1004 TEE_Result res = TEE_ERROR_GENERIC; in tee_rpmb_verify_key_sync_counter() local
1006 res = tee_rpmb_init_read_wr_cnt(dev_id, &rpmb_ctx->wr_cnt, in tee_rpmb_verify_key_sync_counter()
1009 if (res == TEE_SUCCESS) { in tee_rpmb_verify_key_sync_counter()
1013 EMSG("Verify key returning 0x%x", res); in tee_rpmb_verify_key_sync_counter()
1014 return res; in tee_rpmb_verify_key_sync_counter()
1020 TEE_Result res = TEE_ERROR_GENERIC; in tee_rpmb_write_key() local
1031 res = tee_rpmb_alloc(req_size, resp_size, &mem, in tee_rpmb_write_key()
1033 if (res != TEE_SUCCESS) in tee_rpmb_write_key()
1042 res = tee_rpmb_req_pack(req, &rawdata, 1, dev_id, NULL, NULL); in tee_rpmb_write_key()
1043 if (res != TEE_SUCCESS) in tee_rpmb_write_key()
1046 res = tee_rpmb_invoke(&mem); in tee_rpmb_write_key()
1047 if (res != TEE_SUCCESS) in tee_rpmb_write_key()
1055 res = tee_rpmb_resp_unpack_verify(resp, &rawdata, 1, NULL, NULL); in tee_rpmb_write_key()
1056 if (res != TEE_SUCCESS) in tee_rpmb_write_key()
1059 res = TEE_SUCCESS; in tee_rpmb_write_key()
1063 return res; in tee_rpmb_write_key()
1068 TEE_Result res; in tee_rpmb_write_and_verify_key() local
1078 res = tee_rpmb_write_key(dev_id); in tee_rpmb_write_and_verify_key()
1079 if (res == TEE_SUCCESS) { in tee_rpmb_write_and_verify_key()
1081 res = tee_rpmb_verify_key_sync_counter(dev_id); in tee_rpmb_write_and_verify_key()
1083 return res; in tee_rpmb_write_and_verify_key()
1096 TEE_Result res = TEE_SUCCESS; in tee_rpmb_init() local
1118 res = tee_rpmb_get_dev_info(dev_id, &dev_info); in tee_rpmb_init()
1119 if (res != TEE_SUCCESS) in tee_rpmb_init()
1127 res = TEE_ERROR_GENERIC; in tee_rpmb_init()
1134 res = TEE_ERROR_BAD_PARAMETERS; in tee_rpmb_init()
1152 res = tee_rpmb_key_gen(dev_id, rpmb_ctx->key, in tee_rpmb_init()
1154 if (res != TEE_SUCCESS) { in tee_rpmb_init()
1156 res); in tee_rpmb_init()
1167 res = tee_rpmb_verify_key_sync_counter(dev_id); in tee_rpmb_init()
1168 if (res == TEE_ERROR_ITEM_NOT_FOUND && in tee_rpmb_init()
1174 res = tee_rpmb_write_and_verify_key(dev_id); in tee_rpmb_init()
1175 } else if (res != TEE_SUCCESS) { in tee_rpmb_init()
1182 return res; in tee_rpmb_init()
1198 TEE_Result res = TEE_ERROR_GENERIC; in tee_rpmb_read() local
1224 res = tee_rpmb_init(dev_id); in tee_rpmb_read()
1225 if (res != TEE_SUCCESS) in tee_rpmb_read()
1230 res = tee_rpmb_alloc(req_size, resp_size, &mem, in tee_rpmb_read()
1232 if (res != TEE_SUCCESS) in tee_rpmb_read()
1236 res = crypto_rng_read(nonce, RPMB_NONCE_SIZE); in tee_rpmb_read()
1237 if (res != TEE_SUCCESS) in tee_rpmb_read()
1244 res = tee_rpmb_req_pack(req, &rawdata, 1, dev_id, NULL, NULL); in tee_rpmb_read()
1245 if (res != TEE_SUCCESS) in tee_rpmb_read()
1253 res = tee_rpmb_invoke(&mem); in tee_rpmb_read()
1254 if (res != TEE_SUCCESS) in tee_rpmb_read()
1270 res = tee_rpmb_resp_unpack_verify(resp, &rawdata, blkcnt, fek, uuid); in tee_rpmb_read()
1271 if (res != TEE_SUCCESS) in tee_rpmb_read()
1274 res = TEE_SUCCESS; in tee_rpmb_read()
1278 return res; in tee_rpmb_read()
1286 TEE_Result res = TEE_SUCCESS; in write_req() local
1308 res = tee_rpmb_req_pack(req, &rawdata, blkcnt, dev_id, fek, in write_req()
1310 if (res) { in write_req()
1318 return res; in write_req()
1328 res = tee_rpmb_invoke(mem); in write_req()
1329 if (res != TEE_SUCCESS) { in write_req()
1349 res = tee_rpmb_resp_unpack_verify(resp, &rawdata, 1, NULL, in write_req()
1351 if (res != TEE_SUCCESS) { in write_req()
1382 TEE_Result res; in tee_rpmb_write_blk() local
1399 res = tee_rpmb_init(dev_id); in tee_rpmb_write_blk()
1400 if (res != TEE_SUCCESS) in tee_rpmb_write_blk()
1401 return res; in tee_rpmb_write_blk()
1415 res = tee_rpmb_alloc(req_size, resp_size, &mem, in tee_rpmb_write_blk()
1417 if (res != TEE_SUCCESS) in tee_rpmb_write_blk()
1418 return res; in tee_rpmb_write_blk()
1437 res = write_req(dev_id, tmp_blk_idx, data_blks + offs, in tee_rpmb_write_blk()
1439 if (res) in tee_rpmb_write_blk()
1448 return res; in tee_rpmb_write_blk()
1474 TEE_Result res = TEE_ERROR_GENERIC; in tee_rpmb_write() local
1487 res = tee_rpmb_write_blk(dev_id, blk_idx, data, blkcnt, fek, in tee_rpmb_write()
1489 if (res != TEE_SUCCESS) in tee_rpmb_write()
1494 res = TEE_ERROR_OUT_OF_MEMORY; in tee_rpmb_write()
1499 res = tee_rpmb_read(dev_id, blk_idx * RPMB_DATA_SIZE, data_tmp, in tee_rpmb_write()
1501 if (res != TEE_SUCCESS) in tee_rpmb_write()
1507 res = tee_rpmb_write_blk(dev_id, blk_idx, data_tmp, blkcnt, in tee_rpmb_write()
1509 if (res != TEE_SUCCESS) in tee_rpmb_write()
1513 res = TEE_SUCCESS; in tee_rpmb_write()
1517 return res; in tee_rpmb_write()
1529 TEE_Result res = TEE_SUCCESS; in tee_rpmb_get_write_counter() local
1538 res = tee_rpmb_init(dev_id); in tee_rpmb_get_write_counter()
1539 if (res != TEE_SUCCESS) in tee_rpmb_get_write_counter()
1546 return res; in tee_rpmb_get_write_counter()
1557 TEE_Result res = TEE_SUCCESS; in tee_rpmb_get_max_block() local
1566 res = tee_rpmb_init(dev_id); in tee_rpmb_get_max_block()
1567 if (res != TEE_SUCCESS) in tee_rpmb_get_max_block()
1574 return res; in tee_rpmb_get_max_block()
1604 TEE_Result res = TEE_ERROR_GENERIC; in fat_entry_dir_init() local
1612 res = rpmb_fs_setup(); in fat_entry_dir_init()
1613 if (res) in fat_entry_dir_init()
1614 return res; in fat_entry_dir_init()
1616 res = get_fat_start_address(&fat_address); in fat_entry_dir_init()
1617 if (res) in fat_entry_dir_init()
1618 return res; in fat_entry_dir_init()
1640 res = TEE_ERROR_OUT_OF_MEMORY; in fat_entry_dir_init()
1644 res = tee_rpmb_read(CFG_RPMB_FS_DEV_ID, fat_address, (uint8_t *)fe, in fat_entry_dir_init()
1646 if (res) in fat_entry_dir_init()
1661 return res; in fat_entry_dir_init()
1755 TEE_Result res = TEE_ERROR_GENERIC; in fat_entry_dir_get_next() local
1789 res = tee_rpmb_read(CFG_RPMB_FS_DEV_ID, in fat_entry_dir_get_next()
1793 if (res) in fat_entry_dir_get_next()
1794 return res; in fat_entry_dir_get_next()
1825 res = tee_rpmb_read(CFG_RPMB_FS_DEV_ID, in fat_entry_dir_get_next()
1831 if (res) in fat_entry_dir_get_next()
1832 return res; in fat_entry_dir_get_next()
1850 res = tee_rpmb_read(CFG_RPMB_FS_DEV_ID, in fat_entry_dir_get_next()
1856 if (res) in fat_entry_dir_get_next()
1857 return res; in fat_entry_dir_get_next()
1883 TEE_Result res = TEE_ERROR_SECURITY; in dump_fat() local
1893 res = fat_entry_dir_get_next(&fe, NULL); in dump_fat()
1894 if (res || !fe) in dump_fat()
1991 TEE_Result res = TEE_ERROR_GENERIC; in write_fat_entry() local
1995 res = TEE_ERROR_ACCESS_CONFLICT; in write_fat_entry()
2000 res = TEE_ERROR_BAD_PARAMETERS; in write_fat_entry()
2005 res = tee_rpmb_get_write_counter(CFG_RPMB_FS_DEV_ID, in write_fat_entry()
2007 if (res) in write_fat_entry()
2011 res = tee_rpmb_write(CFG_RPMB_FS_DEV_ID, fh->rpmb_fat_address, in write_fat_entry()
2018 if (CFG_RPMB_FS_CACHE_ENTRIES && !res) in write_fat_entry()
2019 res = fat_entry_dir_update(&fh->fat_entry, in write_fat_entry()
2023 return res; in write_fat_entry()
2033 TEE_Result res = TEE_ERROR_GENERIC; in rpmb_fs_setup() local
2039 res = TEE_SUCCESS; in rpmb_fs_setup()
2043 res = tee_rpmb_get_max_block(CFG_RPMB_FS_DEV_ID, &max_rpmb_block); in rpmb_fs_setup()
2044 if (res != TEE_SUCCESS) in rpmb_fs_setup()
2055 res = TEE_ERROR_OUT_OF_MEMORY; in rpmb_fs_setup()
2059 res = tee_rpmb_read(CFG_RPMB_FS_DEV_ID, RPMB_STORAGE_START_ADDRESS, in rpmb_fs_setup()
2062 if (res != TEE_SUCCESS) in rpmb_fs_setup()
2069 res = tee_rpmb_write(CFG_RPMB_FS_DEV_ID, RPMB_STORAGE_START_ADDRESS, in rpmb_fs_setup()
2072 if (res != TEE_SUCCESS) in rpmb_fs_setup()
2080 res = tee_rpmb_read(CFG_RPMB_FS_DEV_ID, RPMB_STORAGE_START_ADDRESS, in rpmb_fs_setup()
2083 if (res != TEE_SUCCESS) in rpmb_fs_setup()
2089 res = TEE_SUCCESS; in rpmb_fs_setup()
2093 res = TEE_ERROR_ACCESS_DENIED; in rpmb_fs_setup()
2109 res = TEE_ERROR_OUT_OF_MEMORY; in rpmb_fs_setup()
2116 res = write_fat_entry(fh, true); in rpmb_fs_setup()
2117 if (res != TEE_SUCCESS) in rpmb_fs_setup()
2120 res = in rpmb_fs_setup()
2123 if (res != TEE_SUCCESS) in rpmb_fs_setup()
2125 res = tee_rpmb_write(CFG_RPMB_FS_DEV_ID, RPMB_STORAGE_START_ADDRESS, in rpmb_fs_setup()
2136 res = TEE_ERROR_OUT_OF_MEMORY; in rpmb_fs_setup()
2148 return res; in rpmb_fs_setup()
2173 TEE_Result res = TEE_ERROR_GENERIC; in read_fat() local
2183 res = fat_entry_dir_init(); in read_fat()
2184 if (res) in read_fat()
2194 res = fat_entry_dir_get_next(&fe, &fat_address); in read_fat()
2195 if (res || !fe) in read_fat()
2218 res = TEE_ERROR_OUT_OF_MEMORY; in read_fat()
2248 if (res) in read_fat()
2266 res = TEE_ERROR_OUT_OF_MEMORY; in read_fat()
2279 res = write_fat_entry(&last_fh, true); in read_fat()
2280 if (res != TEE_SUCCESS) in read_fat()
2286 res = TEE_ERROR_ITEM_NOT_FOUND; in read_fat()
2290 return res; in read_fat()
2295 TEE_Result res; in generate_fek() local
2298 res = tee_fs_generate_fek(uuid, fe->fek, sizeof(fe->fek)); in generate_fek()
2299 if (res != TEE_SUCCESS) in generate_fek()
2300 return res; in generate_fek()
2305 return res; in generate_fek()
2313 TEE_Result res = TEE_ERROR_GENERIC; in rpmb_fs_open_internal() local
2316 res = rpmb_fs_setup(); in rpmb_fs_open_internal()
2317 if (res != TEE_SUCCESS) in rpmb_fs_open_internal()
2330 res = TEE_ERROR_OUT_OF_MEMORY; in rpmb_fs_open_internal()
2334 res = read_fat(fh, &p); in rpmb_fs_open_internal()
2336 if (res != TEE_SUCCESS) in rpmb_fs_open_internal()
2339 res = read_fat(fh, NULL); in rpmb_fs_open_internal()
2340 if (res != TEE_SUCCESS) in rpmb_fs_open_internal()
2357 res = generate_fek(&fh->fat_entry, uuid); in rpmb_fs_open_internal()
2358 if (res != TEE_SUCCESS) in rpmb_fs_open_internal()
2364 res = write_fat_entry(fh, true); in rpmb_fs_open_internal()
2365 if (res != TEE_SUCCESS) in rpmb_fs_open_internal()
2370 res = TEE_SUCCESS; in rpmb_fs_open_internal()
2373 return res; in rpmb_fs_open_internal()
2387 TEE_Result res; in rpmb_fs_read() local
2398 res = read_fat(fh, NULL); in rpmb_fs_read()
2399 if (res != TEE_SUCCESS) in rpmb_fs_read()
2409 res = tee_rpmb_read(CFG_RPMB_FS_DEV_ID, in rpmb_fs_read()
2412 if (res != TEE_SUCCESS) in rpmb_fs_read()
2419 return res; in rpmb_fs_read()
2434 TEE_Result res = TEE_SUCCESS; in update_write_helper() local
2452 res = tee_rpmb_read(CFG_RPMB_FS_DEV_ID, in update_write_helper()
2456 if (res != TEE_SUCCESS) in update_write_helper()
2482 res = tee_rpmb_write(CFG_RPMB_FS_DEV_ID, new_fat + blk_offset, in update_write_helper()
2485 if (res != TEE_SUCCESS) in update_write_helper()
2493 return res; in update_write_helper()
2500 TEE_Result res = TEE_ERROR_GENERIC; in rpmb_fs_write_primitive() local
2510 res = TEE_ERROR_GENERIC; in rpmb_fs_write_primitive()
2523 res = TEE_ERROR_OUT_OF_MEMORY; in rpmb_fs_write_primitive()
2527 res = read_fat(fh, &p); in rpmb_fs_write_primitive()
2528 if (res != TEE_SUCCESS) in rpmb_fs_write_primitive()
2535 res = TEE_ERROR_BAD_PARAMETERS; in rpmb_fs_write_primitive()
2539 res = TEE_ERROR_BAD_PARAMETERS; in rpmb_fs_write_primitive()
2547 res = tee_rpmb_write(CFG_RPMB_FS_DEV_ID, start_addr, buf, in rpmb_fs_write_primitive()
2561 res = TEE_ERROR_STORAGE_NO_SPACE; in rpmb_fs_write_primitive()
2567 res = update_write_helper(fh, pos, buf, size, in rpmb_fs_write_primitive()
2569 if (res == TEE_SUCCESS) { in rpmb_fs_write_primitive()
2573 res = write_fat_entry(fh, true); in rpmb_fs_write_primitive()
2581 return res; in rpmb_fs_write_primitive()
2587 TEE_Result res; in rpmb_fs_write() local
2590 res = rpmb_fs_write_primitive((struct rpmb_file_handle *)tfh, pos, in rpmb_fs_write()
2594 return res; in rpmb_fs_write()
2599 TEE_Result res; in rpmb_fs_remove_internal() local
2601 res = read_fat(fh, NULL); in rpmb_fs_remove_internal()
2602 if (res) in rpmb_fs_remove_internal()
2603 return res; in rpmb_fs_remove_internal()
2612 TEE_Result res; in rpmb_fs_remove() local
2620 res = rpmb_fs_remove_internal(fh); in rpmb_fs_remove()
2625 return res; in rpmb_fs_remove()
2632 TEE_Result res = TEE_ERROR_GENERIC; in rpmb_fs_rename_internal() local
2637 res = TEE_ERROR_BAD_PARAMETERS; in rpmb_fs_rename_internal()
2646 res = TEE_ERROR_OUT_OF_MEMORY; in rpmb_fs_rename_internal()
2655 res = TEE_ERROR_OUT_OF_MEMORY; in rpmb_fs_rename_internal()
2659 res = read_fat(fh_old, NULL); in rpmb_fs_rename_internal()
2660 if (res != TEE_SUCCESS) in rpmb_fs_rename_internal()
2663 res = read_fat(fh_new, NULL); in rpmb_fs_rename_internal()
2664 if (res == TEE_SUCCESS) { in rpmb_fs_rename_internal()
2666 res = TEE_ERROR_ACCESS_CONFLICT; in rpmb_fs_rename_internal()
2672 res = write_fat_entry(fh_new, false); in rpmb_fs_rename_internal()
2673 if (res != TEE_SUCCESS) in rpmb_fs_rename_internal()
2681 res = write_fat_entry(fh_old, false); in rpmb_fs_rename_internal()
2687 return res; in rpmb_fs_rename_internal()
2693 TEE_Result res; in rpmb_fs_rename() local
2696 res = rpmb_fs_rename_internal(old, new, overwrite); in rpmb_fs_rename()
2699 return res; in rpmb_fs_rename()
2711 TEE_Result res = TEE_ERROR_GENERIC; in rpmb_fs_truncate() local
2716 res = TEE_ERROR_BAD_PARAMETERS; in rpmb_fs_truncate()
2721 res = read_fat(fh, NULL); in rpmb_fs_truncate()
2722 if (res != TEE_SUCCESS) in rpmb_fs_truncate()
2734 res = TEE_ERROR_OUT_OF_MEMORY; in rpmb_fs_truncate()
2737 res = read_fat(fh, &p); in rpmb_fs_truncate()
2738 if (res != TEE_SUCCESS) in rpmb_fs_truncate()
2744 res = TEE_ERROR_OUT_OF_MEMORY; in rpmb_fs_truncate()
2749 res = tee_rpmb_read(CFG_RPMB_FS_DEV_ID, in rpmb_fs_truncate()
2753 if (res != TEE_SUCCESS) in rpmb_fs_truncate()
2758 res = tee_rpmb_write(CFG_RPMB_FS_DEV_ID, newaddr, newbuf, in rpmb_fs_truncate()
2760 if (res != TEE_SUCCESS) in rpmb_fs_truncate()
2771 res = write_fat_entry(fh, true); in rpmb_fs_truncate()
2780 return res; in rpmb_fs_truncate()
2809 TEE_Result res = TEE_ERROR_GENERIC; in rpmb_fs_dir_populate() local
2814 res = fat_entry_dir_init(); in rpmb_fs_dir_populate()
2815 if (res) in rpmb_fs_dir_populate()
2821 res = fat_entry_dir_get_next(&fe, &fat_address); in rpmb_fs_dir_populate()
2822 if (res || !fe) in rpmb_fs_dir_populate()
2841 res = TEE_ERROR_OUT_OF_MEMORY; in rpmb_fs_dir_populate()
2862 if (res) in rpmb_fs_dir_populate()
2866 res = TEE_SUCCESS; in rpmb_fs_dir_populate()
2868 res = TEE_ERROR_ITEM_NOT_FOUND; /* No directories were found. */ in rpmb_fs_dir_populate()
2873 if (res) in rpmb_fs_dir_populate()
2876 return res; in rpmb_fs_dir_populate()
2883 TEE_Result res = TEE_ERROR_GENERIC; in rpmb_fs_opendir() local
2887 res = TEE_ERROR_BAD_PARAMETERS; in rpmb_fs_opendir()
2893 res = TEE_ERROR_BAD_PARAMETERS; in rpmb_fs_opendir()
2904 res = TEE_ERROR_OUT_OF_MEMORY; in rpmb_fs_opendir()
2909 res = rpmb_fs_dir_populate(path_local, rpmb_dir); in rpmb_fs_opendir()
2910 if (res != TEE_SUCCESS) { in rpmb_fs_opendir()
2919 return res; in rpmb_fs_opendir()
2951 TEE_Result res; in rpmb_fs_open() local
2959 res = rpmb_fs_open_internal(fh, &po->uuid, false); in rpmb_fs_open()
2960 if (!res && size) in rpmb_fs_open()
2965 if (res) in rpmb_fs_open()
2970 return res; in rpmb_fs_open()
2979 TEE_Result res; in rpmb_fs_create() local
2987 res = rpmb_fs_open_internal(fh, &po->uuid, true); in rpmb_fs_create()
2988 if (res) in rpmb_fs_create()
2992 res = rpmb_fs_write_primitive(fh, pos, head, head_size); in rpmb_fs_create()
2993 if (res) in rpmb_fs_create()
2999 res = rpmb_fs_write_primitive(fh, pos, attr, attr_size); in rpmb_fs_create()
3000 if (res) in rpmb_fs_create()
3006 res = rpmb_fs_write_primitive(fh, pos, data, data_size); in rpmb_fs_create()
3007 if (res) in rpmb_fs_create()
3018 res = rpmb_fs_rename_internal(po, NULL, overwrite); in rpmb_fs_create()
3019 if (res) { in rpmb_fs_create()
3028 if (res) { in rpmb_fs_create()
3036 return res; in rpmb_fs_create()
3056 TEE_Result res; in tee_rpmb_fs_raw_open() local
3067 res = rpmb_fs_open_internal(fh, &uuid, create); in tee_rpmb_fs_raw_open()
3071 if (res) { in tee_rpmb_fs_raw_open()
3079 return res; in tee_rpmb_fs_raw_open()