32 const TInt KNetworkIdLength2 = 2; |
32 const TInt KNetworkIdLength2 = 2; |
33 const TInt KNetworkIdLength3 = 3; |
33 const TInt KNetworkIdLength3 = 3; |
34 const TInt KIntegerConstant4 = 4; |
34 const TInt KIntegerConstant4 = 4; |
35 const TInt KIntegerConstant16 = 16; |
35 const TInt KIntegerConstant16 = 16; |
36 const TInt KIntegerConstant32 = 32; |
36 const TInt KIntegerConstant32 = 32; |
|
37 const TInt KMaximumKcSize = 8; |
37 |
38 |
38 _LIT8( KAT, "@" ); |
39 _LIT8( KAT, "@" ); |
39 _LIT8( KIMSMNC, "ims.mnc" ); |
40 _LIT8( KIMSMNC, "ims.mnc" ); |
40 _LIT8( KIMSMNC0, "ims.mnc0" ); |
41 _LIT8( KIMSMNC0, "ims.mnc0" ); |
41 _LIT8( KBSFMNC, "bsf.mnc" ); |
42 _LIT8( KBSFMNC, "bsf.mnc" ); |
328 GBA_TRACE_DEBUG_NUM(("GetWlanSimAuthenticationData return, status = %d"), status.Int() ); |
329 GBA_TRACE_DEBUG_NUM(("GetWlanSimAuthenticationData return, status = %d"), status.Int() ); |
329 User::LeaveIfError( status.Int() ); |
330 User::LeaveIfError( status.Int() ); |
330 |
331 |
331 GBA_TRACE_DEBUG(("Creating 2G authentication vector KDF(key,\"3gpp-gba-res\",sres)")); |
332 GBA_TRACE_DEBUG(("Creating 2G authentication vector KDF(key,\"3gpp-gba-res\",sres)")); |
332 GBA_TRACE_DEBUG_BINARY(authSIMdata.iSRES); |
333 GBA_TRACE_DEBUG_BINARY(authSIMdata.iSRES); |
|
334 GBA_TRACE_DEBUG_NUM(("SRES size = %d"), authSIMdata.iSRES.Size() ); |
333 GBA_TRACE_DEBUG_BINARY(authSIMdata.iKC); |
335 GBA_TRACE_DEBUG_BINARY(authSIMdata.iKC); |
|
336 GBA_TRACE_DEBUG_NUM(("Kc size = %d"), authSIMdata.iKC.Size() ); |
334 |
337 |
335 TBuf8<KMaxBufferSize> lastSRESKC; |
338 TBuf8<KMaxBufferSize> lastSRESKC; |
336 TBuf8<2*RMmCustomAPI::KMaxKCLength+KAKA_RAND_LENGTH> kc2; |
339 TBuf8< 2*KMaximumKcSize + KAKA_RAND_LENGTH > kc2; |
337 |
340 |
338 // COPYING Kc twice |
341 // COPYING Kc twice |
339 GBA_TRACE_DEBUG(("Copying iKC")); |
342 GBA_TRACE_DEBUG(("Copying iKC")); |
340 for( TInt i=0; i<(RMmCustomAPI::KMaxKCLength) ; i++ ) |
343 for( TInt i=0; i<KMaximumKcSize; i++ ) |
341 { |
344 { |
342 kc2.Append( (TUint8)(authSIMdata.iKC[i]) ); |
345 kc2.Append( (TUint8)(authSIMdata.iKC[i]) ); |
343 } |
346 } |
344 GBA_TRACE_DEBUG(("Copying iKC")); |
347 GBA_TRACE_DEBUG(("Copying iKC")); |
345 for( TInt i=0;i<(RMmCustomAPI::KMaxKCLength);i++ ) |
348 for( TInt i=0; i<KMaximumKcSize; i++ ) |
346 { |
349 { |
347 kc2.Append( (TUint8)(authSIMdata.iKC[i]) ); |
350 kc2.Append( (TUint8)(authSIMdata.iKC[i]) ); |
348 } |
351 } |
349 GBA_TRACE_DEBUG(("appending RAND")); |
352 GBA_TRACE_DEBUG(("appending RAND")); |
350 kc2.Append(aNonce.Ptr(),KAKA_RAND_LENGTH); |
353 kc2.Append(aNonce.Ptr(),KAKA_RAND_LENGTH); |
351 |
354 |
352 GBA_TRACE_DEBUG(("K part")); |
355 GBA_TRACE_DEBUG(("K part")); |
353 GBA_TRACE_DEBUG_BINARY(kc2); |
356 GBA_TRACE_DEBUG_BINARY(kc2); |
354 |
357 GBA_TRACE_DEBUG_NUM(("Key size = %d"), kc2.Size() ); |
355 // appending RAND |
358 // appending RAND |
356 lastSRESKC.Append( 0x01); |
359 lastSRESKC.Append( 0x01); |
357 lastSRESKC.Append(K3GPPGBARES); |
360 lastSRESKC.Append(K3GPPGBARES); |
358 lastSRESKC.Append( 0x00); |
361 lastSRESKC.Append( 0x00); |
359 lastSRESKC.Append( 0x0C); |
362 lastSRESKC.Append( 0x0C); |
801 |
804 |
802 User::WaitForRequest( status ); |
805 User::WaitForRequest( status ); |
803 |
806 |
804 GBA_TRACE_DEBUG_NUM(("QueryCardInterfaceL: GBA_U avail checking is Done, err = %d"), status.Int()); |
807 GBA_TRACE_DEBUG_NUM(("QueryCardInterfaceL: GBA_U avail checking is Done, err = %d"), status.Int()); |
805 |
808 |
806 if ( status.Int() == KErrNotFound ) |
809 if ( status.Int() == KErrNotFound || status.Int() == KErrNotSupported) |
807 { |
810 { |
|
811 //If the GetUSIMServiceSupport API returnS KErrNotSupported,need to force 3G GBA_ME[E3GInterface] |
808 //Not gba-u service available |
812 //Not gba-u service available |
809 GBA_TRACE_DEBUG(("QueryCardInterfaceL: it returns KErrNotFound, No GBA-U ")); |
813 GBA_TRACE_DEBUG(("QueryCardInterfaceL: it returns KErrNotFound, No GBA-U ")); |
810 // set interface as 3g then |
814 // set interface as 3g then |
811 iCardInterface = E3GInterface; |
815 iCardInterface = E3GInterface; |
812 } |
816 } |