1 // Licensed to the Apache Software Foundation (ASF) under one 2 // or more contributor license agreements. See the NOTICE file 3 // distributed with this work for additional information 4 // regarding copyright ownership. The ASF licenses this file 5 // to you under the Apache License, Version 2.0 (the 6 // "License"); you may not use this file except in compliance 7 // with the License. You may obtain a copy of the License at 8 // 9 // http://www.apache.org/licenses/LICENSE-2.0 10 // 11 // Unless required by applicable law or agreed to in writing, 12 // software distributed under the License is distributed on an 13 // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 // KIND, either express or implied. See the License for the 15 // specific language governing permissions and limitations 16 // under the License. 17 18 use super::*; 19 use libc::*; 20 21 extern "C" { _utee_return(ret: c_ulong) -> !22 pub fn _utee_return(ret: c_ulong) -> !; _utee_log(buf: *const c_void, len: size_t)23 pub fn _utee_log(buf: *const c_void, len: size_t); _utee_panic(code: c_ulong)24 pub fn _utee_panic(code: c_ulong); _utee_get_property( prop_set: c_ulong, index: c_ulong, name: *mut c_void, name_len: *mut u32, buf: *mut c_void, blen: *mut u32, prop_type: *mut u32, ) -> TEE_Result25 pub fn _utee_get_property( 26 prop_set: c_ulong, 27 index: c_ulong, 28 name: *mut c_void, 29 name_len: *mut u32, 30 buf: *mut c_void, 31 blen: *mut u32, 32 prop_type: *mut u32, 33 ) -> TEE_Result; _utee_get_property_name_to_index( prop_set: c_ulong, name: *const c_void, name_len: c_ulong, index: *mut u32, ) -> TEE_Result34 pub fn _utee_get_property_name_to_index( 35 prop_set: c_ulong, 36 name: *const c_void, 37 name_len: c_ulong, 38 index: *mut u32, 39 ) -> TEE_Result; _utee_open_ta_session( dest: *const TEE_UUID, cancel_req_to: c_ulong, params: *mut utee_params, sess: *mut u32, ret_orig: *mut u32, ) -> TEE_Result40 pub fn _utee_open_ta_session( 41 dest: *const TEE_UUID, 42 cancel_req_to: c_ulong, 43 params: *mut utee_params, 44 sess: *mut u32, 45 ret_orig: *mut u32, 46 ) -> TEE_Result; _utee_close_ta_session(sess: c_ulong) -> TEE_Result47 pub fn _utee_close_ta_session(sess: c_ulong) -> TEE_Result; _utee_invoke_ta_command( sess: c_ulong, cancel_req_to: c_ulong, cmd_id: c_ulong, params: *mut utee_params, ret_orig: *mut u32, ) -> TEE_Result48 pub fn _utee_invoke_ta_command( 49 sess: c_ulong, 50 cancel_req_to: c_ulong, 51 cmd_id: c_ulong, 52 params: *mut utee_params, 53 ret_orig: *mut u32, 54 ) -> TEE_Result; _utee_check_access_rights(flags: u32, buf: *const c_void, len: size_t) -> TEE_Result55 pub fn _utee_check_access_rights(flags: u32, buf: *const c_void, len: size_t) 56 -> TEE_Result; _utee_get_cancellation_flag(cancel: *mut u32) -> TEE_Result57 pub fn _utee_get_cancellation_flag(cancel: *mut u32) -> TEE_Result; _utee_unmask_cancellation(old_mask: *mut u32) -> TEE_Result58 pub fn _utee_unmask_cancellation(old_mask: *mut u32) -> TEE_Result; _utee_mask_cancellation(old_mask: *mut u32) -> TEE_Result59 pub fn _utee_mask_cancellation(old_mask: *mut u32) -> TEE_Result; _utee_wait(timeout: c_ulong) -> TEE_Result60 pub fn _utee_wait(timeout: c_ulong) -> TEE_Result; _utee_get_time(cat: c_ulong, time: *mut TEE_Time) -> TEE_Result61 pub fn _utee_get_time(cat: c_ulong, time: *mut TEE_Time) -> TEE_Result; _utee_set_ta_time(time: *const TEE_Time) -> TEE_Result62 pub fn _utee_set_ta_time(time: *const TEE_Time) -> TEE_Result; _utee_cryp_state_alloc( algo: c_ulong, op_mode: c_ulong, key1: c_ulong, key2: c_ulong, state: *mut u32, ) -> TEE_Result63 pub fn _utee_cryp_state_alloc( 64 algo: c_ulong, 65 op_mode: c_ulong, 66 key1: c_ulong, 67 key2: c_ulong, 68 state: *mut u32, 69 ) -> TEE_Result; _utee_cryp_state_copy(dst: c_ulong, src: c_ulong) -> TEE_Result70 pub fn _utee_cryp_state_copy(dst: c_ulong, src: c_ulong) -> TEE_Result; _utee_cryp_state_free(state: c_ulong) -> TEE_Result71 pub fn _utee_cryp_state_free(state: c_ulong) -> TEE_Result; _utee_hash_init(state: c_ulong, iv: *const c_void, iv_len: size_t) -> TEE_Result72 pub fn _utee_hash_init(state: c_ulong, iv: *const c_void, iv_len: size_t) -> TEE_Result; _utee_hash_update(state: c_ulong, chunk: *const c_void, chunk_size: size_t) -> TEE_Result73 pub fn _utee_hash_update(state: c_ulong, chunk: *const c_void, chunk_size: size_t) 74 -> TEE_Result; _utee_hash_final( state: c_ulong, chunk: *const c_void, chunk_size: size_t, hash: *mut c_void, hash_len: *mut u64, ) -> TEE_Result75 pub fn _utee_hash_final( 76 state: c_ulong, 77 chunk: *const c_void, 78 chunk_size: size_t, 79 hash: *mut c_void, 80 hash_len: *mut u64, 81 ) -> TEE_Result; _utee_cipher_init(state: c_ulong, iv: *const c_void, iv_len: size_t) -> TEE_Result82 pub fn _utee_cipher_init(state: c_ulong, iv: *const c_void, iv_len: size_t) -> TEE_Result; _utee_cipher_update( state: c_ulong, src: *const c_void, src_len: size_t, dest: *mut c_void, dest_len: *mut u64, ) -> TEE_Result83 pub fn _utee_cipher_update( 84 state: c_ulong, 85 src: *const c_void, 86 src_len: size_t, 87 dest: *mut c_void, 88 dest_len: *mut u64, 89 ) -> TEE_Result; _utee_cipher_final( state: c_ulong, src: *const c_void, src_len: size_t, dest: *mut c_void, dest_len: *mut u64, ) -> TEE_Result90 pub fn _utee_cipher_final( 91 state: c_ulong, 92 src: *const c_void, 93 src_len: size_t, 94 dest: *mut c_void, 95 dest_len: *mut u64, 96 ) -> TEE_Result; _utee_cryp_obj_get_info(obj: c_ulong, info: *mut TEE_ObjectInfo) -> TEE_Result97 pub fn _utee_cryp_obj_get_info(obj: c_ulong, info: *mut TEE_ObjectInfo) -> TEE_Result; _utee_cryp_obj_restrict_usage(obj: c_ulong, usage: c_ulong) -> TEE_Result98 pub fn _utee_cryp_obj_restrict_usage(obj: c_ulong, usage: c_ulong) -> TEE_Result; _utee_cryp_obj_get_attr( obj: c_ulong, attr_id: c_ulong, buffer: *mut c_void, size: *mut u64, ) -> TEE_Result99 pub fn _utee_cryp_obj_get_attr( 100 obj: c_ulong, 101 attr_id: c_ulong, 102 buffer: *mut c_void, 103 size: *mut u64, 104 ) -> TEE_Result; _utee_cryp_obj_alloc(ttype: c_ulong, max_size: c_ulong, obj: *mut u32) -> TEE_Result105 pub fn _utee_cryp_obj_alloc(ttype: c_ulong, max_size: c_ulong, obj: *mut u32) 106 -> TEE_Result; _utee_cryp_obj_close(obj: c_ulong) -> TEE_Result107 pub fn _utee_cryp_obj_close(obj: c_ulong) -> TEE_Result; _utee_cryp_obj_reset(obj: c_ulong) -> TEE_Result108 pub fn _utee_cryp_obj_reset(obj: c_ulong) -> TEE_Result; _utee_cryp_obj_populate( obj: c_ulong, attrs: *mut utee_attribute, attr_count: c_ulong, ) -> TEE_Result109 pub fn _utee_cryp_obj_populate( 110 obj: c_ulong, 111 attrs: *mut utee_attribute, 112 attr_count: c_ulong, 113 ) -> TEE_Result; _utee_cryp_obj_copy(dst_obj: c_ulong, src_obj: c_ulong) -> TEE_Result114 pub fn _utee_cryp_obj_copy(dst_obj: c_ulong, src_obj: c_ulong) -> TEE_Result; _utee_cryp_obj_generate_key( obj: c_ulong, key_size: c_ulong, params: *const utee_attribute, param_count: c_ulong, ) -> TEE_Result115 pub fn _utee_cryp_obj_generate_key( 116 obj: c_ulong, 117 key_size: c_ulong, 118 params: *const utee_attribute, 119 param_count: c_ulong, 120 ) -> TEE_Result; _utee_cryp_derive_key( state: c_ulong, params: *const utee_attribute, param_count: c_ulong, derived_key: c_ulong, ) -> TEE_Result121 pub fn _utee_cryp_derive_key( 122 state: c_ulong, 123 params: *const utee_attribute, 124 param_count: c_ulong, 125 derived_key: c_ulong, 126 ) -> TEE_Result; _utee_cryp_random_number_generate(buf: *mut c_void, blen: size_t) -> TEE_Result127 pub fn _utee_cryp_random_number_generate(buf: *mut c_void, blen: size_t) -> TEE_Result; _utee_authenc_init( state: c_ulong, nonce: *const c_void, nonce_len: size_t, tag_len: size_t, aad_len: size_t, payload_len: size_t, ) -> TEE_Result128 pub fn _utee_authenc_init( 129 state: c_ulong, 130 nonce: *const c_void, 131 nonce_len: size_t, 132 tag_len: size_t, 133 aad_len: size_t, 134 payload_len: size_t, 135 ) -> TEE_Result; _utee_authenc_update_aad( state: c_ulong, aad_data: *const c_void, aad_data_len: size_t, ) -> TEE_Result136 pub fn _utee_authenc_update_aad( 137 state: c_ulong, 138 aad_data: *const c_void, 139 aad_data_len: size_t, 140 ) -> TEE_Result; _utee_authenc_update_payload( state: c_ulong, src_data: *const c_void, src_len: size_t, dest_data: *mut c_void, dest_len: *mut u64, ) -> TEE_Result141 pub fn _utee_authenc_update_payload( 142 state: c_ulong, 143 src_data: *const c_void, 144 src_len: size_t, 145 dest_data: *mut c_void, 146 dest_len: *mut u64, 147 ) -> TEE_Result; _utee_authenc_enc_final( state: c_ulong, src_data: *const c_void, src_len: size_t, dest_data: *mut c_void, dest_len: *mut u64, tag: *mut c_void, tag_len: *mut u64, ) -> TEE_Result148 pub fn _utee_authenc_enc_final( 149 state: c_ulong, 150 src_data: *const c_void, 151 src_len: size_t, 152 dest_data: *mut c_void, 153 dest_len: *mut u64, 154 tag: *mut c_void, 155 tag_len: *mut u64, 156 ) -> TEE_Result; _utee_authenc_dec_final( state: c_ulong, src_data: *const c_void, src_len: size_t, dest_data: *mut c_void, dest_len: *mut u64, tag: *const c_void, tag_len: size_t, ) -> TEE_Result157 pub fn _utee_authenc_dec_final( 158 state: c_ulong, 159 src_data: *const c_void, 160 src_len: size_t, 161 dest_data: *mut c_void, 162 dest_len: *mut u64, 163 tag: *const c_void, 164 tag_len: size_t, 165 ) -> TEE_Result; _utee_asymm_operate( state: c_ulong, params: *const utee_attribute, num_params: c_ulong, src_data: *const c_void, src_len: size_t, dest_data: *mut c_void, dest_len: *mut u64, ) -> TEE_Result166 pub fn _utee_asymm_operate( 167 state: c_ulong, 168 params: *const utee_attribute, 169 num_params: c_ulong, 170 src_data: *const c_void, 171 src_len: size_t, 172 dest_data: *mut c_void, 173 dest_len: *mut u64, 174 ) -> TEE_Result; _utee_asymm_verify( state: c_ulong, params: *const utee_attribute, num_params: c_ulong, data: *const c_void, data_len: size_t, sig: *const c_void, sig_len: size_t, ) -> TEE_Result175 pub fn _utee_asymm_verify( 176 state: c_ulong, 177 params: *const utee_attribute, 178 num_params: c_ulong, 179 data: *const c_void, 180 data_len: size_t, 181 sig: *const c_void, 182 sig_len: size_t, 183 ) -> TEE_Result; _utee_storage_obj_open( storage_id: c_ulong, object_id: *const c_void, object_id_len: size_t, flags: c_ulong, obj: *mut u32, ) -> TEE_Result184 pub fn _utee_storage_obj_open( 185 storage_id: c_ulong, 186 object_id: *const c_void, 187 object_id_len: size_t, 188 flags: c_ulong, 189 obj: *mut u32, 190 ) -> TEE_Result; _utee_storage_obj_create( storage_id: c_ulong, object_id: *const c_void, object_id_len: size_t, flags: c_ulong, attr: c_ulong, data: *const c_void, len: size_t, obj: *mut u32, ) -> TEE_Result191 pub fn _utee_storage_obj_create( 192 storage_id: c_ulong, 193 object_id: *const c_void, 194 object_id_len: size_t, 195 flags: c_ulong, 196 attr: c_ulong, 197 data: *const c_void, 198 len: size_t, 199 obj: *mut u32, 200 ) -> TEE_Result; _utee_storage_obj_del(obj: c_ulong) -> TEE_Result201 pub fn _utee_storage_obj_del(obj: c_ulong) -> TEE_Result; _utee_storage_obj_rename( obj: c_ulong, new_obj_id: *const c_void, new_obj_id_len: size_t, ) -> TEE_Result202 pub fn _utee_storage_obj_rename( 203 obj: c_ulong, 204 new_obj_id: *const c_void, 205 new_obj_id_len: size_t, 206 ) -> TEE_Result; _utee_storage_alloc_enum(obj_enum: *mut u32) -> TEE_Result207 pub fn _utee_storage_alloc_enum(obj_enum: *mut u32) -> TEE_Result; _utee_storage_free_enum(obj_enum: c_ulong) -> TEE_Result208 pub fn _utee_storage_free_enum(obj_enum: c_ulong) -> TEE_Result; _utee_storage_reset_enum(obj_enum: c_ulong) -> TEE_Result209 pub fn _utee_storage_reset_enum(obj_enum: c_ulong) -> TEE_Result; _utee_storage_start_enum(obj_enum: c_ulong, storage_id: c_ulong) -> TEE_Result210 pub fn _utee_storage_start_enum(obj_enum: c_ulong, storage_id: c_ulong) -> TEE_Result; _utee_storage_next_enum( obj_enum: c_ulong, info: *mut TEE_ObjectInfo, obj_id: *mut c_void, len: *mut u64, ) -> TEE_Result211 pub fn _utee_storage_next_enum( 212 obj_enum: c_ulong, 213 info: *mut TEE_ObjectInfo, 214 obj_id: *mut c_void, 215 len: *mut u64, 216 ) -> TEE_Result; _utee_storage_obj_read( obj: c_ulong, data: *mut c_void, len: size_t, count: *mut u64, ) -> TEE_Result217 pub fn _utee_storage_obj_read( 218 obj: c_ulong, 219 data: *mut c_void, 220 len: size_t, 221 count: *mut u64, 222 ) -> TEE_Result; _utee_storage_obj_write(obj: c_ulong, data: *const c_void, len: size_t) -> TEE_Result223 pub fn _utee_storage_obj_write(obj: c_ulong, data: *const c_void, len: size_t) -> TEE_Result; _utee_storage_obj_trunc(obj: c_ulong, len: size_t) -> TEE_Result224 pub fn _utee_storage_obj_trunc(obj: c_ulong, len: size_t) -> TEE_Result; _utee_storage_obj_seek(obj: c_ulong, offset: i32, whence: c_ulong) -> TEE_Result225 pub fn _utee_storage_obj_seek(obj: c_ulong, offset: i32, whence: c_ulong) -> TEE_Result; _utee_cache_operation(va: *mut c_void, l: size_t, op: c_ulong) -> TEE_Result226 pub fn _utee_cache_operation(va: *mut c_void, l: size_t, op: c_ulong) -> TEE_Result; 227 // unimplemented syscall 228 // pub fn utee_gprof_send(buf: *mut c_void, size: size_t, id: *mut u32) -> TEE_Result; 229 } 230