72 /** |
66 /** |
73 Second-phase constructor. |
67 Second-phase constructor. |
74 */ |
68 */ |
75 void CSimSmartCardEapManager::ConstructL() |
69 void CSimSmartCardEapManager::ConstructL() |
76 { |
70 { |
77 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMSMARTCARDEAPMANAGER_CONSTRUCTL_1, "CSimSmartCardEapManager second phase construction created"); |
71 LOGPHONE1("CSimSmartCardEapManager second phase construction created"); |
78 |
72 |
79 ParseEapInfoL(); |
73 ParseEapInfoL(); |
80 |
74 |
81 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMSMARTCARDEAPMANAGER_CONSTRUCTL_2, "CSimSmartCardEapManager second phase construction completed"); |
75 LOGPHONE1("CSimSmartCardEapManager second phase construction completed"); |
82 } |
76 } |
83 |
77 |
84 /** |
78 /** |
85 If this is destroyed then so should all EAP sub-session objects. |
79 If this is destroyed then so should all EAP sub-session objects. |
86 */ |
80 */ |
87 CSimSmartCardEapManager::~CSimSmartCardEapManager() |
81 CSimSmartCardEapManager::~CSimSmartCardEapManager() |
88 { |
82 { |
89 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMSMARTCARDEAPMANAGER_DTOR_1, "CSimSmartCardEapManager destructing"); |
83 LOGPHONE1("CSimSmartCardEapManager destructing"); |
90 |
84 |
91 for (TInt jj = iSubSessionObjs.Count()-1; jj >= 0; jj--) |
85 for (TInt jj = iSubSessionObjs.Count()-1; jj >= 0; jj--) |
92 { |
86 { |
93 delete iSubSessionObjs[jj]; |
87 delete iSubSessionObjs[jj]; |
94 } |
88 } |
95 |
89 |
96 iSubSessionObjs.Close(); |
90 iSubSessionObjs.Close(); |
97 |
91 |
98 ClearParsedData(); |
92 ClearParsedData(); |
99 |
93 |
100 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMSMARTCARDEAPMANAGER_DTOR_2, "CSimSmartCardEapManager destructed"); |
94 LOGPHONE1("CSimSmartCardEapManager destructed"); |
101 } |
95 } |
102 |
96 |
103 void CSimSmartCardEapManager::ClearParsedData() |
97 void CSimSmartCardEapManager::ClearParsedData() |
104 { |
98 { |
105 // Cleanup remaining unused parsed EAP procedure data |
99 // Cleanup remaining unused parsed EAP procedure data |
140 /** |
134 /** |
141 Parses the UICC App EAP specific settings from the config.txt. |
135 Parses the UICC App EAP specific settings from the config.txt. |
142 */ |
136 */ |
143 void CSimSmartCardEapManager::ParseEapInfoL() |
137 void CSimSmartCardEapManager::ParseEapInfoL() |
144 { |
138 { |
145 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMSMARTCARDEAPMANAGER_PARSEEAPINFOL_1, "CSimSmartCardEapManager::ParseEapInfoL called"); |
139 LOGPHONE1("CSimSmartCardEapManager::ParseEapInfoL called"); |
146 |
140 |
147 CTestConfigItem* item = NULL; |
141 CTestConfigItem* item = NULL; |
148 |
142 |
149 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMSMARTCARDEAPMANAGER_PARSEEAPINFOL_2, "Starting to Parse Smart Card EAP Info"); |
143 LOGPHONE1("Starting to Parse Smart Card EAP Info"); |
150 TInt count = CfgFile()->ItemCount(KScEapProcedures); |
144 TInt count = CfgFile()->ItemCount(KScEapProcedures); |
151 |
145 |
152 // Used in parsing to keep track of the nested items |
146 // Used in parsing to keep track of the nested items |
153 TInt nestedKeyTag = 0; |
147 TInt nestedKeyTag = 0; |
154 TInt nestedExtKeyTag = 0; |
148 TInt nestedExtKeyTag = 0; |
211 |
205 |
212 // Find number of challenges |
206 // Find number of challenges |
213 ret = CTestConfig::GetElement(item->Value(), KStdDelimiter, 2, numChallenges); |
207 ret = CTestConfig::GetElement(item->Value(), KStdDelimiter, 2, numChallenges); |
214 if(ret != KErrNone) |
208 if(ret != KErrNone) |
215 { |
209 { |
216 OstTraceDefExt3(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMSMARTCARDEAPMANAGER_PARSEEAPINFOL_6, "WARNING - CONFIGURATION FILE PARSING - Reading element NUMCHALLENGES returned %d (element no. %d) from tag %s.", ret,2,KScEapProcedures); |
210 LOGPARSERR("numChallenges", ret,2,&KScEapProcedures); |
217 continue; |
211 continue; |
218 } |
212 } |
219 else if (numChallenges > (countChl - nestedChlTag)) |
213 else if (numChallenges > (countChl - nestedChlTag)) |
220 { |
214 { |
221 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMSMARTCARDEAPMANAGER_PARSEEAPINFOL_7, "ERROR CONFIGURATION FILE PARSING: error SC EAP PROC INFO specifies more challenges than available [%d]", index); |
215 LOGPHONE2("ERROR CONFIGURATION FILE PARSING: error SC EAP PROC INFO specifies more challenges than available [%d]", index); |
222 continue; |
216 continue; |
223 } |
217 } |
224 else if (numChallenges < 0) |
218 else if (numChallenges < 0) |
225 { |
219 { |
226 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMSMARTCARDEAPMANAGER_PARSEEAPINFOL_8, "ERROR CONFIGURATION FILE PARSING: error SC EAP PROC INFO specifies -ve challenge number [%d]", index); |
220 LOGPHONE2("ERROR CONFIGURATION FILE PARSING: error SC EAP PROC INFO specifies -ve challenge number [%d]", index); |
227 continue; |
221 continue; |
228 } |
222 } |
229 |
223 |
230 // Get optional data format; this format is used for all data of this parsed procedure |
224 // Get optional data format; this format is used for all data of this parsed procedure |
231 ret = CTestConfig::GetElement(item->Value(), KStdDelimiter, 3, dataFrmt); |
225 ret = CTestConfig::GetElement(item->Value(), KStdDelimiter, 3, dataFrmt); |
232 if(ret != KErrNone) |
226 if(ret != KErrNone) |
233 { |
227 { |
234 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMSMARTCARDEAPMANAGER_PARSEEAPINFOL_9, "CONFIGURATION FILE PARSING: SC EAP PROC INFO tag with no data format [%d]", index); |
228 LOGPHONE2("CONFIGURATION FILE PARSING: SC EAP PROC INFO tag with no data format [%d]", index); |
235 } |
229 } |
236 else if (dataFrmt >= EMaxConfigDataFormat) |
230 else if (dataFrmt >= EMaxConfigDataFormat) |
237 { |
231 { |
238 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMSMARTCARDEAPMANAGER_PARSEEAPINFOL_10, "WARNING IN CONFIGURATION FILE PARSING - error wrong data format value SC EAP PROC INFO tag [%d] (ASCII format will be used)", index); |
232 LOGPHONE2("WARNING IN CONFIGURATION FILE PARSING - error wrong data format value SC EAP PROC INFO tag [%d] (ASCII format will be used)", index); |
239 dataFrmt = EConfigDataFormatAscii; |
233 dataFrmt = EConfigDataFormatAscii; |
240 } |
234 } |
241 |
235 |
242 TPtrC8 ptr; |
236 TPtrC8 ptr; |
243 TPtr8 tempPtr(NULL,0); |
237 TPtr8 tempPtr(NULL,0); |
249 item = const_cast<CTestConfigItem*>(CfgFile()->Item(KScEapKeyMSK, nestedKeyTag++)); |
243 item = const_cast<CTestConfigItem*>(CfgFile()->Item(KScEapKeyMSK, nestedKeyTag++)); |
250 |
244 |
251 // parse delay and key |
245 // parse delay and key |
252 if (item == NULL) |
246 if (item == NULL) |
253 { |
247 { |
254 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMSMARTCARDEAPMANAGER_PARSEEAPINFOL_11, "WARNING CONFIGURATION FILE PARSING: could not read EAP Key tag [%d]", nestedKeyTag-1); |
248 LOGPHONE2("WARNING CONFIGURATION FILE PARSING: could not read EAP Key tag [%d]", nestedKeyTag-1); |
255 } |
249 } |
256 else |
250 else |
257 { |
251 { |
258 ret = CTestConfig::GetElement(item->Value(), KStdDelimiter, 0, ptr); |
252 ret = CTestConfig::GetElement(item->Value(), KStdDelimiter, 0, ptr); |
259 if (ret != KErrNone) |
253 if (ret != KErrNone) |
260 { |
254 { |
261 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMSMARTCARDEAPMANAGER_PARSEEAPINFOL_12, "WARNING CONFIGURATION FILE PARSING: could not read EAP Key tag's data [%d]", nestedKeyTag-1); |
255 LOGPHONE2("WARNING CONFIGURATION FILE PARSING: could not read EAP Key tag's data [%d]", nestedKeyTag-1); |
262 } |
256 } |
263 else |
257 else |
264 { |
258 { |
265 TRAPD(kAllocErr, startData = ptr.AllocL()); |
259 TRAPD(kAllocErr, startData = ptr.AllocL()); |
266 if (kAllocErr != KErrNone) |
260 if (kAllocErr != KErrNone) |
267 { |
261 { |
268 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMSMARTCARDEAPMANAGER_PARSEEAPINFOL_13, "WARNING CONFIGURATION FILE PARSING: could not allocate mem for EAP Key data [%d]", nestedKeyTag-1); |
262 LOGPHONE2("WARNING CONFIGURATION FILE PARSING: could not allocate mem for EAP Key data [%d]", nestedKeyTag-1); |
269 } |
263 } |
270 else |
264 else |
271 { |
265 { |
272 tempPtr.Set(startData->Des()); |
266 tempPtr.Set(startData->Des()); |
273 switch (dataFrmt) |
267 switch (dataFrmt) |
280 } |
274 } |
281 // need to re-copy because converting to binary changes size |
275 // need to re-copy because converting to binary changes size |
282 TRAP(kAllocErr, procInfo.iEapKey = tempPtr.AllocL()); |
276 TRAP(kAllocErr, procInfo.iEapKey = tempPtr.AllocL()); |
283 if (kAllocErr != KErrNone) |
277 if (kAllocErr != KErrNone) |
284 { |
278 { |
285 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMSMARTCARDEAPMANAGER_PARSEEAPINFOL_14, "WARNING CONFIGURATION FILE PARSING: could not allocate mem for EAP Key data copy [%d]", nestedKeyTag-1); |
279 LOGPHONE2("WARNING CONFIGURATION FILE PARSING: could not allocate mem for EAP Key data copy [%d]", nestedKeyTag-1); |
286 } |
280 } |
287 delete startData; |
281 delete startData; |
288 startData = NULL; |
282 startData = NULL; |
289 } |
283 } |
290 } |
284 } |
291 } |
285 } |
292 } |
286 } |
293 else |
287 else |
294 { |
288 { |
295 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMSMARTCARDEAPMANAGER_PARSEEAPINFOL_15, "ERROR CONFIGURATION FILE PARSING: NO SC EAP KEY INFO TAG"); |
289 LOGPHONE1("ERROR CONFIGURATION FILE PARSING: NO SC EAP KEY INFO TAG"); |
296 } |
290 } |
297 |
291 |
298 // Get EMSK |
292 // Get EMSK |
299 if (nestedExtKeyTag < countExtKey) |
293 if (nestedExtKeyTag < countExtKey) |
300 { |
294 { |
301 item = const_cast<CTestConfigItem*>(CfgFile()->Item(KScEapKeyEMSK, nestedExtKeyTag++)); |
295 item = const_cast<CTestConfigItem*>(CfgFile()->Item(KScEapKeyEMSK, nestedExtKeyTag++)); |
302 |
296 |
303 // parse key |
297 // parse key |
304 if (item == NULL) |
298 if (item == NULL) |
305 { |
299 { |
306 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMSMARTCARDEAPMANAGER_PARSEEAPINFOL_16, "WARNING CONFIGURATION FILE PARSING: could not read EAP Ext Key tag [%d]", nestedExtKeyTag-1); |
300 LOGPHONE2("WARNING CONFIGURATION FILE PARSING: could not read EAP Ext Key tag [%d]", nestedExtKeyTag-1); |
307 } |
301 } |
308 else |
302 else |
309 { |
303 { |
310 ret = CTestConfig::GetElement(item->Value(), KStdDelimiter, 0, ptr); |
304 ret = CTestConfig::GetElement(item->Value(), KStdDelimiter, 0, ptr); |
311 if (ret != KErrNone) |
305 if (ret != KErrNone) |
312 { |
306 { |
313 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMSMARTCARDEAPMANAGER_PARSEEAPINFOL_17, "WARNING CONFIGURATION FILE PARSING: could not read EAP Ext Key tag's data [%d]", nestedExtKeyTag-1); |
307 LOGPHONE2("WARNING CONFIGURATION FILE PARSING: could not read EAP Ext Key tag's data [%d]", nestedExtKeyTag-1); |
314 } |
308 } |
315 else |
309 else |
316 { |
310 { |
317 TRAPD(kAllocErr, startData = ptr.AllocL()); |
311 TRAPD(kAllocErr, startData = ptr.AllocL()); |
318 if (kAllocErr != KErrNone) |
312 if (kAllocErr != KErrNone) |
319 { |
313 { |
320 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMSMARTCARDEAPMANAGER_PARSEEAPINFOL_18, "WARNING CONFIGURATION FILE PARSING: could not allocate mem for EAP Ext Key data [%d]", nestedExtKeyTag-1); |
314 LOGPHONE2("WARNING CONFIGURATION FILE PARSING: could not allocate mem for EAP Ext Key data [%d]", nestedExtKeyTag-1); |
321 } |
315 } |
322 else |
316 else |
323 { |
317 { |
324 tempPtr.Set(startData->Des()); |
318 tempPtr.Set(startData->Des()); |
325 switch (dataFrmt) |
319 switch (dataFrmt) |
332 } |
326 } |
333 // need to re-copy because converting to binary changes size |
327 // need to re-copy because converting to binary changes size |
334 TRAP(kAllocErr, procInfo.iEapExtKey = tempPtr.AllocL()); |
328 TRAP(kAllocErr, procInfo.iEapExtKey = tempPtr.AllocL()); |
335 if (kAllocErr != KErrNone) |
329 if (kAllocErr != KErrNone) |
336 { |
330 { |
337 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMSMARTCARDEAPMANAGER_PARSEEAPINFOL_19, "WARNING CONFIGURATION FILE PARSING: could not allocate mem for EAP Ext Key data copy [%d]", nestedExtKeyTag-1); |
331 LOGPHONE2("WARNING CONFIGURATION FILE PARSING: could not allocate mem for EAP Ext Key data copy [%d]", nestedExtKeyTag-1); |
338 } |
332 } |
339 delete startData; |
333 delete startData; |
340 startData = NULL; |
334 startData = NULL; |
341 } |
335 } |
342 } |
336 } |
343 } |
337 } |
344 } |
338 } |
345 else |
339 else |
346 { |
340 { |
347 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMSMARTCARDEAPMANAGER_PARSEEAPINFOL_20, "ERROR CONFIGURATION FILE PARSING: NO SC EAP EXT KEY INFO TAG"); |
341 LOGPHONE1("ERROR CONFIGURATION FILE PARSING: NO SC EAP EXT KEY INFO TAG"); |
348 } |
342 } |
349 |
343 |
350 // Get Permanent Identity |
344 // Get Permanent Identity |
351 if (nestedIdTag < countId) |
345 if (nestedIdTag < countId) |
352 { |
346 { |
353 item = const_cast<CTestConfigItem*>(CfgFile()->Item(KScEapIdentity, nestedIdTag++)); |
347 item = const_cast<CTestConfigItem*>(CfgFile()->Item(KScEapIdentity, nestedIdTag++)); |
354 |
348 |
355 // parse id |
349 // parse id |
356 if (item == NULL) |
350 if (item == NULL) |
357 { |
351 { |
358 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMSMARTCARDEAPMANAGER_PARSEEAPINFOL_21, "WARNING CONFIGURATION FILE PARSING: could not read EAP id tag [%d]", nestedIdTag-1); |
352 LOGPHONE2("WARNING CONFIGURATION FILE PARSING: could not read EAP id tag [%d]", nestedIdTag-1); |
359 } |
353 } |
360 else |
354 else |
361 { |
355 { |
362 ret = CTestConfig::GetElement(item->Value(), KStdDelimiter, 0, ptr); |
356 ret = CTestConfig::GetElement(item->Value(), KStdDelimiter, 0, ptr); |
363 if (ret != KErrNone) |
357 if (ret != KErrNone) |
364 { |
358 { |
365 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMSMARTCARDEAPMANAGER_PARSEEAPINFOL_22, "WARNING CONFIGURATION FILE PARSING: could not read EAP Id tag's data [%d]", nestedIdTag-1); |
359 LOGPHONE2("WARNING CONFIGURATION FILE PARSING: could not read EAP Id tag's data [%d]", nestedIdTag-1); |
366 } |
360 } |
367 else |
361 else |
368 { |
362 { |
369 TRAPD(idAllocErr, startData = ptr.AllocL()); |
363 TRAPD(idAllocErr, startData = ptr.AllocL()); |
370 if (idAllocErr != KErrNone) |
364 if (idAllocErr != KErrNone) |
371 { |
365 { |
372 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMSMARTCARDEAPMANAGER_PARSEEAPINFOL_23, "WARNING CONFIGURATION FILE PARSING: could not allocate mem for EAP Id data [%d]", nestedIdTag-1); |
366 LOGPHONE2("WARNING CONFIGURATION FILE PARSING: could not allocate mem for EAP Id data [%d]", nestedIdTag-1); |
373 } |
367 } |
374 else |
368 else |
375 { |
369 { |
376 TPtr8 tempPtr(NULL,0); |
370 TPtr8 tempPtr(NULL,0); |
377 tempPtr.Set(startData->Des()); |
371 tempPtr.Set(startData->Des()); |
385 } |
379 } |
386 // need to re-copy because converting to binary changes size |
380 // need to re-copy because converting to binary changes size |
387 TRAP(idAllocErr, procInfo.iEapId = tempPtr.AllocL()); |
381 TRAP(idAllocErr, procInfo.iEapId = tempPtr.AllocL()); |
388 if (idAllocErr != KErrNone) |
382 if (idAllocErr != KErrNone) |
389 { |
383 { |
390 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMSMARTCARDEAPMANAGER_PARSEEAPINFOL_24, "WARNING CONFIGURATION FILE PARSING: could not allocate mem for EAP Id data copy [%d]", nestedIdTag-1); |
384 LOGPHONE2("WARNING CONFIGURATION FILE PARSING: could not allocate mem for EAP Id data copy [%d]", nestedIdTag-1); |
391 } |
385 } |
392 delete startData; |
386 delete startData; |
393 startData = NULL; |
387 startData = NULL; |
394 } |
388 } |
395 } |
389 } |
396 } |
390 } |
397 } |
391 } |
398 else |
392 else |
399 { |
393 { |
400 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMSMARTCARDEAPMANAGER_PARSEEAPINFOL_25, "WARNING CONFIGURATION FILE PARSING: NO SC EAP ID INFO TAG"); |
394 LOGPHONE1("WARNING CONFIGURATION FILE PARSING: NO SC EAP ID INFO TAG"); |
401 } |
395 } |
402 |
396 |
403 // Get Pseudonym Identity |
397 // Get Pseudonym Identity |
404 if (nestedPsIdTag < countPsId) |
398 if (nestedPsIdTag < countPsId) |
405 { |
399 { |
406 item = const_cast<CTestConfigItem*>(CfgFile()->Item(KScEapPsIdentity, nestedPsIdTag++)); |
400 item = const_cast<CTestConfigItem*>(CfgFile()->Item(KScEapPsIdentity, nestedPsIdTag++)); |
407 |
401 |
408 // parse id |
402 // parse id |
409 if (item == NULL) |
403 if (item == NULL) |
410 { |
404 { |
411 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMSMARTCARDEAPMANAGER_PARSEEAPINFOL_26, "WARNING CONFIGURATION FILE PARSING: could not read EAP Pseudonym id tag [%d]", nestedPsIdTag-1); |
405 LOGPHONE2("WARNING CONFIGURATION FILE PARSING: could not read EAP Pseudonym id tag [%d]", nestedPsIdTag-1); |
412 } |
406 } |
413 else |
407 else |
414 { |
408 { |
415 ret = CTestConfig::GetElement(item->Value(), KStdDelimiter, 0, ptr); |
409 ret = CTestConfig::GetElement(item->Value(), KStdDelimiter, 0, ptr); |
416 if (ret != KErrNone) |
410 if (ret != KErrNone) |
417 { |
411 { |
418 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMSMARTCARDEAPMANAGER_PARSEEAPINFOL_27, "WARNING CONFIGURATION FILE PARSING: could not read EAP Pseudonym Id tag's data [%d]", nestedPsIdTag-1); |
412 LOGPHONE2("WARNING CONFIGURATION FILE PARSING: could not read EAP Pseudonym Id tag's data [%d]", nestedPsIdTag-1); |
419 } |
413 } |
420 else |
414 else |
421 { |
415 { |
422 TRAPD(idAllocErr, startData = ptr.AllocL()); |
416 TRAPD(idAllocErr, startData = ptr.AllocL()); |
423 if (idAllocErr != KErrNone) |
417 if (idAllocErr != KErrNone) |
424 { |
418 { |
425 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMSMARTCARDEAPMANAGER_PARSEEAPINFOL_28, "WARNING CONFIGURATION FILE PARSING: could not allocate mem for EAP Pseudonym Id data [%d]", nestedPsIdTag-1); |
419 LOGPHONE2("WARNING CONFIGURATION FILE PARSING: could not allocate mem for EAP Pseudonym Id data [%d]", nestedPsIdTag-1); |
426 } |
420 } |
427 else |
421 else |
428 { |
422 { |
429 TPtr8 tempPtr(NULL,0); |
423 TPtr8 tempPtr(NULL,0); |
430 tempPtr.Set(startData->Des()); |
424 tempPtr.Set(startData->Des()); |
438 } |
432 } |
439 // need to re-copy because converting to binary changes size |
433 // need to re-copy because converting to binary changes size |
440 TRAP(idAllocErr, procInfo.iEapPsId = tempPtr.AllocL()); |
434 TRAP(idAllocErr, procInfo.iEapPsId = tempPtr.AllocL()); |
441 if (idAllocErr != KErrNone) |
435 if (idAllocErr != KErrNone) |
442 { |
436 { |
443 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMSMARTCARDEAPMANAGER_PARSEEAPINFOL_29, "WARNING CONFIGURATION FILE PARSING: could not allocate mem for EAP Pseudonym Id data copy [%d]", nestedPsIdTag-1); |
437 LOGPHONE2("WARNING CONFIGURATION FILE PARSING: could not allocate mem for EAP Pseudonym Id data copy [%d]", nestedPsIdTag-1); |
444 } |
438 } |
445 delete startData; |
439 delete startData; |
446 startData = NULL; |
440 startData = NULL; |
447 } |
441 } |
448 } |
442 } |
449 } |
443 } |
450 } |
444 } |
451 else |
445 else |
452 { |
446 { |
453 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMSMARTCARDEAPMANAGER_PARSEEAPINFOL_30, "WARNING CONFIGURATION FILE PARSING: NO SC EAP PS ID INFO TAG"); |
447 LOGPHONE1("WARNING CONFIGURATION FILE PARSING: NO SC EAP PS ID INFO TAG"); |
454 } |
448 } |
455 |
449 |
456 // Get challenges |
450 // Get challenges |
457 // numChallenges is what is parsed from config.txt and will be |
451 // numChallenges is what is parsed from config.txt and will be |
458 // decremented in loop till zero is reached. |
452 // decremented in loop till zero is reached. |
461 // countChl is the total number of KScEapChallenge found. |
455 // countChl is the total number of KScEapChallenge found. |
462 while (numChallenges != 0) |
456 while (numChallenges != 0) |
463 { |
457 { |
464 if (nestedChlTag >= countChl) |
458 if (nestedChlTag >= countChl) |
465 { |
459 { |
466 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMSMARTCARDEAPMANAGER_PARSEEAPINFOL_31, "WARNING CONFIGURATION FILE PARSING: NO MORE SC EAP Challenge INFO TAG"); |
460 LOGPHONE1("WARNING CONFIGURATION FILE PARSING: NO MORE SC EAP Challenge INFO TAG"); |
467 break; |
461 break; |
468 } |
462 } |
469 |
463 |
470 item = const_cast<CTestConfigItem*>(CfgFile()->Item(KScEapChallenge, nestedChlTag++)); |
464 item = const_cast<CTestConfigItem*>(CfgFile()->Item(KScEapChallenge, nestedChlTag++)); |
471 numChallenges--; |
465 numChallenges--; |
472 |
466 |
473 // parse delay and challenge/response and auth status |
467 // parse delay and challenge/response and auth status |
474 if (item == NULL) |
468 if (item == NULL) |
475 { |
469 { |
476 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMSMARTCARDEAPMANAGER_PARSEEAPINFOL_32, "WARNING CONFIGURATION FILE PARSING: could not read EAP challenge tag [%d]", nestedChlTag-1); |
470 LOGPHONE2("WARNING CONFIGURATION FILE PARSING: could not read EAP challenge tag [%d]", nestedChlTag-1); |
477 continue; |
471 continue; |
478 } |
472 } |
479 |
473 |
480 // Parse challenge |
474 // Parse challenge |
481 ret = CTestConfig::GetElement(item->Value(), KStdDelimiter, 0, ptr); |
475 ret = CTestConfig::GetElement(item->Value(), KStdDelimiter, 0, ptr); |
482 if (ret != KErrNone) |
476 if (ret != KErrNone) |
483 { |
477 { |
484 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMSMARTCARDEAPMANAGER_PARSEEAPINFOL_33, "WARNING CONFIGURATION FILE PARSING: could not read EAP challenge data [%d]", nestedChlTag-1); |
478 LOGPHONE2("WARNING CONFIGURATION FILE PARSING: could not read EAP challenge data [%d]", nestedChlTag-1); |
485 continue; |
479 continue; |
486 } |
480 } |
487 |
481 |
488 TRAPD(leaveErr, startData = ptr.AllocL()); |
482 TRAPD(leaveErr, startData = ptr.AllocL()); |
489 if (leaveErr != KErrNone) |
483 if (leaveErr != KErrNone) |
490 { |
484 { |
491 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMSMARTCARDEAPMANAGER_PARSEEAPINFOL_34, "WARNING CONFIGURATION FILE PARSING: could not allocate mem for EAP challenge data [%d]", nestedChlTag-1); |
485 LOGPHONE2("WARNING CONFIGURATION FILE PARSING: could not allocate mem for EAP challenge data [%d]", nestedChlTag-1); |
492 continue; |
486 continue; |
493 } |
487 } |
494 tempPtr.Set(startData->Des()); |
488 tempPtr.Set(startData->Des()); |
495 switch (dataFrmt) |
489 switch (dataFrmt) |
496 { |
490 { |
502 } |
496 } |
503 TEapChngResp newChRespData; |
497 TEapChngResp newChRespData; |
504 TRAP(leaveErr, newChRespData.iChallenge = tempPtr.AllocL()); |
498 TRAP(leaveErr, newChRespData.iChallenge = tempPtr.AllocL()); |
505 if (leaveErr != KErrNone) |
499 if (leaveErr != KErrNone) |
506 { |
500 { |
507 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMSMARTCARDEAPMANAGER_PARSEEAPINFOL_35, "WARNING CONFIGURATION FILE PARSING: could not allocate mem for EAP challenge data copy [%d]", nestedKeyTag-1); |
501 LOGPHONE2("WARNING CONFIGURATION FILE PARSING: could not allocate mem for EAP challenge data copy [%d]", nestedKeyTag-1); |
508 } |
502 } |
509 delete startData; |
503 delete startData; |
510 startData = NULL; |
504 startData = NULL; |
511 |
505 |
512 // Parse response |
506 // Parse response |
513 ret = CTestConfig::GetElement(item->Value(), KStdDelimiter, 1, ptr); |
507 ret = CTestConfig::GetElement(item->Value(), KStdDelimiter, 1, ptr); |
514 if (ret != KErrNone) |
508 if (ret != KErrNone) |
515 { |
509 { |
516 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMSMARTCARDEAPMANAGER_PARSEEAPINFOL_36, "WARNING CONFIGURATION FILE PARSING: could not read EAP response data [%d]", nestedChlTag-1); |
510 LOGPHONE2("WARNING CONFIGURATION FILE PARSING: could not read EAP response data [%d]", nestedChlTag-1); |
517 continue; |
511 continue; |
518 } |
512 } |
519 |
513 |
520 TRAP(leaveErr, startData = ptr.AllocL()); |
514 TRAP(leaveErr, startData = ptr.AllocL()); |
521 if (leaveErr != KErrNone) |
515 if (leaveErr != KErrNone) |
522 { |
516 { |
523 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMSMARTCARDEAPMANAGER_PARSEEAPINFOL_37, "WARNING CONFIGURATION FILE PARSING: could not allocate mem for EAP response data [%d]", nestedChlTag-1); |
517 LOGPHONE2("WARNING CONFIGURATION FILE PARSING: could not allocate mem for EAP response data [%d]", nestedChlTag-1); |
524 continue; |
518 continue; |
525 } |
519 } |
526 tempPtr.Set(startData->Des()); |
520 tempPtr.Set(startData->Des()); |
527 switch (dataFrmt) |
521 switch (dataFrmt) |
528 { |
522 { |
533 //default: |
527 //default: |
534 } |
528 } |
535 TRAP(leaveErr, newChRespData.iResp = tempPtr.AllocL()); |
529 TRAP(leaveErr, newChRespData.iResp = tempPtr.AllocL()); |
536 if (leaveErr != KErrNone) |
530 if (leaveErr != KErrNone) |
537 { |
531 { |
538 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMSMARTCARDEAPMANAGER_PARSEEAPINFOL_38, "WARNING CONFIGURATION FILE PARSING: could not allocate mem for EAP response data copy [%d]", nestedKeyTag-1); |
532 LOGPHONE2("WARNING CONFIGURATION FILE PARSING: could not allocate mem for EAP response data copy [%d]", nestedKeyTag-1); |
539 } |
533 } |
540 delete startData; |
534 delete startData; |
541 startData = NULL; |
535 startData = NULL; |
542 |
536 |
543 // Parse status |
537 // Parse status |
544 TInt stat; |
538 TInt stat; |
545 ret = CTestConfig::GetElement(item->Value(), KStdDelimiter, 2, stat); |
539 ret = CTestConfig::GetElement(item->Value(), KStdDelimiter, 2, stat); |
546 if (ret != KErrNone) |
540 if (ret != KErrNone) |
547 { |
541 { |
548 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMSMARTCARDEAPMANAGER_PARSEEAPINFOL_39, "WARNING CONFIGURATION FILE PARSING: could not read EAP auth status [%d]", nestedChlTag-1); |
542 LOGPHONE2("WARNING CONFIGURATION FILE PARSING: could not read EAP auth status [%d]", nestedChlTag-1); |
549 continue; |
543 continue; |
550 } |
544 } |
551 |
545 |
552 newChRespData.iAuthStatus = static_cast<RMobileSmartCardEap::TEapAuthStatus>(stat); |
546 newChRespData.iAuthStatus = static_cast<RMobileSmartCardEap::TEapAuthStatus>(stat); |
553 |
547 |
554 leaveErr = procInfo.iChResp.Append(newChRespData); |
548 leaveErr = procInfo.iChResp.Append(newChRespData); |
555 if (leaveErr != KErrNone) |
549 if (leaveErr != KErrNone) |
556 { |
550 { |
557 OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMSMARTCARDEAPMANAGER_PARSEEAPINFOL_40, "WARNING CONFIGURATION FILE PARSING: could not allocate mem for EAP challenge/resp data [%d] [err=%d]", nestedChlTag-1, leaveErr); |
551 LOGPHONE3("WARNING CONFIGURATION FILE PARSING: could not allocate mem for EAP challenge/resp data [%d] [err=%d]", nestedChlTag-1, leaveErr); |
558 } |
552 } |
559 } // end while |
553 } // end while |
560 |
554 |
561 TInt errAppend = iEapProcData.Append(procInfo); |
555 TInt errAppend = iEapProcData.Append(procInfo); |
562 if (errAppend != KErrNone) |
556 if (errAppend != KErrNone) |
563 { |
557 { |
564 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMSMARTCARDEAPMANAGER_PARSEEAPINFOL_41, "ERROR CONFIGURATION FILE PARSING: Could not store parsed EAP procedure data [err=%d]", errAppend); |
558 LOGPHONE2("ERROR CONFIGURATION FILE PARSING: Could not store parsed EAP procedure data [err=%d]", errAppend); |
565 } |
559 } |
566 else |
560 else |
567 { |
561 { |
568 iDiscardedProcedure.Append(EFalse); |
562 iDiscardedProcedure.Append(EFalse); |
569 } |
563 } |
570 } // end for; parsing EAP procedures from config.txt |
564 } // end for; parsing EAP procedures from config.txt |
571 |
565 |
572 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMSMARTCARDEAPMANAGER_PARSEEAPINFOL_42, "CSimSmartCardEapManager::ParseEapInfoL completed"); |
566 LOGPHONE1("CSimSmartCardEapManager::ParseEapInfoL completed"); |
573 } |
567 } |
574 |
568 |
575 /** |
569 /** |
576 Function leaves if <aAID,aEapType> is not in config file. |
570 Function leaves if <aAID,aEapType> is not in config file. |
577 |
571 |
597 User::Leave(KErrNotFound); |
591 User::Leave(KErrNotFound); |
598 } |
592 } |
599 |
593 |
600 CTelObject* CSimSmartCardEapManager::CreateScEapSubSessionL(RMobilePhone::TAID& aAID, RMobileSmartCardEap::TEapType& aEapType) |
594 CTelObject* CSimSmartCardEapManager::CreateScEapSubSessionL(RMobilePhone::TAID& aAID, RMobileSmartCardEap::TEapType& aEapType) |
601 { |
595 { |
602 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMSMARTCARDEAPMANAGER_CREATESCEAPSUBSESSIONL_1, "CSimSmartCardEapManager::CreateScEapSubSessionL called"); |
596 LOGPHONE1("CSimSmartCardEapManager::CreateScEapSubSessionL called"); |
603 // If no config exists for this eapAID,eapType pair, then this will leave |
597 // If no config exists for this eapAID,eapType pair, then this will leave |
604 AID_EapType_ExistsInConfigL(aAID, aEapType); |
598 AID_EapType_ExistsInConfigL(aAID, aEapType); |
605 |
599 |
606 // If exists then phoneScEap guaranteed to get data in |
600 // If exists then phoneScEap guaranteed to get data in |
607 // InitialiseEapMethod, since only one object can be created |
601 // InitialiseEapMethod, since only one object can be created |
719 iEapType = aEapType; |
713 iEapType = aEapType; |
720 } |
714 } |
721 |
715 |
722 void CSimSmartCardEap::ConstructL(CSimSmartCardEapManager* aEapMan) |
716 void CSimSmartCardEap::ConstructL(CSimSmartCardEapManager* aEapMan) |
723 { |
717 { |
724 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMSMARTCARDEAP_CONSTRUCTL_1, "CSimSmartCardEap: starting second phase construction"); |
718 LOGPHONE1("CSimSmartCardEap: starting second phase construction"); |
725 |
719 |
726 iSemaphr.CreateGlobal(KNullDesC, EOwnerThread); |
720 iSemaphr.CreateGlobal(KNullDesC, EOwnerThread); |
727 aEapMan->RegisterSubSessionL(this); |
721 aEapMan->RegisterSubSessionL(this); |
728 iEapMan = aEapMan; |
722 iEapMan = aEapMan; |
729 |
723 |
730 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMSMARTCARDEAP_CONSTRUCTL_2, "CSimSmartCardEap created"); |
724 LOGPHONE1("CSimSmartCardEap created"); |
731 } |
725 } |
732 |
726 |
733 CSimSmartCardEap::~CSimSmartCardEap() |
727 CSimSmartCardEap::~CSimSmartCardEap() |
734 { |
728 { |
735 if (iCliTerminationListener != NULL) |
729 if (iCliTerminationListener != NULL) |
966 { |
960 { |
967 delete iCliTerminationListener; |
961 delete iCliTerminationListener; |
968 TRAPD(err, iCliTerminationListener = CThreadTerminationListener::NewL(this, *aThreadId)); |
962 TRAPD(err, iCliTerminationListener = CThreadTerminationListener::NewL(this, *aThreadId)); |
969 if (err != KErrNone) |
963 if (err != KErrNone) |
970 { |
964 { |
971 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMSMARTCARDEAP_SIMINITIALISEEAPMETHOD_2, "ERROR could not create a client termination listener [err=%d] (not initialised)", err); |
965 LOGPHONE2("ERROR could not create a client termination listener [err=%d] (not initialised)", err); |
972 ReqCompleted(aTsyReqHandle, err); |
966 ReqCompleted(aTsyReqHandle, err); |
973 } |
967 } |
974 else |
968 else |
975 { |
969 { |
976 iProcedureData = iEapMan->ProcData(iAID, iEapType); |
970 iProcedureData = iEapMan->ProcData(iAID, iEapType); |
977 if (iProcedureData == NULL) |
971 if (iProcedureData == NULL) |
978 { |
972 { |
979 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMSMARTCARDEAP_SIMINITIALISEEAPMETHOD_3, "ERROR could not find sub-session's procedure"); |
973 LOGPHONE1("ERROR could not find sub-session's procedure"); |
980 ReqCompleted(aTsyReqHandle, KErrNotFound); |
974 ReqCompleted(aTsyReqHandle, KErrNotFound); |
981 return KErrNone; |
975 return KErrNone; |
982 } |
976 } |
983 |
977 |
984 iSSInitialised = ETrue; |
978 iSSInitialised = ETrue; |
992 return KErrNone; |
986 return KErrNone; |
993 } |
987 } |
994 |
988 |
995 TInt CSimSmartCardEap::SimInitialiseEapMethodCancel(const TTsyReqHandle aTsyReqHandle) |
989 TInt CSimSmartCardEap::SimInitialiseEapMethodCancel(const TTsyReqHandle aTsyReqHandle) |
996 { |
990 { |
997 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMSMARTCARDEAP_SIMINITIALISEEAPMETHODCANCEL_1, "CSimSmartCardEap::SimInitialiseEapMethodCancel called"); |
991 LOGPHONE1("CSimSmartCardEap::SimInitialiseEapMethodCancel called"); |
998 iProcedureData = NULL; |
992 iProcedureData = NULL; |
999 iSSInitialised = EFalse; |
993 iSSInitialised = EFalse; |
1000 iAccessStatus = RMobileSmartCardEap::EEapMethodAvailable; |
994 iAccessStatus = RMobileSmartCardEap::EEapMethodAvailable; |
1001 SimCompleteNotifyEapMethodAccessStatusChange(); |
995 SimCompleteNotifyEapMethodAccessStatusChange(); |
1002 ReqCompleted(aTsyReqHandle, KErrCancel); |
996 ReqCompleted(aTsyReqHandle, KErrCancel); |
1003 return KErrNone; |
997 return KErrNone; |
1004 } |
998 } |
1005 |
999 |
1006 TInt CSimSmartCardEap::SimGetUserIdentity(const TTsyReqHandle aTsyReqHandle, RMobileSmartCardEap::TEapUserIdType* aEapIdType, TDes8* aUserId) |
1000 TInt CSimSmartCardEap::SimGetUserIdentity(const TTsyReqHandle aTsyReqHandle, RMobileSmartCardEap::TEapUserIdType* aEapIdType, TDes8* aUserId) |
1007 { |
1001 { |
1008 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMSMARTCARDEAP_SIMGETUSERIDENTITY_1, "CSimSmartCardEap::SimGetUserIdentity called"); |
1002 LOGPHONE1("CSimSmartCardEap::SimGetUserIdentity called"); |
1009 |
1003 |
1010 RMobileSmartCardEap::TEapUserIdentityV6Pckg *userIdPckg = reinterpret_cast<RMobileSmartCardEap::TEapUserIdentityV6Pckg*>(aUserId); |
1004 RMobileSmartCardEap::TEapUserIdentityV6Pckg *userIdPckg = reinterpret_cast<RMobileSmartCardEap::TEapUserIdentityV6Pckg*>(aUserId); |
1011 RMobileSmartCardEap::TEapUserIdentityV6 &userId = (*userIdPckg)(); |
1005 RMobileSmartCardEap::TEapUserIdentityV6 &userId = (*userIdPckg)(); |
1012 |
1006 |
1013 // Check that the data structure is supported by the simulated TSY version |
1007 // Check that the data structure is supported by the simulated TSY version |
1021 if (*aEapIdType == RMobileSmartCardEap::EPermanentIdentity) |
1015 if (*aEapIdType == RMobileSmartCardEap::EPermanentIdentity) |
1022 { |
1016 { |
1023 if (iProcedureData->iEapId == NULL) |
1017 if (iProcedureData->iEapId == NULL) |
1024 { |
1018 { |
1025 ReqCompleted(aTsyReqHandle, KErrNotFound); |
1019 ReqCompleted(aTsyReqHandle, KErrNotFound); |
1026 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMSMARTCARDEAP_SIMGETUSERIDENTITY_2, "ERROR EAP sub-session does not contain EPermanentIdentity"); |
1020 LOGPHONE1("ERROR EAP sub-session does not contain EPermanentIdentity"); |
1027 return KErrNone; |
1021 return KErrNone; |
1028 } |
1022 } |
1029 |
1023 |
1030 userId.iEapId = iProcedureData->iEapId->Des(); |
1024 userId.iEapId = iProcedureData->iEapId->Des(); |
1031 } |
1025 } |
1032 else if (*aEapIdType == RMobileSmartCardEap::EPseudonymIdentity) |
1026 else if (*aEapIdType == RMobileSmartCardEap::EPseudonymIdentity) |
1033 { |
1027 { |
1034 if (iProcedureData->iEapPsId == NULL) |
1028 if (iProcedureData->iEapPsId == NULL) |
1035 { |
1029 { |
1036 ReqCompleted(aTsyReqHandle, KErrNotFound); |
1030 ReqCompleted(aTsyReqHandle, KErrNotFound); |
1037 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMSMARTCARDEAP_SIMGETUSERIDENTITY_3, "ERROR EAP sub-session does not contain EPseudonymIdentity"); |
1031 LOGPHONE1("ERROR EAP sub-session does not contain EPseudonymIdentity"); |
1038 return KErrNone; |
1032 return KErrNone; |
1039 } |
1033 } |
1040 |
1034 |
1041 userId.iEapId = iProcedureData->iEapPsId->Des(); |
1035 userId.iEapId = iProcedureData->iEapPsId->Des(); |
1042 } |
1036 } |
1043 else |
1037 else |
1044 { |
1038 { |
1045 ReqCompleted(aTsyReqHandle, KErrArgument); |
1039 ReqCompleted(aTsyReqHandle, KErrArgument); |
1046 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMSMARTCARDEAP_SIMGETUSERIDENTITY_4, "ERROR invalid EAP id type requested [tag=%d]", *aEapIdType); |
1040 LOGPHONE2("ERROR invalid EAP id type requested [tag=%d]", *aEapIdType); |
1047 return KErrNone; |
1041 return KErrNone; |
1048 } |
1042 } |
1049 |
1043 |
1050 ReqCompleted(aTsyReqHandle, KErrNone); |
1044 ReqCompleted(aTsyReqHandle, KErrNone); |
1051 return KErrNone; |
1045 return KErrNone; |
1052 } |
1046 } |
1053 |
1047 |
1054 TInt CSimSmartCardEap::SimGetUserIdentityCancel(const TTsyReqHandle aTsyReqHandle) |
1048 TInt CSimSmartCardEap::SimGetUserIdentityCancel(const TTsyReqHandle aTsyReqHandle) |
1055 { |
1049 { |
1056 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMSMARTCARDEAP_SIMGETUSERIDENTITYCANCEL_1, "CSimSmartCardEap::SimGetUserIdentityCancel called"); |
1050 LOGPHONE1("CSimSmartCardEap::SimGetUserIdentityCancel called"); |
1057 ReqCompleted(aTsyReqHandle, KErrCancel); |
1051 ReqCompleted(aTsyReqHandle, KErrCancel); |
1058 return KErrNone; |
1052 return KErrNone; |
1059 } |
1053 } |
1060 |
1054 |
1061 TInt CSimSmartCardEap::SimGetAuthenticationStatus(const TTsyReqHandle aTsyReqHandle, RMobileSmartCardEap::TEapAuthStatus* aAuthStatus) |
1055 TInt CSimSmartCardEap::SimGetAuthenticationStatus(const TTsyReqHandle aTsyReqHandle, RMobileSmartCardEap::TEapAuthStatus* aAuthStatus) |
1062 { |
1056 { |
1063 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMSMARTCARDEAP_SIMGETAUTHENTICATIONSTATUS_1, "CSimSmartCardEap::SimGetAuthenticationStatus called"); |
1057 LOGPHONE1("CSimSmartCardEap::SimGetAuthenticationStatus called"); |
1064 |
1058 |
1065 (*aAuthStatus) = iAuthStatus; |
1059 (*aAuthStatus) = iAuthStatus; |
1066 |
1060 |
1067 ReqCompleted(aTsyReqHandle, KErrNone); |
1061 ReqCompleted(aTsyReqHandle, KErrNone); |
1068 return KErrNone; |
1062 return KErrNone; |
1069 } |
1063 } |
1070 |
1064 |
1071 TInt CSimSmartCardEap::SimGetAuthenticationStatusCancel(const TTsyReqHandle aTsyReqHandle) |
1065 TInt CSimSmartCardEap::SimGetAuthenticationStatusCancel(const TTsyReqHandle aTsyReqHandle) |
1072 { |
1066 { |
1073 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMSMARTCARDEAP_SIMGETAUTHENTICATIONSTATUSCANCEL_1, "CSimSmartCardEap::SimGetAuthenticationStatusCancel called"); |
1067 LOGPHONE1("CSimSmartCardEap::SimGetAuthenticationStatusCancel called"); |
1074 ReqCompleted(aTsyReqHandle, KErrCancel); |
1068 ReqCompleted(aTsyReqHandle, KErrCancel); |
1075 return KErrNone; |
1069 return KErrNone; |
1076 } |
1070 } |
1077 |
1071 |
1078 TInt CSimSmartCardEap::SimGetEapKey(const TTsyReqHandle aTsyReqHandle, RMobileSmartCardEap::TEapKeyTag* aEapKeyTag, TDes8* aKey) |
1072 TInt CSimSmartCardEap::SimGetEapKey(const TTsyReqHandle aTsyReqHandle, RMobileSmartCardEap::TEapKeyTag* aEapKeyTag, TDes8* aKey) |
1079 { |
1073 { |
1080 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMSMARTCARDEAP_SIMGETEAPKEY_1, "CSimSmartCardEap::SimGetEapKey called"); |
1074 LOGPHONE1("CSimSmartCardEap::SimGetEapKey called"); |
1081 |
1075 |
1082 RMobileSmartCardEap::TEapKeyV6Pckg *keyPckg = reinterpret_cast<RMobileSmartCardEap::TEapKeyV6Pckg*>(aKey); |
1076 RMobileSmartCardEap::TEapKeyV6Pckg *keyPckg = reinterpret_cast<RMobileSmartCardEap::TEapKeyV6Pckg*>(aKey); |
1083 RMobileSmartCardEap::TEapKeyV6 &key = (*keyPckg)(); |
1077 RMobileSmartCardEap::TEapKeyV6 &key = (*keyPckg)(); |
1084 |
1078 |
1085 // Check that the data structure is supported by the simulated TSY version |
1079 // Check that the data structure is supported by the simulated TSY version |
1093 if (*aEapKeyTag == RMobileSmartCardEap::EEapKeyMSK) |
1087 if (*aEapKeyTag == RMobileSmartCardEap::EEapKeyMSK) |
1094 { |
1088 { |
1095 if (iProcedureData->iEapKey == NULL) |
1089 if (iProcedureData->iEapKey == NULL) |
1096 { |
1090 { |
1097 ReqCompleted(aTsyReqHandle, KErrNotFound); |
1091 ReqCompleted(aTsyReqHandle, KErrNotFound); |
1098 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMSMARTCARDEAP_SIMGETEAPKEY_2, "ERROR EAP sub-session does not contain EEapKeyMSK"); |
1092 LOGPHONE1("ERROR EAP sub-session does not contain EEapKeyMSK"); |
1099 return KErrNone; |
1093 return KErrNone; |
1100 } |
1094 } |
1101 |
1095 |
1102 key.iEapKey = iProcedureData->iEapKey->Des(); |
1096 key.iEapKey = iProcedureData->iEapKey->Des(); |
1103 } |
1097 } |
1104 else if (*aEapKeyTag == RMobileSmartCardEap::EEapKeyEMSK) |
1098 else if (*aEapKeyTag == RMobileSmartCardEap::EEapKeyEMSK) |
1105 { |
1099 { |
1106 if (iProcedureData->iEapExtKey == NULL) |
1100 if (iProcedureData->iEapExtKey == NULL) |
1107 { |
1101 { |
1108 ReqCompleted(aTsyReqHandle, KErrNotFound); |
1102 ReqCompleted(aTsyReqHandle, KErrNotFound); |
1109 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMSMARTCARDEAP_SIMGETEAPKEY_3, "ERROR EAP sub-session does not contain EEapKeyEMSK"); |
1103 LOGPHONE1("ERROR EAP sub-session does not contain EEapKeyEMSK"); |
1110 return KErrNone; |
1104 return KErrNone; |
1111 } |
1105 } |
1112 |
1106 |
1113 key.iEapKey = iProcedureData->iEapExtKey->Des(); |
1107 key.iEapKey = iProcedureData->iEapExtKey->Des(); |
1114 } |
1108 } |
1115 else |
1109 else |
1116 { |
1110 { |
1117 ReqCompleted(aTsyReqHandle, KErrArgument); |
1111 ReqCompleted(aTsyReqHandle, KErrArgument); |
1118 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMSMARTCARDEAP_SIMGETEAPKEY_4, "ERROR invalid EAP key tag requested [tag=%d]", *aEapKeyTag); |
1112 LOGPHONE2("ERROR invalid EAP key tag requested [tag=%d]", *aEapKeyTag); |
1119 return KErrNone; |
1113 return KErrNone; |
1120 } |
1114 } |
1121 |
1115 |
1122 ReqCompleted(aTsyReqHandle, KErrNone); |
1116 ReqCompleted(aTsyReqHandle, KErrNone); |
1123 return KErrNone; |
1117 return KErrNone; |
1124 } |
1118 } |
1125 |
1119 |
1126 TInt CSimSmartCardEap::SimGetEapKeyCancel(const TTsyReqHandle aTsyReqHandle) |
1120 TInt CSimSmartCardEap::SimGetEapKeyCancel(const TTsyReqHandle aTsyReqHandle) |
1127 { |
1121 { |
1128 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMSMARTCARDEAP_SIMGETEAPKEYCANCEL_1, "CSimSmartCardEap::SimGetEapKeyCancel called"); |
1122 LOGPHONE1("CSimSmartCardEap::SimGetEapKeyCancel called"); |
1129 ReqCompleted(aTsyReqHandle, KErrCancel); |
1123 ReqCompleted(aTsyReqHandle, KErrCancel); |
1130 return KErrNone; |
1124 return KErrNone; |
1131 } |
1125 } |
1132 |
1126 |
1133 TInt CSimSmartCardEap::SimSetAuthenticateDataForPhase1(const TTsyReqHandle aTsyReqHandle, TDes8* aEapAuthData, TInt* aPhase1Size) |
1127 TInt CSimSmartCardEap::SimSetAuthenticateDataForPhase1(const TTsyReqHandle aTsyReqHandle, TDes8* aEapAuthData, TInt* aPhase1Size) |
1134 { |
1128 { |
1135 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMSMARTCARDEAP_SIMSETAUTHENTICATEDATAFORPHASE1_1, "CSimSmartCardEap::SimSetAuthenticateDataForPhase1 called"); |
1129 LOGPHONE1("CSimSmartCardEap::SimSetAuthenticateDataForPhase1 called"); |
1136 |
1130 |
1137 if (iCurrentChallenge >= iProcedureData->iChResp.Count()) |
1131 if (iCurrentChallenge >= iProcedureData->iChResp.Count()) |
1138 { |
1132 { |
1139 ReqCompleted(aTsyReqHandle, KErrAccessDenied); |
1133 ReqCompleted(aTsyReqHandle, KErrAccessDenied); |
1140 return KErrNone; |
1134 return KErrNone; |
1142 |
1136 |
1143 RMobileSmartCardEap::CEapAuthenticateRequestDataV6* authReq = NULL; |
1137 RMobileSmartCardEap::CEapAuthenticateRequestDataV6* authReq = NULL; |
1144 TRAPD(err, authReq = RMobileSmartCardEap::CEapAuthenticateRequestDataV6::NewL()); |
1138 TRAPD(err, authReq = RMobileSmartCardEap::CEapAuthenticateRequestDataV6::NewL()); |
1145 if (err != KErrNone) |
1139 if (err != KErrNone) |
1146 { |
1140 { |
1147 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMSMARTCARDEAP_SIMSETAUTHENTICATEDATAFORPHASE1_2, "ERR Could not allocate memory for challenge request object [err=%d]", err); |
1141 LOGPHONE2("ERR Could not allocate memory for challenge request object [err=%d]", err); |
1148 ReqCompleted(aTsyReqHandle, err); |
1142 ReqCompleted(aTsyReqHandle, err); |
1149 return KErrNone; |
1143 return KErrNone; |
1150 } |
1144 } |
1151 |
1145 |
1152 TRAP(err, authReq->InternalizeL(*aEapAuthData)); |
1146 TRAP(err, authReq->InternalizeL(*aEapAuthData)); |
1153 if (err != KErrNone) |
1147 if (err != KErrNone) |
1154 { |
1148 { |
1155 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMSMARTCARDEAP_SIMSETAUTHENTICATEDATAFORPHASE1_3, "ERR Could not allocate memory for challenge request [err=%d]", err); |
1149 LOGPHONE2("ERR Could not allocate memory for challenge request [err=%d]", err); |
1156 ReqCompleted(aTsyReqHandle, err); |
1150 ReqCompleted(aTsyReqHandle, err); |
1157 return KErrNone; |
1151 return KErrNone; |
1158 } |
1152 } |
1159 |
1153 |
1160 TPtr8 reqPacket = authReq->GetEapReqPacket(); |
1154 TPtr8 reqPacket = authReq->GetEapReqPacket(); |
1162 TPtr8 tempPtr(NULL, 0); |
1156 TPtr8 tempPtr(NULL, 0); |
1163 tempPtr.Set(iProcedureData->iChResp[iCurrentChallenge].iChallenge->Des()); |
1157 tempPtr.Set(iProcedureData->iChResp[iCurrentChallenge].iChallenge->Des()); |
1164 |
1158 |
1165 if (reqPacket != tempPtr) |
1159 if (reqPacket != tempPtr) |
1166 { |
1160 { |
1167 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMSMARTCARDEAP_SIMSETAUTHENTICATEDATAFORPHASE1_4, "ERR challenge request does not match config [currentChallenge=%d]", iCurrentChallenge); |
1161 LOGPHONE2("ERR challenge request does not match config [currentChallenge=%d]", iCurrentChallenge); |
1168 ReqCompleted(aTsyReqHandle, KErrCorrupt); |
1162 ReqCompleted(aTsyReqHandle, KErrCorrupt); |
1169 return KErrNone; |
1163 return KErrNone; |
1170 } |
1164 } |
1171 |
1165 |
1172 (*aPhase1Size) = iProcedureData->iChResp[iCurrentChallenge].iResp->Length(); |
1166 (*aPhase1Size) = iProcedureData->iChResp[iCurrentChallenge].iResp->Length(); |
1196 return KErrNone; |
1190 return KErrNone; |
1197 } |
1191 } |
1198 |
1192 |
1199 TInt CSimSmartCardEap::SimSmartCardEapAuthenticationCancel(const TTsyReqHandle aTsyReqHandle) |
1193 TInt CSimSmartCardEap::SimSmartCardEapAuthenticationCancel(const TTsyReqHandle aTsyReqHandle) |
1200 { |
1194 { |
1201 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMSMARTCARDEAP_SIMSMARTCARDEAPAUTHENTICATIONCANCEL_1, "CSimSmartCardEap::SimSmartCardEapAuthenticationCancel called"); |
1195 LOGPHONE1("CSimSmartCardEap::SimSmartCardEapAuthenticationCancel called"); |
1202 ReqCompleted(aTsyReqHandle, KErrCancel); |
1196 ReqCompleted(aTsyReqHandle, KErrCancel); |
1203 return KErrNone; |
1197 return KErrNone; |
1204 } |
1198 } |
1205 |
1199 |
1206 TInt CSimSmartCardEap::SimReleaseEapMethod(const TTsyReqHandle aTsyReqHandle) |
1200 TInt CSimSmartCardEap::SimReleaseEapMethod(const TTsyReqHandle aTsyReqHandle) |
1207 { |
1201 { |
1208 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMSMARTCARDEAP_SIMRELEASEEAPMETHOD_1, "CSimSmartCardEap::SimReleaseEapMethod called"); |
1202 LOGPHONE1("CSimSmartCardEap::SimReleaseEapMethod called"); |
1209 iSSInitialised = EFalse; |
1203 iSSInitialised = EFalse; |
1210 iAccessStatus = RMobileSmartCardEap::EEapMethodAvailable; |
1204 iAccessStatus = RMobileSmartCardEap::EEapMethodAvailable; |
1211 ReqCompleted(aTsyReqHandle, KErrNone); |
1205 ReqCompleted(aTsyReqHandle, KErrNone); |
1212 |
1206 |
1213 SimCompleteNotifyEapMethodAccessStatusChange(); |
1207 SimCompleteNotifyEapMethodAccessStatusChange(); |
1219 return KErrNone; |
1213 return KErrNone; |
1220 } |
1214 } |
1221 |
1215 |
1222 TInt CSimSmartCardEap::SimGetEapMethodAccessStatus(const TTsyReqHandle aTsyReqHandle, RMobileSmartCardEap::TEapMethodAccessStatus* aEapState) |
1216 TInt CSimSmartCardEap::SimGetEapMethodAccessStatus(const TTsyReqHandle aTsyReqHandle, RMobileSmartCardEap::TEapMethodAccessStatus* aEapState) |
1223 { |
1217 { |
1224 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMSMARTCARDEAP_SIMGETEAPMETHODACCESSSTATUS_1, "CSimSmartCardEap::SimGetEapMethodAccessStatus called"); |
1218 LOGPHONE1("CSimSmartCardEap::SimGetEapMethodAccessStatus called"); |
1225 *aEapState = iAccessStatus; |
1219 *aEapState = iAccessStatus; |
1226 ReqCompleted(aTsyReqHandle, KErrNone); |
1220 ReqCompleted(aTsyReqHandle, KErrNone); |
1227 return KErrNone; |
1221 return KErrNone; |
1228 } |
1222 } |
1229 |
1223 |
1230 TInt CSimSmartCardEap::SimNotifyEapMethodAccessStatusChange(const TTsyReqHandle aTsyReqHandle, RMobileSmartCardEap::TEapMethodAccessStatus* aEapState) |
1224 TInt CSimSmartCardEap::SimNotifyEapMethodAccessStatusChange(const TTsyReqHandle aTsyReqHandle, RMobileSmartCardEap::TEapMethodAccessStatus* aEapState) |
1231 { |
1225 { |
1232 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMSMARTCARDEAP_SIMNOTIFYEAPMETHODACCESSSTATUSCHANGE_1, "CSimSmartCardEap::SimNotifyEapMethodAccessStatusChange called"); |
1226 LOGPHONE1("CSimSmartCardEap::SimNotifyEapMethodAccessStatusChange called"); |
1233 __ASSERT_ALWAYS(!iEapAccessNotifyData.iNotifyPending, PanicClient(EEtelPanicRequestAsyncTwice)); |
1227 __ASSERT_ALWAYS(!iEapAccessNotifyData.iNotifyPending, PanicClient(EEtelPanicRequestAsyncTwice)); |
1234 |
1228 |
1235 iEapAccessNotifyData.iNotifyPending = ETrue; |
1229 iEapAccessNotifyData.iNotifyPending = ETrue; |
1236 iEapAccessNotifyData.iNotifyHandle = aTsyReqHandle; |
1230 iEapAccessNotifyData.iNotifyHandle = aTsyReqHandle; |
1237 iEapAccessNotifyData.iNotifyData = aEapState; |
1231 iEapAccessNotifyData.iNotifyData = aEapState; |