My Project
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
secure_api.h
Go to the documentation of this file.
1 /*
2  * OpenVirtualization:
3  * For additional details and support contact developer@sierraware.com.
4  * Additional documentation can be found at www.openvirtualization.org
5  *
6  * Copyright (C) 2010-2014 SierraWare
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21  *
22  */
23 /*
24  * Helper API declarations for secure kernel
25  */
26 
27 #ifndef __OTZ_SECURE_API_H_
28 #define __OTZ_SECURE_API_H_
29 
30 #include <sw_types.h>
31 #include <otz_common.h>
32 #include <task.h>
33 
38  unsigned int len;
39  void* data;
41 };
42 
47  void *req_addr;
48  unsigned int req_len;
49  void *res_addr;
50  unsigned int res_len;
51 
56 };
57 
71 int open_session_from_ns(void *param);
72 
73 
86 int close_session_from_ns(void *param);
87 
100 int sa_create_entry_point(int svc_id, sa_config_t *psa_config);
101 
102 
117 int sa_destroy_entry_point(int svc_id, void *data, int elf_flag);
118 
133 int sa_open_session(sa_config_t *psa_config, void *session_context);
134 
148 int sa_close_session(void *session_context);
149 
159 void get_api_context(int *svc_id, int *task_id, int *cmd_id, int *cmd_type);
160 
161 
184 int decode_data(void *data,
185  struct otzc_encode_meta *meta_data,
186  int *type, int *offset, int *pos,
187  int *mapped, void **out_data, int *out_len);
188 
200 int update_response_len(struct otzc_encode_meta *meta_data, int pos, int len);
201 
216 int open_session_from_secure(int svc_id, int *session_id);
217 
232 int close_session_from_secure(int svc_id, int session_id);
233 
247 int ipc_connect(int svc_id, int *session_id);
248 
262 int ipc_disconnect(int svc_id, int session_id);
263 
283 int ipc_send(int src_svc_id, int src_context, int svc_id,
284  int session_id, int cmd_id,
285  struct otz_secure_encode_ctx *enc_ctx,
286  struct otzc_encode_meta *meta_data);
287 
306 int otz_encode_data(struct otz_secure_encode_cmd *enc,
307  struct otzc_encode_meta **pmeta_data,
308  struct otz_secure_encode_ctx **penc_context,
309  int encode_type);
310 
331 int decode_ipi_out_data(void *data,
332  struct otzc_encode_meta *meta_data,
333  int *type, int *offset, int *pos,
334  void **out_data, int *out_len);
335 
345 void otz_release_data(struct otz_secure_encode_ctx *enc_context,
346  struct otzc_encode_meta *meta_data);
347 
370 int ipc_api(int src_svc_id, int src_session_id, int target_svc_id,
371  int target_cmd_id, void *req_buf, int req_buf_len,
372  void* res_buf, int res_buf_len, int *ret_res_buf_len);
373 
374 
384 void ipc_test_crypto(int src_svc_id, int src_session_id);
385 
394 void ipc_test_echo(int src_svc_id, int src_session_id);
395 
406 void handle_task_return(int task_id, sw_tls* tls);
407 
408 
409 /* cpu_ipi.c */
410 
420 void otz_ipi(struct otz_smc_cmd *smc_cmd);
421 
431 void otz_ipi_return(struct otz_smc_cmd *smc_cmd, int ret_val);
432 
433 #ifdef OTZONE_ASYNC_NOTIFY_SUPPORT
434 
441 void notify_ns(int task_id);
442 
456 int register_notify_data_api(void *param);
457 
470 int unregister_notify_data_api(void);
471 #endif
472 
473 #endif /* __OTZ_SECURE_API_H_ */
void * req_addr
Definition: secure_api.h:47
Task local storage.
Definition: task.h:79
void ipc_test_echo(int src_svc_id, int src_session_id)
Test IPC command for echo operation.
Definition: secure_api.c:1179
Encode command structure.
Definition: secure_api.h:37
unsigned int res_len
Definition: secure_api.h:50
int ipc_send(int src_svc_id, int src_context, int svc_id, int session_id, int cmd_id, struct otz_secure_encode_ctx *enc_ctx, struct otzc_encode_meta *meta_data)
Send the data between two tasks.
Definition: secure_api.c:860
Secure API configuration details for task.
Definition: task.h:40
int sa_create_entry_point(int svc_id, sa_config_t *psa_config)
Invokes the init function of the service task.
Definition: secure_api.c:291
u32 enc_req_pos
Definition: secure_api.h:54
int ipc_connect(int svc_id, int *session_id)
Establish session between two tasks.
Definition: secure_api.c:817
void otz_ipi_return(struct otz_smc_cmd *smc_cmd, int ret_val)
Return for IPI.
Definition: cpu_ipi.c:70
void otz_ipi(struct otz_smc_cmd *smc_cmd)
Invoke IPI.
Definition: cpu_ipi.c:44
int sa_open_session(sa_config_t *psa_config, void *session_context)
Open Session.
Definition: secure_api.c:397
int decode_ipi_out_data(void *data, struct otzc_encode_meta *meta_data, int *type, int *offset, int *pos, void **out_data, int *out_len)
Helper function to decode the response data for IPI.
Definition: secure_api.c:572
int sa_close_session(void *session_context)
Close Session.
Definition: secure_api.c:419
SMC command structure.
Definition: otz_common.h:107
Encode context.
Definition: secure_api.h:46
u32 enc_res_offset
Definition: secure_api.h:53
u32 enc_res_pos
Definition: secure_api.h:55
int ipc_disconnect(int svc_id, int session_id)
Disconnect the previously established session between two tasks.
Definition: secure_api.c:835
u8 * data
Definition: fat32.c:40
u32 enc_req_offset
Definition: secure_api.h:52
Metadata used for encoding/decoding.
Definition: otz_common.h:93
int sa_destroy_entry_point(int svc_id, void *data, int elf_flag)
Invokes the exit function of the service task.
Definition: secure_api.c:349
int close_session_from_ns(void *param)
Dispatcher command function to handle the Close session request from non-secure world.
Definition: secure_api.c:156
int close_session_from_secure(int svc_id, int session_id)
Close session request which is got initiated from secure task.
Definition: secure_api.c:269
int decode_data(void *data, struct otzc_encode_meta *meta_data, int *type, int *offset, int *pos, int *mapped, void **out_data, int *out_len)
Helper function to decode the data which got passed from non-secure world.
Definition: secure_api.c:501
int open_session_from_ns(void *param)
Dispatcher command function to handle the Open session request from non-secure world.
Definition: secure_api.c:70
int update_response_len(struct otzc_encode_meta *meta_data, int pos, int len)
Helper function to update the response length.
Definition: secure_api.c:615
unsigned int len
Definition: secure_api.h:38
void otz_release_data(struct otz_secure_encode_ctx *enc_context, struct otzc_encode_meta *meta_data)
Release the encoded data.
Definition: secure_api.c:785
void handle_task_return(int task_id, sw_tls *tls)
Helper function to handle the task return.
Definition: secure_api.c:1207
int open_session_from_secure(int svc_id, int *session_id)
Open session request from secure application task.
Definition: secure_api.c:229
void * res_addr
Definition: secure_api.h:49
int otz_encode_data(struct otz_secure_encode_cmd *enc, struct otzc_encode_meta **pmeta_data, struct otz_secure_encode_ctx **penc_context, int encode_type)
Helper function to encode the data which originate from secure application.
Definition: secure_api.c:643
unsigned int req_len
Definition: secure_api.h:48
int ipc_api(int src_svc_id, int src_session_id, int target_svc_id, int target_cmd_id, void *req_buf, int req_buf_len, void *res_buf, int res_buf_len, int *ret_res_buf_len)
Helper function to send the data between two tasks for single request and single response buffer...
Definition: secure_api.c:919
void ipc_test_crypto(int src_svc_id, int src_session_id)
: Test IPC command for crypto operation
Definition: secure_api.c:1006
int param_type
Definition: secure_api.h:40
void * data
Definition: secure_api.h:39
void get_api_context(int *svc_id, int *task_id, int *cmd_id, int *cmd_type)
Helper function to return the service id, session id and command id from the smc command parameter...
Definition: secure_api.c:436