comparison src/condat2/com/include/sec_drv.h @ 3:93999a60b835

src/aci2, src/condat2: import of g23m/condat source pieces from TCS211
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 26 Sep 2016 00:29:36 +0000
parents
children
comparison
equal deleted inserted replaced
2:c41a534f33c6 3:93999a60b835
1 #ifndef _SEC_DRV_H_
2 #define _SEC_DRV_H_
3
4
5 /*******************************************
6 Constants
7 *******************************************/
8 /*
9 * Maximum size of category body
10 */
11 #define SEC_DRV_CAT_MAX_SIZE 256 /* MUST be 8-aligned! */
12
13
14 /*
15 * Defines for the first 6 lock-categories
16 */
17 enum E_SEC_DRV_CAT_NUM
18 {
19 SEC_DRV_CAT_NUM_NW = 0,
20 SEC_DRV_CAT_NUM_NS,
21 SEC_DRV_CAT_NUM_SP,
22 SEC_DRV_CAT_NUM_CP,
23 SEC_DRV_CAT_NUM_SIM,
24 SEC_DRV_CAT_NUM_AP
25 };
26
27
28 /*
29 * Define of the different flags that may be
30 * set in the MEPD configuration
31 */
32 enum E_SEC_DRV_CONF_FLAG
33 {
34 SEC_DRV_HDR_FLAG_Truncation = 0x0004,
35 SEC_DRV_HDR_FLAG_ETSI_Flag = 0x0008,
36 SEC_DRV_HDR_FLAG_Spec_Lock_Key = 0x0010,
37 SEC_DRV_HDR_FLAG_LAM_Unlock = 0x0020,
38 SEC_DRV_HDR_FLAG_No_SIM_Unlock = 0x0040,
39 SEC_DRV_HDR_FLAG_Airtel_Ind = 0x0080,
40 SEC_DRV_HDR_FLAG_Unlock_Timer = 0x0100
41 };
42
43
44 /*
45 * Status defines for the different
46 * lock-categories
47 */
48 enum E_SEC_DRV_CAT_STATUS
49 {
50 SEC_DRV_CAT_STAT_Unlocked = 0,
51 SEC_DRV_CAT_STAT_PermUnlocked,
52 SEC_DRV_CAT_STAT_Locked
53 };
54
55
56 /*
57 * Different flags for the lock-categories
58 */
59 enum E_SEC_DRV_CAT_FLAG
60 {
61 SEC_DRV_CAT_FLAG_LinkLocked = 0x01, /* if the category is dependent on a parent.
62 Disable locking/unlocking on its own! */
63 SEC_DRV_CAT_FLAG_UseSeed = 0x02 /* Use seed to generate key during first boot */
64 };
65
66
67 /*******************************************
68 Type definitions
69 *******************************************/
70 /*
71 * Possible return values for the diff. functions.
72 */
73 typedef enum
74 {
75 SEC_DRV_RET_NotPresent = -1,
76 SEC_DRV_RET_Ok = 0,
77 SEC_DRV_RET_KeyMismatch = 1,
78 SEC_DRV_RET_KeyWrong = 2,
79 SEC_DRV_RET_FCExeeded = 3,
80 SEC_DRV_RET_Unknown = 4
81 } T_SEC_DRV_RETURN;
82
83
84 /*
85 * Lock types for sec_rec_Unlock
86 */
87 typedef enum
88 {
89 TEMPORARY_UNLOCK,
90 PERMANENT_UNLOCK
91 } T_SEC_DRV_UNLOCK_TYPE;
92
93
94 /*
95 * MEPD Configuration.
96 * Only read-access to this structure is provided.
97 *
98 * This is a read only structure for the client (ACI layer)
99 */
100 typedef struct
101 {
102 UINT16 Flags; /* See E_SEC_DRV_CONF_FLAG */
103 UINT16 AddNewIMSI; /* Handled by ACI Layer */
104 UINT8 NumCategories;
105 UINT8 FC_Max; /* Failure Counter maximum */
106 UINT8 FC_Current; /* Current value of the Failure Counter */
107 UINT8 FC_Key_Length;
108 UINT8 FC_Reset_Fail_Max;
109 UINT8 FC_Reset_Fail_Current;
110 UINT8 FC_Reset_Success_Max;
111 UINT8 FC_Reset_Success_Current;
112 UINT8 MNC_Len; /* Handled by ACI Layer */
113 UINT8 GID1_Len; /* Handled by ACI Layer */
114 UINT8 GID2_Len; /* Handled by ACI Layer */
115 UINT8 TypeAprovalSIM; /* Handled by ACI Layer */
116 UINT8 TestCPHS; /* Handled by ACI Layer */
117 } T_SEC_DRV_CONFIGURATION;
118
119
120 /*
121 * Header part for a lock-category
122 *
123 * This is a read only structure for the client (ACI layer)
124 */
125 typedef struct
126 {
127 UINT8 Status; /* see E_SEC_DRV_CAT_STATUS */
128 UINT8 Flags; /* see E_SEC_DRV_CAT_FLAG */
129 UINT16 Dependency;
130 UINT16 DataLen;
131 UINT8 KeyLength;
132 } T_SEC_DRV_CAT_HDR;
133
134
135 /*
136 * MEPD Category.
137 */
138 typedef struct
139 {
140 T_SEC_DRV_CAT_HDR Header;
141 void *pBody; /* pointer to array of client data */
142 } T_SEC_DRV_CATEGORY;
143
144
145 /*******************************************
146 Prototypes
147 *******************************************/
148 /* sec_get_imei... missing! use cl_get_imei in comlib instead */
149 extern T_SEC_DRV_RETURN sec_get_CFG(T_SEC_DRV_CONFIGURATION **ppConfiguration);
150 extern T_SEC_DRV_RETURN sec_cmp_KEY(UINT8 rec_num, const char *pKey, UINT8 key_len);
151 extern T_SEC_DRV_RETURN sec_set_KEY(UINT8 rec_num, const char *pOldKey, const char *pNewKey, UINT8 key_len);
152 extern T_SEC_DRV_RETURN sec_set_FC_KEY(const char *pOldKey, const char *pNewKey);
153 extern T_SEC_DRV_RETURN sec_get_REC(UINT8 rec_num, T_SEC_DRV_CATEGORY **ppCategory);
154 extern T_SEC_DRV_RETURN sec_set_REC(UINT8 rec_num, const T_SEC_DRV_CATEGORY *pCategory);
155 extern T_SEC_DRV_RETURN sec_rec_Unlock(UINT8 rec_num, T_SEC_DRV_UNLOCK_TYPE unlockType, const char *pKey, UINT8 key_len, UINT16 dependMask);
156 extern T_SEC_DRV_RETURN sec_rec_Lock(UINT8 rec_num, const char *pKey, UINT8 key_len, UINT16 dependMask);
157 extern T_SEC_DRV_RETURN sec_FC_Reset(const char *pKey, UINT8 key_len);
158 extern T_SEC_DRV_RETURN sec_FC_Increment(void);
159
160 #endif //_SEC_DRV_H_