comparison gsm-fw/g23m-aci/aci/aci_slock.h @ 775:eedbf248bac0

gsm-fw/g23m-aci subtree: initial import from LoCosto source
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Sun, 12 Oct 2014 01:45:14 +0000
parents
children
comparison
equal deleted inserted replaced
774:40a721fd9854 775:eedbf248bac0
1 /*
2 +-----------------------------------------------------------------------------
3 | Project :
4 | Modul : J:\g23m-aci\aci\aci_slock.h
5 +-----------------------------------------------------------------------------
6 | Copyright 2002 Texas Instruments Berlin, AG
7 | All rights reserved.
8 |
9 | This file is confidential and a trade secret of Texas
10 | Instruments Berlin, AG
11 | The receipt of or possession of this file does not convey
12 | any rights to reproduce or disclose its contents or to
13 | manufacture, use, or sell anything it may describe, in
14 | whole, or in part, without the specific written consent of
15 | Texas Instruments Berlin, AG.
16 +-----------------------------------------------------------------------------
17 | Purpose :
18 +-----------------------------------------------------------------------------
19 */
20
21 #ifndef ACI_SLOCK_H
22 #define ACI_SLOCK_H
23
24 #ifdef SIM_PERS
25 /* Shared globals ------------------------------------------------ */
26
27 typedef struct{
28 T_SIMLOCK_STATUS status[SIMLOCK_LAST]; /* lint */ /* one status for every personalisation lock type */
29 UINT16 dependency[SIMLOCK_LAST];
30 UBYTE blocked; /* blocked flag */
31 T_SIMLOCK_TYPE current_lock; /* currently checked lock */
32 UBYTE pb_load ;
33 T_SIMLOCK_CHECK check_lock;
34 UBYTE cpin_query ;
35 T_SIMLOCK_TYPE lock_type;
36 CHAR * lock_passwd;
37 }T_ACI_SLOCK_SHARED;
38
39
40 EXTERN T_ACI_SLOCK_SHARED AciSLockShrd;
41 EXTERN UBYTE sim_code_present_in_me;
42 #endif
43
44 #define NOT_PRESENT_8BIT 0xFF
45 #define MAX_GID 5
46 #define CHECK_FAIL 2
47
48 #ifdef SIM_PERS
49 /*Max number of user codes for each category- To be defined*/
50 #define MAX_NW_USER_CODES 20
51 #define MAX_NS_USER_CODES 10
52 #define MAX_SP_USER_CODES 10
53 #define MAX_CP_USER_CODES 10
54 #define MAX_SIM_USER_CODES 10
55 /*Normal code length for each category*/
56 #define NW_USER_CODE_LEN 3
57 #define NS_USER_CODE_LEN 4
58 #define SP_USER_CODE_LEN 7
59 #define CP_USER_CODE_LEN 11
60 #define SIM_USER_CODE_LEN 8
61
62 #define MAX_NUM_USERCODE_SIZE 1
63 #define NUM_OPCODE_SIZE 1
64 #define NUM_USER_CODE_SIZE 1
65 #define CURR_USER_CODE_INDEX_SIZE 1
66 #define OPCODE_LEN_SIZE 1 /* can be 2 */
67 #define OPCODE_LEN_INDEX 2
68 #define CODE_TYPE_SIZE 1
69
70 #define FC_MAX_INFINITE 0xff /* 04-08-2005 */
71
72
73 /*
74 * BCD length
75 */
76 #define NW_CODE_LEN 4 /* Parity +MNC + MCC may require 4 bytes in packed bcd format if MNC length is 3 */
77 #define NS_CODE_LEN 1 /* NS requires 1 byte in packed bcd format */
78 #define NW_NS_CODE_LEN 5
79 #define NW_NS_MSIN_CODE_LEN 8
80 #define NW_NS_MSIN_MSIN_CODE_LEN 13
81 #define NW_NS_NS_CODE_LEN 6
82 #define NW_DIGIT_MAP_TABLE_LEN 24 /* Network code (4) + digit mapping table (10 * 2) */
83
84
85 #define NORMAL_CODE 0x0a
86 #define INTERVAL_TYPE1 0x0b /* Range */
87 #define INTERVAL_TYPE2 0x0d /* digit interval */
88 #define REGULAR_EXP 0x0c /* Regular expession */
89
90 #define GID1_LEN 4 /* GID1 is not stored in BCD format */
91 #define GID2_LEN 4 /* GID2 is not stored in BCD format */
92 #define GID_LEN_TO_BE_COMPARED 1 /* depends on what the length is in the sim */
93
94 enum
95 {
96 ALWAYS_ACCEPTED=0x00,
97 ALWAYS_REJECTED= 0x01,
98 UNTIL_NORMAL_SIM=0x02
99 } ;
100
101 enum
102 {
103 SEND_CPIN_REQ_CODE_NONE =0,
104 SEND_CPIN_REQ_CODE,
105 SEND_CPIN_REQ_CODE_RAT
106 } ;
107
108 typedef enum
109 {
110 SIM_NORMAL =0,
111 SIM_TYPEAPPROVAL,
112 SIM_TEST
113 }T_SIM_TYPE ;
114
115 #endif
116
117 /* SIM configuration information */
118 typedef struct
119 {
120 UBYTE deper_key [16];
121 UBYTE phase;
122 UBYTE oper_mode; /* SIM card functionality */
123 UBYTE pref_lang[5];
124 UBYTE access_acm;
125 UBYTE access_acmmax;
126 UBYTE access_puct;
127 UBYTE sim_gidl1[MAX_GID];
128 UBYTE sim_gidl2[MAX_GID];
129 #ifdef SIM_PERS
130 T_SIM_TYPE sim_type; /* */
131 UBYTE sim_read_gid1; /* added for SP, CP */
132 UBYTE sim_read_gid2; /* added for SP, CP */
133 UBYTE gid1_len;
134 UBYTE gid2_len;
135 UBYTE sim_read_ad_first_byte;
136 #endif
137
138 } T_ACI_SIM_CONFIG; /* This is the same as T_MFW_SIM_CONFIG */
139
140
141 /* Prototypes ----------------------------------------------------*/
142
143
144
145
146 #ifdef SIM_PERS
147 /*
148 Initialising of this module. Has to be called first and *once only* before calling any other method.
149 */
150 void aci_slock_init ( void );
151
152 /*
153 Reset the aci_slock variables
154 */
155 void aci_slock_reset();
156
157
158 /*
159 Unlocks the lock of the given type after verifying the given password.
160 The ACI extension for password verifying (see 2.3.9.1) will be used to
161 determine if the given password is correct or not.
162 On a successful unlock the actual status of the lock will be returned.
163 If an error occurred SIMLOCK_FAIL will be returned.
164 (Uses the ACI extension "personalisation data access".)
165 */
166 T_SIMLOCK_STATUS aci_slock_authenticate ( T_SIMLOCK_TYPE type, char *passwd );
167
168
169 /*
170 ACI method for retrieving the status of a single personalisation type. This method calls extension
171 methods which in turn calls Security Drv. API and retrn the status of a personalisation category.
172 The personalisation status is stored in MEPD which is directly accessed by Security Drv.
173 Added on 11/03/2005
174 */
175
176 T_SIMLOCK_STATUS aci_personalisation_get_status ( T_SIMLOCK_TYPE personalisation_type );
177 #endif
178 #ifdef SIM_PERS
179
180
181 /*
182 Locks the lock of the given type. On a successful lock the actual
183 status of the lock will be returned. If an error occurred SIMLOCK_FAIL
184 will be returned. This method will use the ACI extension for password
185 verifying (see 2.3.9.1) to determine if the given password is correct
186 or not. (Uses the ACI extension "personalisation data access".)
187 */
188 T_SIMLOCK_STATUS aci_slock_lock ( T_SIMLOCK_TYPE type, char *passwd );
189
190 /*
191 For Failure Counter reset. Use extension methods
192 added on 11/03/2005
193 */
194 T_OPER_RET_STATUS aci_slock_reset_fc ( char *fcKey );
195
196 /*--------------------------------------
197 For Supplementary Info( e.g. FC MAX, MC Current value).
198 Uses extension method aci_slock_sup_info
199 added on 11/03/2005
200 ----------------------------------------*/
201 T_OPER_RET_STATUS aci_slock_sup_info(T_SUP_INFO *sup_info);
202
203 /*------------------------------------------
204 For master unlock. Unlock can be in bootup menu
205 or in security menu.
206 -------------------------------------------*/
207 T_OPER_RET_STATUS aci_slock_master_unlock(char *masterkey);
208
209 /* change the password */
210 T_OPER_RET_STATUS aci_slock_change_password ( T_SIMLOCK_TYPE type, char *passwd, char *new_passwd );
211
212
213
214 #endif
215 /*
216 Unlocks the lock of the given type after verifying the given password.
217 The ACI extension for password verifying (see 2.3.9.1) will be used to
218 determine if the given password is correct or not.
219 On a successful unlock the actual status of the lock will be returned.
220 If an error occurred SIMLOCK_FAIL will be returned.
221 (Uses the ACI extension "personalisation data access".)
222 */
223 T_SIMLOCK_STATUS aci_slock_unlock ( T_SIMLOCK_TYPE type, char *passwd );
224 /*
225 Checks for all kinds of personalisation locks. The given IMSI will be checked against the internal
226 personalisation data. Returns SIMLOCK_BLOCKED, if one lock was not matching the given IMSI.
227 */
228 T_SIMLOCK_STATUS aci_slock_checkpersonalisation( T_SIMLOCK_TYPE current_lock );
229
230
231 /*
232 PURPOSE : Install information found in the primitive into configuration buffers.
233 */
234 void aci_slock_sim_init ( T_SIM_MMI_INSERT_IND *sim_mmi_insert_ind );
235
236
237 /*
238 PURPOSE : Call back for SIM read.
239
240 */
241 void aci_slock_sim_read_sim_cb(SHORT table_id);
242
243 /*
244 PURPOSE : Request to read SIM card.
245
246 */
247 void aci_slock_sim_read_sim(USHORT data_id, UBYTE len, UBYTE max_length);
248
249 #ifdef SIM_PERS
250 /*
251
252 PURPOSE : Setting the sim_type value (Normal, Test SIM, Type Approval SIM)
253
254 */
255
256 void aci_slock_set_simtype(T_SIM_TYPE sim_type );
257
258 /*
259 PURPOSE : To set global variable for configuration data ( part1 of Security Driver)
260 */
261 BOOL aci_slock_set_CFG(void);
262
263
264 void aci_slock_check_NWlock( UBYTE* imsi_sim, UBYTE personalisation );
265
266 void aci_slock_check_NSlock( UBYTE* imsi_sim, UBYTE personalisation );
267
268 void aci_slock_check_SPlock( UBYTE* imsi_sim, UBYTE personalisation );
269 void aci_slock_check_CPlock( UBYTE* imsi_sim, UBYTE personalisation);
270
271 void aci_slock_check_SMlock( UBYTE* imsi_sim, UBYTE personalisation);
272
273 GLOBAL void aci_slock_psaSIM_decodeIMSI (UBYTE* imsi_field, UBYTE imsi_c_field, CHAR* imsi_asciiz);
274
275 GLOBAL void aci_slock_psaSIM_decodeIMSI_without_parity(UBYTE* imsi_field, UBYTE imsi_c_field, CHAR* imsi_asciiz);
276
277 GLOBAL void aci_set_cme_error(T_SIMLOCK_TYPE slocktype);
278 GLOBAL void aci_set_cme_error_code(T_SIMLOCK_TYPE current_lock , T_ACI_CME_ERR *err_code);
279 GLOBAL void aci_set_cpin_code(T_SIMLOCK_TYPE current_lock ,T_ACI_CPIN_RSLT *code);
280
281 /*
282 PURPOSE : read SIM group identifier 1 or 2 from SIM card
283 */
284 void aci_slock_sim_gid_cnf( SHORT table_id );
285 GLOBAL void aci_set_cme_error_code_and_logRslt( UBYTE cmdBuf );
286
287 GLOBAL void aci_slock_unlock_timer_stopped(void);
288 GLOBAL UBYTE aci_slock_check_timer(void);
289 GLOBAL void aci_slock_unlock_timer_stopped(void);
290 GLOBAL UBYTE aci_slock_is_timer_support(void);
291 GLOBAL void aci_slock_set_timer_flag(UBYTE status);
292 GLOBAL void aci_slock_send_RAT(UBYTE cmdBuf,T_ACI_CME_ERR err_code );
293
294 #endif /* SIM_PERS */
295 #endif /* ACI_SLOCK_H */