Skip to content

Commit

Permalink
eth_wallet/ta: eliminate unwrap()
Browse files Browse the repository at this point in the history
- eliminate unwrap();
- sync ta_static.rs from a6b5cfb
  • Loading branch information
DemesneGH committed Dec 6, 2024
1 parent 3bca04b commit ba94f98
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
7 changes: 3 additions & 4 deletions projects/web3/eth_wallet/ta/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
// under the License.

#![no_main]
#![feature(c_size_t)]

mod hash;
mod secure_storage;
Expand Down Expand Up @@ -144,9 +143,9 @@ fn handle_invoke(command: Command, serialized_input: &[u8]) -> Result<Vec<u8>> {
#[ta_invoke_command]
fn invoke_command(cmd_id: u32, params: &mut Parameters) -> optee_utee::Result<()> {
dbg_println!("[+] TA invoke command");
let mut p0 = unsafe { params.0.as_memref().unwrap() };
let mut p1 = unsafe { params.1.as_memref().unwrap() };
let mut p2 = unsafe { params.2.as_value().unwrap() };
let mut p0 = unsafe { params.0.as_memref()? };
let mut p1 = unsafe { params.1.as_memref()? };
let mut p2 = unsafe { params.2.as_value()? };

let output_vec = match handle_invoke(Command::from(cmd_id), p0.buffer()) {
Ok(output) => output,
Expand Down
6 changes: 3 additions & 3 deletions projects/web3/eth_wallet/ta/ta_static.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// specific language governing permissions and limitations
// under the License.

use core::ffi::*;
use core::ffi::{c_int, c_void};
use core::mem;
use core::primitive::u64;

Expand All @@ -39,13 +39,13 @@ pub static ta_head: optee_utee_sys::ta_head = optee_utee_sys::ta_head {
pub static ta_heap: [u8; TA_DATA_SIZE as usize] = [0; TA_DATA_SIZE as usize];

#[no_mangle]
pub static ta_heap_size: c_size_t = mem::size_of::<u8>() * TA_DATA_SIZE as usize;
pub static ta_heap_size: usize = mem::size_of::<u8>() * TA_DATA_SIZE as usize;
static FLAG_BOOL: bool = (TA_FLAGS & optee_utee_sys::TA_FLAG_SINGLE_INSTANCE) != 0;
static FLAG_MULTI: bool = (TA_FLAGS & optee_utee_sys::TA_FLAG_MULTI_SESSION) != 0;
static FLAG_INSTANCE: bool = (TA_FLAGS & optee_utee_sys::TA_FLAG_INSTANCE_KEEP_ALIVE) != 0;

#[no_mangle]
pub static ta_num_props: c_size_t = 9;
pub static ta_num_props: usize = 9;

#[no_mangle]
pub static ta_props: [optee_utee_sys::user_ta_property; 9] = [
Expand Down

0 comments on commit ba94f98

Please sign in to comment.