aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/sec.h2
-rw-r--r--samsung-ipc/sec.c31
2 files changed, 33 insertions, 0 deletions
diff --git a/include/sec.h b/include/sec.h
index 882b586..c7c7000 100644
--- a/include/sec.h
+++ b/include/sec.h
@@ -177,6 +177,8 @@ size_t ipc_sec_rsim_access_size_setup(struct ipc_sec_rsim_access_request_header
const void *sim_io_data, size_t sim_io_size);
void *ipc_sec_rsim_access_setup(struct ipc_sec_rsim_access_request_header *header,
const void *sim_io_data, size_t sim_io_size);
+size_t ipc_sec_rsim_access_size_extract(const void *data, size_t size);
+void *ipc_sec_rsim_access_extract(const void *data, size_t size);
int ipc_sec_lock_infomation_setup(struct ipc_sec_lock_infomation_request_data *data,
unsigned char type);
diff --git a/samsung-ipc/sec.c b/samsung-ipc/sec.c
index 8ec633f..9919592 100644
--- a/samsung-ipc/sec.c
+++ b/samsung-ipc/sec.c
@@ -168,6 +168,37 @@ void *ipc_sec_rsim_access_setup(struct ipc_sec_rsim_access_request_header *heade
return data;
}
+size_t ipc_sec_rsim_access_size_extract(const void *data, size_t size)
+{
+ struct ipc_sec_rsim_access_response_header *header;
+
+ if (data == NULL || size < sizeof(struct ipc_sec_rsim_access_response_header))
+ return 0;
+
+ header = (struct ipc_sec_rsim_access_response_header *) data;
+ if (header->length == 0 || header->length > size - sizeof(struct ipc_sec_rsim_access_response_header))
+ return 0;
+
+ return (size_t) header->length;
+}
+
+void *ipc_sec_rsim_access_extract(const void *data, size_t size)
+{
+ struct ipc_sec_rsim_access_response_header *header;
+ void *rsim_data;
+
+ if (data == NULL || size < sizeof(struct ipc_sec_rsim_access_response_header))
+ return NULL;
+
+ header = (struct ipc_sec_rsim_access_response_header *) data;
+ if (header->length == 0 || header->length > size - sizeof(struct ipc_sec_rsim_access_response_header))
+ return NULL;
+
+ rsim_data = (void *) ((unsigned char *) data + sizeof(struct ipc_sec_rsim_access_response_header));
+
+ return rsim_data;
+}
+
int ipc_sec_lock_infomation_setup(struct ipc_sec_lock_infomation_request_data *data,
unsigned char type)
{