diff options
-rw-r--r-- | include/device/crespo/sms.h | 35 | ||||
-rw-r--r-- | include/radio.h | 4 | ||||
-rw-r--r-- | include/sec.h | 63 | ||||
-rw-r--r-- | include/sms.h | 50 | ||||
-rw-r--r-- | samsung-ipc/ipc.c | 8 | ||||
-rw-r--r-- | samsung-ipc/sec.c | 263 |
6 files changed, 383 insertions, 40 deletions
diff --git a/include/device/crespo/sms.h b/include/device/crespo/sms.h new file mode 100644 index 0000000..bafd517 --- /dev/null +++ b/include/device/crespo/sms.h @@ -0,0 +1,35 @@ +/** + * This file is part of libsamsung-ipc. + * + * Copyright (C) 2011 Paul Kocialkowski <contact@paulk.fr> + * + * libsamsung-ipc is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * libsamsung-ipc is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with libsamsung-ipc. If not, see <http://www.gnu.org/licenses/>. + * + */ + +#ifndef __DEVICE_CRESPO_SMS_H__ +#define __DEVICE_CRESPO_SMS_H__ + +#define IPC_SMS_ACK_NO_ERROR 0x0000 +#define IPC_SMS_ACK_PDA_FULL_ERROR 0x8080 +#define IPC_SMS_ACK_UNSPEC_ERROR 0x806F + +struct ipc_sms_deliv_report_msg { + unsigned char type; + unsigned short error; + unsigned char msg_tpid; + unsigned char unk; +} __attribute__((__packed__)); + +#endif diff --git a/include/radio.h b/include/radio.h index 6615491..1614b98 100644 --- a/include/radio.h +++ b/include/radio.h @@ -81,8 +81,8 @@ int ipc_client_recv(struct ipc_client *client, struct ipc_message_info *response /* Convenience functions for ipc_send */ void ipc_client_send(struct ipc_client *client, const unsigned short command, const char type, unsigned char *data, const int length, unsigned char mseq); -void ipc_client_send_get(struct ipc_client *client, const unsigned short command, unsigned char aseq); -void ipc_client_send_exec(struct ipc_client *client, const unsigned short command, unsigned char aseq); +void ipc_client_send_get(struct ipc_client *client, const unsigned short command, unsigned char mseq); +void ipc_client_send_exec(struct ipc_client *client, const unsigned short command, unsigned char mseq); /* Utility functions */ const char *ipc_command_type_to_str(int command); diff --git a/include/sec.h b/include/sec.h index 2a77c03..9b5f82b 100644 --- a/include/sec.h +++ b/include/sec.h @@ -2,6 +2,7 @@ * This file is part of libsamsung-ipc. * * Copyright (C) 2010-2011 Joerie de Gram <j.de.gram@gmail.com> + * Copyright (C) 2011 Paul Kocialkowski <contact@paulk.fr> * * libsamsung-ipc is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -25,37 +26,37 @@ struct ipc_message_info; #define IPC_SEC_PIN_STATUS 0x0501 #define IPC_SEC_PHONE_LOCK 0x0502 -#define IPC_SEC_CHANGE_LOCKING_PW 0x0503 +#define IPC_SEC_CHANGE_LOCKING_PW 0x0503 #define IPC_SEC_SIM_LANG 0x0504 #define IPC_SEC_RSIM_ACCESS 0x0505 #define IPC_SEC_GSIM_ACCESS 0x0506 -#define IPC_SEC_SIM_ICC_TYPE 0x0507 +#define IPC_SEC_SIM_ICC_TYPE 0x0507 #define IPC_SEC_LOCK_INFO 0x0508 #define IPC_SEC_ISIM_AUTH 0x0509 #define IPC_SEC_PIN_SIM_INITIALIZING 0x00 #define IPC_SEC_PIN_SIM_SIM_LOCK_REQUIRED 0x01 #define IPC_SEC_PIN_SIM_INSIDE_PF_ERROR 0x02 -#define IPC_SEC_PIN_SIM_LOCK_SC 0x03 -#define IPC_SEC_PIN_SIM_LOCK_FD 0x04 -#define IPC_SEC_PIN_SIM_LOCK_PN 0x05 -#define IPC_SEC_PIN_SIM_LOCK_PU 0x06 -#define IPC_SEC_PIN_SIM_LOCK_PP 0x07 -#define IPC_SEC_PIN_SIM_LOCK_PC 0x08 +#define IPC_SEC_PIN_SIM_LOCK_SC 0x03 +#define IPC_SEC_PIN_SIM_LOCK_FD 0x04 +#define IPC_SEC_PIN_SIM_LOCK_PN 0x05 +#define IPC_SEC_PIN_SIM_LOCK_PU 0x06 +#define IPC_SEC_PIN_SIM_LOCK_PP 0x07 +#define IPC_SEC_PIN_SIM_LOCK_PC 0x08 #define IPC_SEC_PIN_SIM_CARD_NOT_PRESENT 0x80 -#define IPC_SEC_PIN_SIM_CARD_ERROR 0x81 +#define IPC_SEC_PIN_SIM_CARD_ERROR 0x81 #define IPC_SEC_PIN_SIM_INIT_COMPLETE 0x82 #define IPC_SEC_PIN_SIM_PB_INIT_COMPLETE 0x83 /* Key types for the SIM card (SC) facility */ #define IPC_SEC_PIN_SIM_LOCK_SC_PIN1_REQ 0x01 #define IPC_SEC_PIN_SIM_LOCK_SC_PUK_REQ 0x02 -#define IPC_SEC_PIN_SIM_LOCK_SC_CARD_BLOCKED 0x05 +#define IPC_SEC_PIN_SIM_LOCK_SC_CARD_BLOCKED 0x05 #define IPC_SEC_PIN_TYPE_PIN1 0x03 #define IPC_SEC_PIN_TYPE_PIN2 0x09 -#define IPC_SEC_SIM_CARD_TYPE_UNKNOWN 0x00 +#define IPC_SEC_SIM_CARD_TYPE_UNKNOWN 0x00 #define IPC_SEC_SIM_CARD_TYPE_SIM 0x01 #define IPC_SEC_SIM_CARD_TYPE_USIM 0x02 @@ -64,6 +65,12 @@ struct ipc_message_info; #define IPC_SEC_RSIM_COMMAND_UPDATE_BINARY 0xd6 #define IPC_SEC_RSIM_COMMAND_STATUS 0xf2 +#define IPC_SEC_RSIM_ACCESS_UNKNOWN 0x00 +#define IPC_SEC_RSIM_ACCESS_COMP_NORMAL 0x01 +#define IPC_SEC_RSIM_ACCESS_COMP_WARNING 0x02 +#define IPC_SEC_RSIM_ACCESS_ABORT_EXEC 0x03 +#define IPC_SEC_RSIM_ACCESS_ABORT_CHECK 0x04 + struct ipc_sec_pin_status_noti { unsigned char type; unsigned char key; @@ -109,7 +116,41 @@ struct ipc_sec_lock_info_response { unsigned char attempts; } __attribute__((__packed__)); +/* + * struct ipc_sec_sim_filesystem_entry + * Source: cornucopia fsogsmd/src/lib/consts.vala + * Git HEAD: f2e0268075ffb15ef237371cd2e1896561567665 + * + * Copyright (C) 2009-2011 Michael 'Mickey' Lauer <mlauer@vanille-media.de> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +struct ipc_sec_sim_filesystem_entry +{ + uint16_t id; + uint16_t parent; + char *name; +}; + +int ipc_sec_rsim_access_response_get_status(struct ipc_message_info *response); char* ipc_sec_rsim_access_response_get_file_data(struct ipc_message_info *response); +void ipc_sec_rsim_access_request_setup(struct ipc_sec_rsim_access_request *request, + unsigned char command, char *entry_name, + unsigned char p1, unsigned char p2, unsigned char p3); void ipc_sec_pin_status_set_setup(struct ipc_sec_pin_status_set *message, unsigned char pin_type, char *pin1, char *pin2); diff --git a/include/sms.h b/include/sms.h index a9d185b..877c2a4 100644 --- a/include/sms.h +++ b/include/sms.h @@ -21,29 +21,33 @@ #ifndef __SMS_H__ #define __SMS_H__ -#define IPC_SMS_SEND_MSG 0x0401 -#define IPC_SMS_INCOMING_MSG 0x0402 -#define IPC_SMS_READ_MSG 0x0403 -#define IPC_SMS_SAVE_MSG 0x0404 -#define IPC_SMS_DEL_MSG 0x0405 -#define IPC_SMS_DELIVER_REPORT 0x0406 -#define IPC_SMS_DEVICE_READY 0x0407 -#define IPC_SMS_SEL_MEM 0x0408 -#define IPC_SMS_STORED_MSG_COUNT 0x0409 -#define IPC_SMS_SVC_CENTER_ADDR 0x040A -#define IPC_SMS_SVC_OPTION 0x040B -#define IPC_SMS_MEM_STATUS 0x040C -#define IPC_SMS_CBS_MSG 0x040D -#define IPC_SMS_CBS_CONFIG 0x040E -#define IPC_SMS_STORED_MSG_STATUS 0x040F -#define IPC_SMS_PARAM_COUNT 0x0410 -#define IPC_SMS_PARAM 0x0411 - -#define IPC_SMS_MSG_MULTIPLE 1 -#define IPC_SMS_MSG_SINGLE 2 - -#define IPC_SMS_TYPE_POINT_TO_POINT 1 -#define IPC_SMS_TYPE_STATUS_REPORT 2 +#if defined(DEVICE_CRESPO) +#include "device/crespo/sms.h" +#endif + +#define IPC_SMS_SEND_MSG 0x0401 +#define IPC_SMS_INCOMING_MSG 0x0402 +#define IPC_SMS_READ_MSG 0x0403 +#define IPC_SMS_SAVE_MSG 0x0404 +#define IPC_SMS_DEL_MSG 0x0405 +#define IPC_SMS_DELIVER_REPORT 0x0406 +#define IPC_SMS_DEVICE_READY 0x0407 +#define IPC_SMS_SEL_MEM 0x0408 +#define IPC_SMS_STORED_MSG_COUNT 0x0409 +#define IPC_SMS_SVC_CENTER_ADDR 0x040A +#define IPC_SMS_SVC_OPTION 0x040B +#define IPC_SMS_MEM_STATUS 0x040C +#define IPC_SMS_CBS_MSG 0x040D +#define IPC_SMS_CBS_CONFIG 0x040E +#define IPC_SMS_STORED_MSG_STATUS 0x040F +#define IPC_SMS_PARAM_COUNT 0x0410 +#define IPC_SMS_PARAM 0x0411 + +#define IPC_SMS_MSG_MULTIPLE 1 +#define IPC_SMS_MSG_SINGLE 2 + +#define IPC_SMS_TYPE_POINT_TO_POINT 1 +#define IPC_SMS_TYPE_STATUS_REPORT 2 struct ipc_sms_send_msg { unsigned char hint, length; diff --git a/samsung-ipc/ipc.c b/samsung-ipc/ipc.c index c68b271..213af4e 100644 --- a/samsung-ipc/ipc.c +++ b/samsung-ipc/ipc.c @@ -221,14 +221,14 @@ int _ipc_client_send(struct ipc_client *client, struct ipc_message_info *request } /* Convenience functions for ipc_send */ -inline void ipc_client_send_get(struct ipc_client *client, const unsigned short command, unsigned char aseq) +inline void ipc_client_send_get(struct ipc_client *client, const unsigned short command, unsigned char mseq) { - ipc_client_send(client, command, IPC_TYPE_GET, 0, 0, aseq); + ipc_client_send(client, command, IPC_TYPE_GET, 0, 0, mseq); } -inline void ipc_client_send_exec(struct ipc_client *client, const unsigned short command, unsigned char aseq) +inline void ipc_client_send_exec(struct ipc_client *client, const unsigned short command, unsigned char mseq) { - ipc_client_send(client, command, IPC_TYPE_EXEC, 0, 0, aseq); + ipc_client_send(client, command, IPC_TYPE_EXEC, 0, 0, mseq); } /* Wrapper for ipc_send */ diff --git a/samsung-ipc/sec.c b/samsung-ipc/sec.c index da982c2..07c5013 100644 --- a/samsung-ipc/sec.c +++ b/samsung-ipc/sec.c @@ -2,6 +2,7 @@ * This file is part of libsamsung-ipc. * * Copyright (C) 2011 Simon Busch <morphis@gravedo.de> + * Copyright (C) 2011 Paul Kocialkowski <contact@paulk.fr> * * libsamsung-ipc is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,11 +24,175 @@ #include <stdlib.h> #include <assert.h> +/* + * ipc_sec_sim_file_system[] + * Source: cornucopia fsogsmd/src/lib/consts.vala + * Git HEAD: f2e0268075ffb15ef237371cd2e1896561567665 + * + * Copyright (C) 2009-2011 Michael 'Mickey' Lauer <mlauer@vanille-media.de> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +struct ipc_sec_sim_filesystem_entry ipc_sec_sim_file_system[] = +{ + { 0x3F00,0x0000, "MF" }, // root + + { 0x2FE2,0x3F00, "EFiccid" }, + { 0x2F05,0x3F00, "EFelp" }, + + { 0x7F10,0x3F00, "DFtelecom" }, + { 0x6F3A,0x7F10, "EFadn" }, + { 0x6F3B,0x7F10, "EFfdn" }, + { 0x6F3C,0x7F10, "EFsms" }, + { 0x6F3D,0x7F10, "EFccp" }, + { 0x6F40,0x7F10, "EFmsisdn" }, + { 0x6F42,0x7F10, "EFsmsp" }, + { 0x6F43,0x7F10, "EFsmss" }, + { 0x6F44,0x7F10, "EFlnd" }, + { 0x6F47,0x7F10, "EFsmsr" }, + { 0x6F49,0x7F10, "EFsdn" }, + { 0x6F4A,0x7F10, "EFext1" }, + { 0x6F4B,0x7F10, "EFext2" }, + { 0x6F4C,0x7F10, "EFext3" }, + { 0x6F4D,0x7F10, "EFbdn" }, + { 0x6F4E,0x7F10, "EFext4" }, + { 0x6F4F,0x7F10, "EFeccp" }, // 51.011 + { 0x6F58,0x7F10, "EFcmi" }, // 51.011 + + { 0x5F50,0x7F10, "DFgraphics" }, + { 0x4F20,0x5F50, "EFimg" }, + { 0x4F01,0x5F50, "EFimg1" }, // Usual names of + { 0x4F02,0x5F50, "EFimg2" }, // Image data files. + { 0x4F03,0x5F50, "EFimg3" }, + { 0x4F04,0x5F50, "EFimg4" }, + { 0x4F05,0x5F50, "EFimg5" }, + + { 0x7F20,0x3F00, "DFgsm" }, + { 0x6F05,0x7F20, "EFlp" }, + { 0x6F07,0x7F20, "EFimsi" }, + { 0x6F20,0x7F20, "EFkc" }, + { 0x6F2C,0x7F20, "EFdck" }, // 51.011 + { 0x6F30,0x7F20, "EFplmnsel" }, + { 0x6F31,0x7F20, "EFhpplmn" }, + { 0x6F32,0x7F20, "EFcnl" }, // 51.011 + { 0x6F37,0x7F20, "EFacmmax" }, + { 0x6F38,0x7F20, "EFsst" }, + { 0x6F39,0x7F20, "EFacm" }, + { 0x6F3E,0x7F20, "EFgid1" }, + { 0x6F3F,0x7F20, "EFgid2" }, + { 0x6F41,0x7F20, "EFpuct" }, + { 0x6F45,0x7F20, "EFcbmi" }, + { 0x6F46,0x7F20, "EFspn" }, // SIM Provider Name + { 0x6F48,0x7F20, "EFcbmid" }, + { 0x6F50,0x7F20, "EFcbmir" }, + { 0x6F51,0x7F20, "EFnia" }, + { 0x6F52,0x7F20, "EFkcgprs" }, + { 0x6F53,0x7F20, "EFlocigprs" }, + { 0x6F54,0x7F20, "EFsume" }, + { 0x6F60,0x7F20, "EFplmnwact" }, + { 0x6F61,0x7F20, "EFoplmnwact" }, + { 0x6F62,0x7F20, "EFhplmnwact" }, + { 0x6F63,0x7F20, "EFcpbcch" }, + { 0x6F64,0x7F20, "EFinvscan" }, + { 0x6F74,0x7F20, "EFbcch" }, + { 0x6F78,0x7F20, "EFacc" }, + { 0x6F7B,0x7F20, "EFfplmn" }, + { 0x6F7E,0x7F20, "EFloci" }, + { 0x6FAD,0x7F20, "EFad" }, + { 0x6FAE,0x7F20, "EFphase" }, + { 0x6FB1,0x7F20, "EFvgcs" }, + { 0x6FB2,0x7F20, "EFvgcss" }, + { 0x6FB3,0x7F20, "EFvbs" }, + { 0x6FB4,0x7F20, "EFvbss" }, + { 0x6FB5,0x7F20, "EFemlpp" }, + { 0x6FB6,0x7F20, "EFaaem" }, + { 0x6FB7,0x7F20, "EFecc" }, + { 0x6FC5,0x7F20, "EFpnn" }, // 51.011 + { 0x6FC6,0x7F20, "EFopl" }, // 51.011 + { 0x6FC7,0x7F20, "EFmbdn" }, // 51.011 + { 0x6FC8,0x7F20, "EFext6" }, // Ext record for EFmbdn + { 0x6FC9,0x7F20, "EFmbi" }, // 51.011 + { 0x6FCA,0x7F20, "EFmwis" }, // 51.011 + { 0x6FCB,0x7F20, "EFcfis" }, // 51.011 + { 0x6FCC,0x7F20, "EFext7" }, // 51.011 + { 0x6FCD,0x7F20, "EFspdi" }, // 51.011 + { 0x6FCE,0x7F20, "EFmmsn" }, // 51.011 + { 0x6FCF,0x7F20, "EFext8" }, // 51.011 + { 0x6FD0,0x7F20, "EFmmsicp" },// 51.011 + { 0x6FD1,0x7F20, "EFmmsup" }, // 51.011 + { 0x6FD2,0x7F20, "EFmmsucp" },// 51.011 + + { 0x6F17,0x7F20, "EF_MAILBOX_CPHS" }, // CPHS phase 2 + { 0x6F11,0x7F20, "EF_VOICE_MAIL_INDICATOR_CPHS" }, // CPHS phase 2 + { 0x6F13,0x7F20, "EF_CFF_CPHS" }, // CPHS phase 2 + { 0x6f14,0x7F20, "EF_SPN_CPHS" }, // CPHS phase 2 + { 0x6f18,0x7F20, "EF_SPN_SHORT_CPHS" },// CPHS phase 2 + { 0x6f16,0x7F20, "EF_INFO_CPHS" }, // CPHS phase 2 + + { 0x5F30,0x7F20, "DFiridium" }, + { 0x5F31,0x7F20, "DFglobst" }, + { 0x5F32,0x7F20, "DFico" }, + { 0x5F33,0x7F20, "DFaces" }, + + { 0x5F40,0x7F20, "DFeia/tia-553" }, + { 0x4F80,0x5F40, "EFsid" }, // 51.011 + { 0x4F81,0x5F40, "EFgpi" }, // 51.011 + { 0x4F82,0x5F40, "EFipc" }, // 51.011 + { 0x4F83,0x5F40, "EFcount" }, // 51.011 + { 0x4F84,0x5F40, "EFnsid" }, // 51.011 + { 0x4F85,0x5F40, "EFpsid" }, // 51.011 + { 0x4F86,0x5F40, "EFnetsel" },// 51.011 + { 0x4F87,0x5F40, "EFspl" }, // 51.011 + { 0x4F88,0x5F40, "EFmin" }, // 51.011 + { 0x4F89,0x5F40, "EFaccolc" },// 51.011 + { 0x4F8A,0x5F40, "EFfc1" }, // 51.011 + { 0x4F8B,0x5F40, "EFs-esn" }, // 51.011 + { 0x4F8C,0x5F40, "EFcsid" }, // 51.011 + { 0x4F8D,0x5F40, "EFreg-thresh" },// 51.011 + { 0x4F8E,0x5F40, "EFccch" }, // 51.011 + { 0x4F8F,0x5F40, "EFldcc" }, // 51.011 + { 0x4F90,0x5F40, "EFgsm-recon" }, // 51.011 + { 0x4F91,0x5F40, "EFamps-2-gsm" },// 51.011 + { 0x4F93,0x5F40, "EFamps-ui" }, // 51.011 + + { 0x5F60,0x7F20, "DFcts" }, + + { 0x5F70,0x7F20, "DFsolsa" }, + { 0x4F30,0x5F70, "EFsai" }, + { 0x4F31,0x5F70, "EFsll" }, + + { 0x5F3C,0x7F20, "DFmexe" }, + { 0x4F40,0x5F3C, "EFmexe-st" }, + { 0x4F41,0x5F3C, "EForpk" }, + { 0x4F42,0x5F3C, "EFarpk" }, + { 0x4F43,0x5F3C, "EFtprpk" }, + + { 0x7F22,0x3F00, "DFis41" }, + + { 0x7F23,0x3F00, "DFfp-cts" } +}; + void ipc_sec_pin_status_set_setup(struct ipc_sec_pin_status_set *message, unsigned char pin_type, char *pin1, char *pin2) { assert(message != NULL); + memset(message, 0, sizeof(struct ipc_sec_pin_status_set)); + message->type = pin_type; if (pin1 != NULL) @@ -43,6 +208,104 @@ void ipc_sec_pin_status_set_setup(struct ipc_sec_pin_status_set *message, } } +unsigned short ipc_sec_sim_filesystem_entry_name_to_code(char *entry_name) +{ + int i; + int table_size; + + table_size = (int) (sizeof(ipc_sec_sim_file_system) / sizeof(struct ipc_sec_sim_filesystem_entry)); + + for(i=0 ; i < table_size ; i++) + { + if(strcmp(ipc_sec_sim_file_system[i].name, entry_name) == 0) + return ipc_sec_sim_file_system[i].id; + } + + return 0; +} + +/* + * ISO/IEC 7816-4 tells: + * P1-P2 indicates controls and options for processing the command. + * A parameter byte set to '00' generally provides no further qualification. + * There is no other general convention for encoding the parameter bytes. + */ + +void ipc_sec_rsim_access_request_setup(struct ipc_sec_rsim_access_request *request, + unsigned char command, char *entry_name, + unsigned char p1, unsigned char p2, unsigned char p3) +{ + request->command = command; + request->fileid = ipc_sec_sim_filesystem_entry_name_to_code(entry_name); + request->p1 = p1; + request->p2 = p2; + request->p3 = p3; +} + +/* + * ISO/IEC 7816-4 tells: + * SWT bytes are status bytes (the first byte is the most significant byte) + * + * See section 5.1.3 Status bytes + * IPC_SEC_RSIM_ACCESS_COMP_NORMAL: Request completed normally + * IPC_SEC_RSIM_ACCESS_COMP_WARNING: Request completed with warning(s) + * IPC_SEC_RSIM_ACCESS_ABORT_EXEC: Request aborted with execution error(s) + * IPC_SEC_RSIM_ACCESS_ABORT_CHECK: Request aborted with check error(s) on + * provided data + */ + +int ipc_sec_rsim_access_response_get_status(struct ipc_message_info *response) +{ + int status_bytes; + int status; + + struct ipc_sec_rsim_access_response *rsimresp; + + rsimresp = (struct ipc_sec_rsim_access_response*) response->data; + status_bytes = (rsimresp->sw1 << 8) + rsimresp->sw2; + + if(status_bytes == 0x9000) + return IPC_SEC_RSIM_ACCESS_COMP_NORMAL; + + /* SIM PIN required */ + if(status_bytes == 0x9404) + return IPC_SEC_RSIM_ACCESS_ABORT_CHECK; + + switch (rsimresp->sw1) + { + case 0x61: + return IPC_SEC_RSIM_ACCESS_COMP_NORMAL; + break; + + case 0x62: + case 0x63: + return IPC_SEC_RSIM_ACCESS_COMP_WARNING; + break; + + case 0x64: + case 0x65: + case 0x66: + return IPC_SEC_RSIM_ACCESS_ABORT_EXEC; + break; + + case 0x67: + case 0x68: + case 0x69: + case 0x6a: + case 0x6b: + case 0x6c: + case 0x6d: + case 0x6e: + case 0x6f: + return IPC_SEC_RSIM_ACCESS_ABORT_CHECK; + break; + + default: + return IPC_SEC_RSIM_ACCESS_UNKNOWN; + break; + } +} + char* ipc_sec_rsim_access_response_get_file_data(struct ipc_message_info *response) { int n = 0; |