aboutsummaryrefslogtreecommitdiffstats
path: root/samsung-ipc
diff options
context:
space:
mode:
authorPaul Kocialkowski <contact@paulk.fr>2014-08-04 22:58:43 +0200
committerPaul Kocialkowski <contact@paulk.fr>2014-08-04 22:58:43 +0200
commit6f0dca4789a86efba377b34a7c780c68cf74671b (patch)
tree5f3d8fa59b405e69a583e44800c384e419629f9b /samsung-ipc
parent43f51e0121943699249af19b809ed8e3e812e4e3 (diff)
downloadexternal_libsamsung-ipc-6f0dca4789a86efba377b34a7c780c68cf74671b.zip
external_libsamsung-ipc-6f0dca4789a86efba377b34a7c780c68cf74671b.tar.gz
external_libsamsung-ipc-6f0dca4789a86efba377b34a7c780c68cf74671b.tar.bz2
sec: RSIM access extract helper
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
Diffstat (limited to 'samsung-ipc')
-rw-r--r--samsung-ipc/sec.c31
1 files changed, 31 insertions, 0 deletions
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)
{