2869 } |
2832 } |
2870 |
2833 |
2871 // ----------------------------------------------------------------------------- |
2834 // ----------------------------------------------------------------------------- |
2872 // CMmCustomMessHandler::GssCsServiceResp |
2835 // CMmCustomMessHandler::GssCsServiceResp |
2873 // Breaks a GSS_CS_SERVICE_RESP ISI message. |
2836 // Breaks a GSS_CS_SERVICE_RESP ISI message. |
2874 // completes ECustomSetSystemNetworkModeIPC, ECustomSetBandSelectionIPC or |
2837 // completes ECustomSetSystemNetworkModeIPC, |
|
2838 // ECustomGetCurrentSystemNetworkModesIPC, ECustomSetBandSelectionIPC or |
2875 // ECustomGetBandSelectionIPC with KErrNone to SOS layer. |
2839 // ECustomGetBandSelectionIPC with KErrNone to SOS layer. |
2876 // (other items were commented in a header). |
2840 // (other items were commented in a header). |
2877 // ----------------------------------------------------------------------------- |
2841 // ----------------------------------------------------------------------------- |
2878 // |
2842 // |
2879 void CMmCustomMessHandler::GssCsServiceResp ( |
2843 void CMmCustomMessHandler::GssCsServiceResp ( |
2880 const TIsiReceiveC& aIsiMessage ) // Received isi message |
2844 const TIsiReceiveC& aIsiMessage ) // Received isi message |
2881 { |
2845 { |
2882 TFLOGSTRING( "TSY: CMmCustomMessHandler::GssCsServiceResp" ); |
2846 TFLOGSTRING( "TSY: CMmCustomMessHandler::GssCsServiceResp" ); |
2883 OstTrace0( TRACE_NORMAL, CMMCUSTOMMESSHANDLER_GSSCSSERVICERESP, "CMmCustomMessHandler::GssCsServiceResp" ); |
2847 OstTrace0( TRACE_NORMAL, CMMCUSTOMMESSHANDLER_GSSCSSERVICERESP, "CMmCustomMessHandler::GssCsServiceResp" ); |
2884 |
2848 |
2885 TUint8 transactId ( aIsiMessage.Get8bit( |
2849 TUint8 transactId ( aIsiMessage.Get8bit( |
2886 ISI_HEADER_SIZE + GSS_CS_SERVICE_RESP_OFFSET_TRANSID ) ); |
2850 ISI_HEADER_SIZE + GSS_CS_SERVICE_RESP_OFFSET_TRANSID ) ); |
2887 |
2851 |
2888 TUint8 operation ( aIsiMessage.Get8bit( |
2852 if ( KCustomTransId == transactId ) |
2889 ISI_HEADER_SIZE + GSS_CS_SERVICE_RESP_OFFSET_OPERATION ) ); |
2853 { |
2890 |
2854 TUint8 operation ( aIsiMessage.Get8bit( |
2891 // GSS_SELECTED_RAT_WRITE (0x0E) |
2855 ISI_HEADER_SIZE + GSS_CS_SERVICE_RESP_OFFSET_OPERATION ) ); |
2892 if ( KCustomTransId == transactId && GSS_SELECTED_RAT_WRITE == operation ) |
2856 |
2893 { |
2857 // GSS_SELECTED_RAT_WRITE (0x0E) |
2894 //completion ResetGssServer method (no packed parameters) |
2858 if ( GSS_SELECTED_RAT_WRITE == operation ) |
2895 TFLOGSTRING("TSY: CMmCustomMessHandler::GssCsServiceResp - Complete ECustomSetSystemNetworkModeIPC"); |
2859 { |
|
2860 TFLOGSTRING("TSY: CMmCustomMessHandler::GssCsServiceResp - Complete ECustomSetSystemNetworkModeIPC"); |
2896 OstTrace0( TRACE_NORMAL, DUP1_CMMCUSTOMMESSHANDLER_GSSCSSERVICERESP, "CMmCustomMessHandler::GssCsServiceResp - Complete ECustomSetSystemNetworkModeIPC" ); |
2861 OstTrace0( TRACE_NORMAL, DUP1_CMMCUSTOMMESSHANDLER_GSSCSSERVICERESP, "CMmCustomMessHandler::GssCsServiceResp - Complete ECustomSetSystemNetworkModeIPC" ); |
2897 iMessageRouter->Complete( ECustomSetSystemNetworkModeIPC, KErrNone ); |
2862 //completion ResetGssServer method (no packed parameters) |
2898 } |
2863 iMessageRouter->Complete( ECustomSetSystemNetworkModeIPC, KErrNone ); |
2899 |
2864 } |
2900 // not suppoted for S60 ver 3.2 |
2865 // GSS_SELECTED_RAT_READ (0x9C) |
|
2866 else if ( GSS_SELECTED_RAT_READ == operation ) |
|
2867 { |
|
2868 TFLOGSTRING("TSY: CMmCustomMessHandler::GssCsServiceResp - Complete ECustomGetCurrentSystemNetworkModesIPC"); |
|
2869 OstTrace0( TRACE_NORMAL, DUP3_CMMCUSTOMMESSHANDLER_GSSCSSERVICERESP, "CMmCustomMessHandler::GssCsServiceResp - Complete ECustomGetCurrentSystemNetworkModesIPC" ); |
|
2870 TInt err( KErrNone ); |
|
2871 TUint32 ratMode ( RMmCustomAPI::KCapsNetworkModeDual ); |
|
2872 TUint subblockOffset( 0 ); |
|
2873 if ( KErrNone == aIsiMessage.FindSubBlockOffsetById( |
|
2874 ISI_HEADER_SIZE + SIZE_GSS_CS_SERVICE_RESP, |
|
2875 GSS_RAT_INFO, |
|
2876 EIsiSubBlockTypeId8Len8, |
|
2877 subblockOffset ) ) |
|
2878 { |
|
2879 TUint8 mode = aIsiMessage.Get8bit( subblockOffset + |
|
2880 GSS_RAT_INFO_OFFSET_FUNCTION ); |
|
2881 switch ( mode ) |
|
2882 { |
|
2883 case GSS_GSM_RAT: |
|
2884 { |
|
2885 ratMode = RMmCustomAPI::KCapsNetworkModeGsm; |
|
2886 break; |
|
2887 } |
|
2888 case GSS_UMTS_RAT: |
|
2889 { |
|
2890 ratMode = RMmCustomAPI::KCapsNetworkModeUmts; |
|
2891 break; |
|
2892 } |
|
2893 case GSS_DUAL_RAT: |
|
2894 { |
|
2895 ratMode = RMmCustomAPI::KCapsNetworkModeDual; |
|
2896 break; |
|
2897 } |
|
2898 default: |
|
2899 { |
|
2900 TFLOGSTRING("TSY: CMmCustomMessHandler::GssCsServiceResp - Unrecognized RAT"); |
|
2901 OstTrace0( TRACE_NORMAL, DUP4_CMMCUSTOMMESSHANDLER_GSSCSSERVICERESP, "CMmCustomMessHandler::GssCsServiceResp - Unrecognized RAT" ); |
|
2902 err = KErrGeneral; |
|
2903 break; |
|
2904 } |
|
2905 } |
|
2906 } |
|
2907 else |
|
2908 { |
|
2909 err = KErrGeneral; |
|
2910 } |
|
2911 CMmDataPackage dataPackage; |
|
2912 dataPackage.PackData( &ratMode ); |
|
2913 //completion ResetNetServer method (packed parameters) |
|
2914 iMessageRouter->Complete( ECustomGetCurrentSystemNetworkModesIPC, |
|
2915 &dataPackage, err ); |
|
2916 } |
|
2917 // not suppoted for S60 ver 3.2 |
2901 #if ( NCP_COMMON_S60_VERSION_SUPPORT != S60_VERSION_32 ) |
2918 #if ( NCP_COMMON_S60_VERSION_SUPPORT != S60_VERSION_32 ) |
2902 |
2919 // GSS_SELECTED_BANDS_WRITE (0x9D) |
2903 // GSS_SELECTED_BANDS_WRITE (0x9D) |
2920 else if ( GSS_SELECTED_BANDS_WRITE == operation ) |
2904 else if ( GSS_SELECTED_BANDS_WRITE == operation ) |
2921 { |
2905 { |
2922 TFLOGSTRING("TSY: CMmCustomMessHandler::GssCsServiceResp - Complete ECustomSetBandSelectionIPC"); |
2906 TFLOGSTRING("TSY: CMmCustomMessHandler::GssCsServiceResp - Complete ECustomSetBandSelectionIPC"); |
|
2907 OstTrace0( TRACE_NORMAL, DUP2_CMMCUSTOMMESSHANDLER_GSSCSSERVICERESP, "CMmCustomMessHandler::GssCsServiceResp - Complete ECustomSetBandSelectionIPC" ); |
2923 OstTrace0( TRACE_NORMAL, DUP2_CMMCUSTOMMESSHANDLER_GSSCSSERVICERESP, "CMmCustomMessHandler::GssCsServiceResp - Complete ECustomSetBandSelectionIPC" ); |
2908 iMessageRouter->Complete( ECustomSetBandSelectionIPC, KErrNone ); |
2924 iMessageRouter->Complete( ECustomSetBandSelectionIPC, KErrNone ); |
2909 } |
2925 } |
2910 // GSS_SELECTED_BANDS_READ (0x9E) |
2926 // GSS_SELECTED_BANDS_READ (0x9E) |
2911 else if ( GSS_SELECTED_BANDS_READ == operation ) |
2927 else if ( GSS_SELECTED_BANDS_READ == operation ) |
2912 { |
2928 { |
2913 CompleteGetBandSelection( aIsiMessage ); |
2929 CompleteGetBandSelection( aIsiMessage ); |
2914 } |
2930 } |
2915 #endif // NCP_COMMON_S60_VERSION_SUPPORT |
2931 #endif // NCP_COMMON_S60_VERSION_SUPPORT |
|
2932 } |
2916 } |
2933 } |
2917 |
2934 |
2918 // ----------------------------------------------------------------------------- |
2935 // ----------------------------------------------------------------------------- |
2919 // CMmCustomMessHandler::GssCsServiceFailResp |
2936 // CMmCustomMessHandler::GssCsServiceFailResp |
2920 // Breaks a GSS_CS_SERVICE_FAIL_RESP ISI message. |
2937 // Breaks a GSS_CS_SERVICE_FAIL_RESP ISI message. |
3114 return iPhoNetSender->Send( PN_GSS, aTransId, GSS_CS_SERVICE_REQ, messageData ); |
3131 return iPhoNetSender->Send( PN_GSS, aTransId, GSS_CS_SERVICE_REQ, messageData ); |
3115 |
3132 |
3116 } |
3133 } |
3117 |
3134 |
3118 // ----------------------------------------------------------------------------- |
3135 // ----------------------------------------------------------------------------- |
|
3136 // CMmCustomMessHandler::GssCsServiceReq |
|
3137 // Constructs GSS_CS_SERVICE_REQ ISI message from input parameters and |
|
3138 // sends it through phonet. |
|
3139 // (other items were commented in a header). |
|
3140 // ----------------------------------------------------------------------------- |
|
3141 // |
|
3142 TInt CMmCustomMessHandler::GssCsServiceReq |
|
3143 ( |
|
3144 TUint8 aTransId //transaction Id |
|
3145 ) |
|
3146 { |
|
3147 TFLOGSTRING( "TSY: CMmCustomMessHandler::GssCsServiceReq" ); |
|
3148 OstTrace0( TRACE_NORMAL, DUP1_CMMCUSTOMMESSHANDLER_GSSCSSERVICEREQ, "CMmCustomMessHandler::GssCsServiceReq" ); |
|
3149 |
|
3150 TBuf8<KTwo> messageData; |
|
3151 |
|
3152 messageData.Append( GSS_SELECTED_RAT_READ ); |
|
3153 messageData.Append( 0 ); // number of subblocks |
|
3154 |
|
3155 // Sending message to phonet |
|
3156 return iPhoNetSender->Send( PN_GSS, aTransId, GSS_CS_SERVICE_REQ, messageData ); |
|
3157 } |
|
3158 |
|
3159 // ----------------------------------------------------------------------------- |
3119 // CMmCustomMessHandler::ExtFuncL |
3160 // CMmCustomMessHandler::ExtFuncL |
3120 // Forwards requests coming from the Symbian OS layer to the |
3161 // Forwards requests coming from the Symbian OS layer to the |
3121 // specific method. |
3162 // specific method. |
3122 // ----------------------------------------------------------------------------- |
3163 // ----------------------------------------------------------------------------- |
3123 // |
3164 // |
3303 RMmCustomAPI::TNetworkModeCaps networkModeCaps; |
3344 RMmCustomAPI::TNetworkModeCaps networkModeCaps; |
3304 aDataPackage->UnPackData( networkModeCaps ); |
3345 aDataPackage->UnPackData( networkModeCaps ); |
3305 ret = GssCsServiceReq( transId, networkModeCaps ); |
3346 ret = GssCsServiceReq( transId, networkModeCaps ); |
3306 break; |
3347 break; |
3307 } |
3348 } |
3308 #ifdef INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING |
|
3309 // Current network modes |
3349 // Current network modes |
3310 // Removed for Bridge camp! |
|
3311 case ECustomGetCurrentSystemNetworkModesIPC: |
3350 case ECustomGetCurrentSystemNetworkModesIPC: |
3312 { |
3351 { |
3313 ret = MtcRatQueryReq( transId ); |
3352 ret = GssCsServiceReq( transId ); |
3314 break; |
3353 break; |
3315 } |
3354 } |
3316 #endif /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */ |
|
3317 |
|
3318 // Get GSM/WCDMA cell info |
3355 // Get GSM/WCDMA cell info |
3319 case ECustomGetCellInfoIPC: |
3356 case ECustomGetCellInfoIPC: |
3320 { |
3357 { |
3321 iECIDInfoRequested = ETrue; |
3358 iECIDInfoRequested = ETrue; |
3322 ret = NetNeighbourCellsReq( transId ); |
3359 ret = NetNeighbourCellsReq( transId ); |
3673 break; |
3711 break; |
3674 } |
3712 } |
3675 } |
3713 } |
3676 return ret; |
3714 return ret; |
3677 } |
3715 } |
3678 |
|
3679 // ----------------------------------------------------------------------------- |
|
3680 // CMmCustomMessHandler::MtcRatQueryReq |
|
3681 // Constructs MTC_RAT_QUERY_REQ ISI message from input parameters and |
|
3682 // sends it through phonet. |
|
3683 // (other items were commented in a header). |
|
3684 // ----------------------------------------------------------------------------- |
|
3685 // |
|
3686 #ifdef INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING |
|
3687 // Removed for Bridge camp |
|
3688 TInt CMmCustomMessHandler::MtcRatQueryReq |
|
3689 ( |
|
3690 TUint8 aTransId //transaction Id |
|
3691 ) |
|
3692 { |
|
3693 TFLOGSTRING("TSY: CMmCustomMessHandler::MtcRatQueryReq.\n" ); |
|
3694 OstTrace0( TRACE_NORMAL, CMMCUSTOMMESSHANDLER_MTCRATQUERYREQ, "CMmCustomMessHandler::MtcRatQueryReq" ); |
|
3695 |
|
3696 TBuf8<KTwo> messageData; |
|
3697 |
|
3698 //append padding bytes |
|
3699 messageData.Append( 0 ); |
|
3700 messageData.Append( 0 ); |
|
3701 |
|
3702 // Sending message to phonet |
|
3703 return iPhoNetSender->Send( PN_MTC, aTransId, MTC_RAT_QUERY_REQ, messageData ); |
|
3704 } |
|
3705 |
|
3706 // ----------------------------------------------------------------------------- |
|
3707 // CMmCustomMessHandler::MtcRatQueryResp |
|
3708 // Breaks a MTC_RAT_QUERY_RESP ISI message. |
|
3709 // This method get the ratMode and complete the request with error value |
|
3710 // to SOS layer. |
|
3711 // (other items were commented in a header). |
|
3712 // ----------------------------------------------------------------------------- |
|
3713 // |
|
3714 // Removed for Bridge camp |
|
3715 void CMmCustomMessHandler::MtcRatQueryResp |
|
3716 ( |
|
3717 const TIsiReceiveC& aIsiMessage // Received isi message |
|
3718 ) |
|
3719 { |
|
3720 TInt ret ( KErrNone ); |
|
3721 |
|
3722 TUint32 ratMode ( RMmCustomAPI::KCapsNetworkModeDual ); |
|
3723 TUint8 mode = aIsiMessage.Get8bit( ISI_HEADER_SIZE + MTC_RAT_QUERY_RESP_OFFSET_RAT ); |
|
3724 |
|
3725 TFLOGSTRING3("TSY: CMmCustomMessHandler::MtcRatQueryResp. RatMode:%d, mode:%d", ratMode, mode); |
|
3726 OstTraceExt2( TRACE_NORMAL, CMMCUSTOMMESSHANDLER_MTCRATQUERYRESP, "CMmCustomMessHandler::MtcRatQueryResp;mode=%hhu;ratMode=%u", mode, ratMode ); |
|
3727 |
|
3728 switch ( mode ) |
|
3729 { |
|
3730 case MTC_GSM_RAT: |
|
3731 { |
|
3732 ratMode = RMmCustomAPI::KCapsNetworkModeGsm; |
|
3733 break; |
|
3734 } |
|
3735 case MTC_UMTS_RAT: |
|
3736 { |
|
3737 ratMode = RMmCustomAPI::KCapsNetworkModeUmts; |
|
3738 break; |
|
3739 } |
|
3740 case MTC_NO_RAT_SELECTION: //this means dual mode |
|
3741 { |
|
3742 //value already initalized to dual |
|
3743 break; |
|
3744 } |
|
3745 default: // MTC_UNKNOWN_RAT |
|
3746 { |
|
3747 TFLOGSTRING("TSY: CMmCustomMessHandler::MtcRatQueryResp, switch mode - default.\n" ); |
|
3748 OstTrace0( TRACE_NORMAL, DUP1_CMMCUSTOMMESSHANDLER_MTCRATQUERYRESP, "CMmCustomMessHandler::MtcRatQueryResp, switch mode - default" ); |
|
3749 ret = KErrGeneral; |
|
3750 break; |
|
3751 } |
|
3752 } |
|
3753 |
|
3754 CMmDataPackage dataPackage; |
|
3755 dataPackage.PackData( &ratMode ); |
|
3756 |
|
3757 //completion ResetNetServer method (packed parameters) |
|
3758 iMessageRouter->Complete( ECustomGetCurrentSystemNetworkModesIPC, |
|
3759 &dataPackage, ret ); |
|
3760 |
|
3761 } |
|
3762 #endif /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */ |
|
3763 |
3716 |
3764 // ----------------------------------------------------------------------------- |
3717 // ----------------------------------------------------------------------------- |
3765 // CMmCustomMessHandler::UiccReadViagHomeZoneParametersReq |
3718 // CMmCustomMessHandler::UiccReadViagHomeZoneParametersReq |
3766 // Read home zone parameters from UICC |
3719 // Read home zone parameters from UICC |
3767 // ----------------------------------------------------------------------------- |
3720 // ----------------------------------------------------------------------------- |
6022 apduSendNeeded = ETrue; |
5975 apduSendNeeded = ETrue; |
6023 } |
5976 } |
6024 else if( UICC_CARD_TYPE_UICC == cardType ) |
5977 else if( UICC_CARD_TYPE_UICC == cardType ) |
6025 { |
5978 { |
6026 // In 3G we need to send command AUTHENTICATE to the UICC |
5979 // In 3G we need to send command AUTHENTICATE to the UICC |
6027 UiccCreate3GSecurityContextApdu( |
5980 UiccCreate3GSecurityContextApdu( |
6028 params, |
5981 params, |
6029 eapAka.iRandomParameters, |
5982 eapAka.iRandomParameters, |
6030 eapAka.iAUTN, |
5983 eapAka.iAUTN, |
6031 ETrIdEEapAkaAuthenticate ); |
5984 ETrIdEEapAkaAuthenticate ); |
6032 apduSendNeeded = ETrue; |
5985 apduSendNeeded = ETrue; |
6033 } |
5986 } |
6034 break; |
5987 break; |
6035 } |
5988 } |
6036 case RMmCustomAPI::TSimAuthenticationBase::EGbaBootstrap: |
5989 case RMmCustomAPI::TSimAuthenticationBase::EGbaBootstrap: |
6037 { |
5990 { |
6038 serviceStatus = iMmUiccMessHandler->GetServiceStatus( KServiceGBA ); |
5991 serviceStatus = iMmUiccMessHandler->GetServiceStatus( KServiceGBA ); |
6039 |
5992 |
6040 if( UICC_CARD_TYPE_UICC == cardType && |
5993 if( UICC_CARD_TYPE_UICC == cardType && |
6041 EFalse != serviceStatus ) |
5994 EFalse != serviceStatus ) |
6042 { |
5995 { |
6043 UiccCreateGBABootstrappingApdu( params, aDataPackage ); |
5996 UiccCreateGBABootstrappingApdu( params, aDataPackage ); |
6044 apduSendNeeded = ETrue; |
5997 apduSendNeeded = ETrue; |
6045 } |
5998 } |
6171 // ----------------------------------------------------------------------------- |
6124 // ----------------------------------------------------------------------------- |
6172 // CMmCustomMessHandler::UiccCreateRunGsmAlgorithmApdu |
6125 // CMmCustomMessHandler::UiccCreateRunGsmAlgorithmApdu |
6173 // Constructs GSM context AUTHENTICATE APDU |
6126 // Constructs GSM context AUTHENTICATE APDU |
6174 // ----------------------------------------------------------------------------- |
6127 // ----------------------------------------------------------------------------- |
6175 // |
6128 // |
6176 void CMmCustomMessHandler::UiccCreateRunGsmAlgorithmApdu( |
6129 void CMmCustomMessHandler::UiccCreateRunGsmAlgorithmApdu( |
6177 TUiccSendApdu& aParams, |
6130 TUiccSendApdu& aParams, |
6178 const TDesC8& aRand, |
6131 const TDesC8& aRand, |
6179 TUiccTrId aTraId ) |
6132 TUiccTrId aTraId ) |
6180 { |
6133 { |
6181 TFLOGSTRING("TSY: CMmCustomMessHandler::UiccCreateRunGsmAlgorithmApdu.\n" ); |
6134 TFLOGSTRING("TSY: CMmCustomMessHandler::UiccCreateRunGsmAlgorithmApdu.\n" ); |
6182 OstTrace0( TRACE_NORMAL, CMMCUSTOMMESSHANDLER_UICCCREATERUNGSMALGORITHMAPDU, "CMmCustomMessHandler::UiccCreateRunGsmAlgorithmApdu" ); |
6135 OstTrace0( TRACE_NORMAL, CMMCUSTOMMESSHANDLER_UICCCREATERUNGSMALGORITHMAPDU, "CMmCustomMessHandler::UiccCreateRunGsmAlgorithmApdu" ); |
6319 // ----------------------------------------------------------------------------- |
6272 // ----------------------------------------------------------------------------- |
6320 // CMmCustomMessHandler::UiccCreateGsmSecurityContextApdu |
6273 // CMmCustomMessHandler::UiccCreateGsmSecurityContextApdu |
6321 // Constructs GSM context AUTHENTICATE APDU |
6274 // Constructs GSM context AUTHENTICATE APDU |
6322 // ----------------------------------------------------------------------------- |
6275 // ----------------------------------------------------------------------------- |
6323 // |
6276 // |
6324 void CMmCustomMessHandler::UiccCreateGsmSecurityContextApdu( |
6277 void CMmCustomMessHandler::UiccCreateGsmSecurityContextApdu( |
6325 TUiccSendApdu& params, |
6278 TUiccSendApdu& params, |
6326 const CMmDataPackage& aDataPackage ) |
6279 const CMmDataPackage& aDataPackage ) |
6327 { |
6280 { |
6328 TFLOGSTRING("TSY: CMmCustomMessHandler::UiccCreateGsmSecurityContextApdu.\n" ); |
6281 TFLOGSTRING("TSY: CMmCustomMessHandler::UiccCreateGsmSecurityContextApdu.\n" ); |
6329 OstTrace0( TRACE_NORMAL, CMMCUSTOMMESSHANDLER_UICCCREATEGSMSECURITYCONTEXTAPDU, "CMmCustomMessHandler::UiccCreateGsmSecurityContextApdu" ); |
6282 OstTrace0( TRACE_NORMAL, CMMCUSTOMMESSHANDLER_UICCCREATEGSMSECURITYCONTEXTAPDU, "CMmCustomMessHandler::UiccCreateGsmSecurityContextApdu" ); |
6330 |
6283 |
6422 // ----------------------------------------------------------------------------- |
6375 // ----------------------------------------------------------------------------- |
6423 // CMmCustomMessHandler::UiccCreate3GSecurityContextApdu |
6376 // CMmCustomMessHandler::UiccCreate3GSecurityContextApdu |
6424 // Constructs 3G security context AUTHENTICATE APDU |
6377 // Constructs 3G security context AUTHENTICATE APDU |
6425 // ----------------------------------------------------------------------------- |
6378 // ----------------------------------------------------------------------------- |
6426 // |
6379 // |
6427 void CMmCustomMessHandler::UiccCreate3GSecurityContextApdu( |
6380 void CMmCustomMessHandler::UiccCreate3GSecurityContextApdu( |
6428 TUiccSendApdu& aParams, |
6381 TUiccSendApdu& aParams, |
6429 const TDesC8& aRand, |
6382 const TDesC8& aRand, |
6430 const TDesC8& aAuth, |
6383 const TDesC8& aAuth, |
6431 TUiccTrId aTraId ) |
6384 TUiccTrId aTraId ) |
6432 { |
6385 { |
6433 TFLOGSTRING("TSY: CMmCustomMessHandler::UiccCreate3GSecurityContextApdu.\n" ); |
6386 TFLOGSTRING("TSY: CMmCustomMessHandler::UiccCreate3GSecurityContextApdu.\n" ); |
6434 OstTrace0( TRACE_NORMAL, CMMCUSTOMMESSHANDLER_UICCCREATE3GSECURITYCONTEXTAPDU, "CMmCustomMessHandler::UiccCreate3GSecurityContextApdu" ); |
6387 OstTrace0( TRACE_NORMAL, CMMCUSTOMMESSHANDLER_UICCCREATE3GSECURITYCONTEXTAPDU, "CMmCustomMessHandler::UiccCreate3GSecurityContextApdu" ); |
6435 |
6388 |
6436 // len of data is sizeof RAND + sizeof AUTN + two length fields |
6389 // len of data is sizeof RAND + sizeof AUTN + two length fields |
6437 // (one for RAND len and one for AUTN len) |
6390 // (one for RAND len and one for AUTN len) |
6438 TUint8 lc( aRand.Size() + aAuth.Size() + 2 ); |
6391 TUint8 lc( aRand.Size() + aAuth.Size() + 2 ); |
6439 |
6392 |
6440 aParams.trId = aTraId; |
6393 aParams.trId = aTraId; |
6441 aParams.apdu.Append( KClaNoSm ); // CLA |
6394 aParams.apdu.Append( KClaNoSm ); // CLA |
6442 aParams.apdu.Append( KEvenInstructionCode ); // INS |
6395 aParams.apdu.Append( KEvenInstructionCode ); // INS |
6443 aParams.apdu.Append( 0 ); // P1 is set to 0 in case of even instruction |
6396 aParams.apdu.Append( 0 ); // P1 is set to 0 in case of even instruction |
6444 aParams.apdu.Append( K3GAuthenticationContext ); // P2 |
6397 aParams.apdu.Append( K3GAuthenticationContext ); // P2 |
6445 aParams.apdu.Append( lc ); // Lc |
6398 aParams.apdu.Append( lc ); // Lc |
6446 aParams.apdu.Append( aRand.Size() ); // len of RAND |
6399 aParams.apdu.Append( aRand.Size() ); // len of RAND |
6447 aParams.apdu.Append( aRand ); // RAND |
6400 aParams.apdu.Append( aRand ); // RAND |
6448 aParams.apdu.Append( aAuth.Size() ); // len of AUTN |
6401 aParams.apdu.Append( aAuth.Size() ); // len of AUTN |
6449 aParams.apdu.Append( aAuth ); // AUTN |
6402 aParams.apdu.Append( aAuth ); // AUTN |
6450 aParams.apdu.Append( KMaximumLenOfDataExpected ); // Le |
6403 aParams.apdu.Append( KMaximumLenOfDataExpected ); // Le |
6613 // CMmCustomMessHandler::UiccCreateGBABootstrappingApdu |
6566 // CMmCustomMessHandler::UiccCreateGBABootstrappingApdu |
6614 // Constructs GBA security context AUTHENTICATE APDU (bootstrapping mode) |
6567 // Constructs GBA security context AUTHENTICATE APDU (bootstrapping mode) |
6615 // ----------------------------------------------------------------------------- |
6568 // ----------------------------------------------------------------------------- |
6616 // |
6569 // |
6617 void CMmCustomMessHandler::UiccCreateGBABootstrappingApdu( |
6570 void CMmCustomMessHandler::UiccCreateGBABootstrappingApdu( |
6618 TUiccSendApdu& aParams, |
6571 TUiccSendApdu& aParams, |
6619 const CMmDataPackage& aDataPackage ) |
6572 const CMmDataPackage& aDataPackage ) |
6620 { |
6573 { |
6621 TFLOGSTRING("TSY: CMmCustomMessHandler::UiccCreateGBABootstrappingApdu.\n" ); |
6574 TFLOGSTRING("TSY: CMmCustomMessHandler::UiccCreateGBABootstrappingApdu.\n" ); |
6622 OstTrace0( TRACE_NORMAL, CMMCUSTOMMESSHANDLER_UICCCREATEGBABOOTSTRAPPINGAPDU, "CMmCustomMessHandler::UiccCreateGBABootstrappingApdu" ); |
6575 OstTrace0( TRACE_NORMAL, CMMCUSTOMMESSHANDLER_UICCCREATEGBABOOTSTRAPPINGAPDU, "CMmCustomMessHandler::UiccCreateGBABootstrappingApdu" ); |
6623 |
6576 |
6624 RMmCustomAPI::TSimAuthenticationGbaBootstrap gbaBootstrap; |
6577 RMmCustomAPI::TSimAuthenticationGbaBootstrap gbaBootstrap; |
6625 aDataPackage.UnPackData( gbaBootstrap ); |
6578 aDataPackage.UnPackData( gbaBootstrap ); |
6626 |
6579 |
6627 // len of data is GBA bootstrapping mode tag (1 byte) + sizeof RAND |
6580 // len of data is GBA bootstrapping mode tag (1 byte) + sizeof RAND |
6628 // + sizeof AUTN + two length fields (one for RAND len and one for AUTN len) |
6581 // + sizeof AUTN + two length fields (one for RAND len and one for AUTN len) |
6629 TUint8 lc( 1 + gbaBootstrap.iRandomParameters.Size() + gbaBootstrap.iAUTN.Size() + 2 ); |
6582 TUint8 lc( 1 + gbaBootstrap.iRandomParameters.Size() + gbaBootstrap.iAUTN.Size() + 2 ); |
6630 |
6583 |
6631 aParams.trId = ETrIdEGbaBootstrap; |
6584 aParams.trId = ETrIdEGbaBootstrap; |
6632 aParams.apdu.Append( KClaNoSm ); // CLA |
6585 aParams.apdu.Append( KClaNoSm ); // CLA |
6633 aParams.apdu.Append( KEvenInstructionCode ); // INS |
6586 aParams.apdu.Append( KEvenInstructionCode ); // INS |
6634 aParams.apdu.Append( 0 ); // P1 is set to 0 in case of even instruction |
6587 aParams.apdu.Append( 0 ); // P1 is set to 0 in case of even instruction |
6635 aParams.apdu.Append( KGBAAuthenticationContext ); // P2 |
6588 aParams.apdu.Append( KGBAAuthenticationContext ); // P2 |
6636 aParams.apdu.Append( lc ); // Lc |
6589 aParams.apdu.Append( lc ); // Lc |
6637 aParams.apdu.Append( KGBABootstappingModeTag ); // GBA bootstrapping mode tag |
6590 aParams.apdu.Append( KGBABootstappingModeTag ); // GBA bootstrapping mode tag |
6638 aParams.apdu.Append( gbaBootstrap.iRandomParameters.Size() ); // len of RAND |
6591 aParams.apdu.Append( gbaBootstrap.iRandomParameters.Size() ); // len of RAND |
6639 aParams.apdu.Append( gbaBootstrap.iRandomParameters ); // RAND |
6592 aParams.apdu.Append( gbaBootstrap.iRandomParameters ); // RAND |
6640 aParams.apdu.Append( gbaBootstrap.iAUTN.Size() ); // len of AUTN |
6593 aParams.apdu.Append( gbaBootstrap.iAUTN.Size() ); // len of AUTN |
6641 aParams.apdu.Append( gbaBootstrap.iAUTN ); // AUTN |
6594 aParams.apdu.Append( gbaBootstrap.iAUTN ); // AUTN |
6642 aParams.apdu.Append( KMaximumLenOfDataExpected ); // Le |
6595 aParams.apdu.Append( KMaximumLenOfDataExpected ); // Le |
6643 } |
6596 } |
6644 |
6597 |
6645 // ----------------------------------------------------------------------------- |
6598 // ----------------------------------------------------------------------------- |
6646 // CMmCustomMessHandler::UiccGBABootstrappingApduResp |
6599 // CMmCustomMessHandler::UiccGBABootstrappingApduResp |
6647 // Handles response APDU for GBA security context AUTHENTICATE APDU |
6600 // Handles response APDU for GBA security context AUTHENTICATE APDU |
6648 // (bootstrapping mode) |
6601 // (bootstrapping mode) |
6649 // ----------------------------------------------------------------------------- |
6602 // ----------------------------------------------------------------------------- |
6650 // |
6603 // |
6651 void CMmCustomMessHandler::UiccGBABootstrappingApduResp( |
6604 void CMmCustomMessHandler::UiccGBABootstrappingApduResp( |
6652 TInt aTraId, |
6605 TInt aTraId, |
6719 TFLOGSTRING2("TSY: CMmCustomMessHandler::UiccGBABootstrappingApduResp: UICC status not ok: 0x%x\n", aStatus ); |
6672 TFLOGSTRING2("TSY: CMmCustomMessHandler::UiccGBABootstrappingApduResp: UICC status not ok: 0x%x\n", aStatus ); |
6720 OstTrace1( TRACE_NORMAL, DUP4_CMMCUSTOMMESSHANDLER_UICCGBABOOTSTRAPPINGAPDURESP, "CMmCustomMessHandler::UiccGBABootstrappingApduResp: UICC status not ok: 0x%x", aStatus ); |
6673 OstTrace1( TRACE_NORMAL, DUP4_CMMCUSTOMMESSHANDLER_UICCGBABOOTSTRAPPINGAPDURESP, "CMmCustomMessHandler::UiccGBABootstrappingApduResp: UICC status not ok: 0x%x", aStatus ); |
6721 ret = KErrMMEtelAuthenticateFailed; |
6674 ret = KErrMMEtelAuthenticateFailed; |
6722 } |
6675 } |
6723 |
6676 |
6724 if( KErrNone == ret || |
6677 if( KErrNone == ret || |
6725 KErrMMEtelSqnVerificationFailed == ret || |
6678 KErrMMEtelSqnVerificationFailed == ret || |
6726 KErrMMEtelMacVerificationFailed == ret ) |
6679 KErrMMEtelMacVerificationFailed == ret ) |
6727 { |
6680 { |
6728 CMmDataPackage dataPackage; |
6681 CMmDataPackage dataPackage; |
6729 dataPackage.PackData( &gbaBootstrap ); |
6682 dataPackage.PackData( &gbaBootstrap ); |
6730 |
6683 |
6731 iMessageRouter->Complete( |
6684 iMessageRouter->Complete( |
6732 ECustomGetSimAuthenticationDataIPC, |
6685 ECustomGetSimAuthenticationDataIPC, |
6733 &dataPackage, |
6686 &dataPackage, |
6734 ret ); |
6687 ret ); |
6735 } |
6688 } |
6736 else |
6689 else |
6737 { |
6690 { |
6738 iMessageRouter->Complete( |
6691 iMessageRouter->Complete( |
6739 ECustomGetSimAuthenticationDataIPC, |
6692 ECustomGetSimAuthenticationDataIPC, |
6783 // File id path |
6736 // File id path |
6784 params.filePath.Append( KMasterFileId >> 8 ); |
6737 params.filePath.Append( KMasterFileId >> 8 ); |
6785 params.filePath.Append( KMasterFileId ); |
6738 params.filePath.Append( KMasterFileId ); |
6786 params.filePath.Append( iMmUiccMessHandler->GetApplicationFileId() ); |
6739 params.filePath.Append( iMmUiccMessHandler->GetApplicationFileId() ); |
6787 |
6740 |
6788 iMmUiccMessHandler->CreateUiccApplCmdReq( params ); |
6741 iMmUiccMessHandler->CreateUiccApplCmdReq( params ); |
6789 } |
6742 } |
6790 |
6743 |
6791 // ----------------------------------------------------------------------------- |
6744 // ----------------------------------------------------------------------------- |
6792 // CMmCustomMessHandler::UiccGBABootstrapReadResp |
6745 // CMmCustomMessHandler::UiccGBABootstrapReadResp |
6793 // Handles response to elementary file EFgba read operation |
6746 // Handles response to elementary file EFgba read operation |
6794 // ----------------------------------------------------------------------------- |
6747 // ----------------------------------------------------------------------------- |
6795 // |
6748 // |
6796 void CMmCustomMessHandler::UiccGBABootstrapReadResp( |
6749 void CMmCustomMessHandler::UiccGBABootstrapReadResp( |
6797 TInt aStatus, |
6750 TInt aStatus, |
6798 const TDesC8& aFileData ) |
6751 const TDesC8& aFileData ) |
6799 { |
6752 { |
6800 TFLOGSTRING("TSY: CMmCustomMessHandler::UiccGBABootstrapReadResp.\n" ); |
6753 TFLOGSTRING("TSY: CMmCustomMessHandler::UiccGBABootstrapReadResp.\n" ); |
6903 // CMmCustomMessHandler::UiccCreateGBABootstrapNafDerivationApdu |
6856 // CMmCustomMessHandler::UiccCreateGBABootstrapNafDerivationApdu |
6904 // Constructs GBA security context AUTHENTICATE APDU (NAF derivation mode) |
6857 // Constructs GBA security context AUTHENTICATE APDU (NAF derivation mode) |
6905 // ----------------------------------------------------------------------------- |
6858 // ----------------------------------------------------------------------------- |
6906 // |
6859 // |
6907 void CMmCustomMessHandler::UiccCreateGBABootstrapNafDerivationApdu( |
6860 void CMmCustomMessHandler::UiccCreateGBABootstrapNafDerivationApdu( |
6908 TUiccSendApdu& aParams, |
6861 TUiccSendApdu& aParams, |
6909 const CMmDataPackage& aDataPackage ) |
6862 const CMmDataPackage& aDataPackage ) |
6910 { |
6863 { |
6911 TFLOGSTRING("TSY: CMmCustomMessHandler::UiccCreateGBABootstrapNafDerivationApdu.\n" ); |
6864 TFLOGSTRING("TSY: CMmCustomMessHandler::UiccCreateGBABootstrapNafDerivationApdu.\n" ); |
6912 OstTrace0( TRACE_NORMAL, CMMCUSTOMMESSHANDLER_UICCCREATEGBABOOTSTRAPNAFDERIVATIONAPDU, "CMmCustomMessHandler::UiccCreateGBABootstrapNafDerivationApdu" ); |
6865 OstTrace0( TRACE_NORMAL, CMMCUSTOMMESSHANDLER_UICCCREATEGBABOOTSTRAPNAFDERIVATIONAPDU, "CMmCustomMessHandler::UiccCreateGBABootstrapNafDerivationApdu" ); |
6913 |
6866 |
6914 RMmCustomAPI::TSimAuthenticationGbaNafDerivation gbaBootstrapNafDerivation; |
6867 RMmCustomAPI::TSimAuthenticationGbaNafDerivation gbaBootstrapNafDerivation; |
6915 aDataPackage.UnPackData( gbaBootstrapNafDerivation ); |
6868 aDataPackage.UnPackData( gbaBootstrapNafDerivation ); |
6916 |
6869 |
6917 // len of data is GBA NAF derivation mode tag (1 byte) + sizeof NAFId |
6870 // len of data is GBA NAF derivation mode tag (1 byte) + sizeof NAFId |
6918 // + sizeof IMPI + two length fields (one for NAFId len and one for IMPI len) |
6871 // + sizeof IMPI + two length fields (one for NAFId len and one for IMPI len) |
6919 TUint8 lc( 1 + |
6872 TUint8 lc( 1 + |
6920 gbaBootstrapNafDerivation.iNafId.Size() + |
6873 gbaBootstrapNafDerivation.iNafId.Size() + |
6921 gbaBootstrapNafDerivation.iImpi.Size() + |
6874 gbaBootstrapNafDerivation.iImpi.Size() + |
6922 2 ); |
6875 2 ); |
6923 |
6876 |
6924 aParams.trId = ETrIdEGbaNafDerivation; |
6877 aParams.trId = ETrIdEGbaNafDerivation; |
6925 aParams.apdu.Append( KClaNoSm ); // CLA |
6878 aParams.apdu.Append( KClaNoSm ); // CLA |
6926 aParams.apdu.Append( KEvenInstructionCode ); // INS |
6879 aParams.apdu.Append( KEvenInstructionCode ); // INS |
6927 aParams.apdu.Append( 0 ); // P1 is set to 0 in case of even instruction |
6880 aParams.apdu.Append( 0 ); // P1 is set to 0 in case of even instruction |
6928 aParams.apdu.Append( KGBAAuthenticationContext ); // P2 |
6881 aParams.apdu.Append( KGBAAuthenticationContext ); // P2 |
6929 aParams.apdu.Append( lc ); // Lc |
6882 aParams.apdu.Append( lc ); // Lc |
6930 aParams.apdu.Append( KGBANAFDerivationModeTag ); // GBA bootstrapping mode tag |
6883 aParams.apdu.Append( KGBANAFDerivationModeTag ); // GBA bootstrapping mode tag |
6931 aParams.apdu.Append( gbaBootstrapNafDerivation.iNafId.Size() ); // len of NAFId |
6884 aParams.apdu.Append( gbaBootstrapNafDerivation.iNafId.Size() ); // len of NAFId |
6932 aParams.apdu.Append( gbaBootstrapNafDerivation.iNafId ); // NAFId |
6885 aParams.apdu.Append( gbaBootstrapNafDerivation.iNafId ); // NAFId |
6933 aParams.apdu.Append( gbaBootstrapNafDerivation.iImpi.Size() ); // len of IMPI |
6886 aParams.apdu.Append( gbaBootstrapNafDerivation.iImpi.Size() ); // len of IMPI |
6934 aParams.apdu.Append( gbaBootstrapNafDerivation.iImpi ); // IMPI |
6887 aParams.apdu.Append( gbaBootstrapNafDerivation.iImpi ); // IMPI |
7021 // CMmCustomMessHandler::UiccCreateMbmsMskUpdateApdu |
6974 // CMmCustomMessHandler::UiccCreateMbmsMskUpdateApdu |
7022 // Constructs MBMS security context AUTHENTICATE APDU (MSK Update Mode) |
6975 // Constructs MBMS security context AUTHENTICATE APDU (MSK Update Mode) |
7023 // ----------------------------------------------------------------------------- |
6976 // ----------------------------------------------------------------------------- |
7024 // |
6977 // |
7025 void CMmCustomMessHandler::UiccCreateMbmsMskUpdateApdu( |
6978 void CMmCustomMessHandler::UiccCreateMbmsMskUpdateApdu( |
7026 TUiccSendApdu& params, |
6979 TUiccSendApdu& params, |
7027 const CMmDataPackage& aDataPackage ) |
6980 const CMmDataPackage& aDataPackage ) |
7028 { |
6981 { |
7029 TFLOGSTRING("TSY: CMmCustomMessHandler::UiccCreateMbmsMskUpdateApdu.\n" ); |
6982 TFLOGSTRING("TSY: CMmCustomMessHandler::UiccCreateMbmsMskUpdateApdu.\n" ); |
7030 OstTrace0( TRACE_NORMAL, CMMCUSTOMMESSHANDLER_UICCCREATEMBMSMSKUPDATEAPDU, "CMmCustomMessHandler::UiccCreateMbmsMskUpdateApdu" ); |
6983 OstTrace0( TRACE_NORMAL, CMMCUSTOMMESSHANDLER_UICCCREATEMBMSMSKUPDATEAPDU, "CMmCustomMessHandler::UiccCreateMbmsMskUpdateApdu" ); |
7031 |
6984 |
7032 // Note. MBMS functionality is not tested in real hardware and in real environmen |
6985 // Note. MBMS functionality is not tested in real hardware and in real environmen |
7033 // because of there is no users for this authentication type. So this is implemented |
6986 // because of there is no users for this authentication type. So this is implemented |
7034 // with the best knowledge at the moment and it can contain some bugs which |
6987 // with the best knowledge at the moment and it can contain some bugs which |
7035 // can be found when this is tested in real environment. |
6988 // can be found when this is tested in real environment. |
7036 |
6989 |
7037 RMmCustomAPI::TSimAuthenticationMgvMskUpdate mskUpdate; |
6990 RMmCustomAPI::TSimAuthenticationMgvMskUpdate mskUpdate; |
7038 aDataPackage.UnPackData( mskUpdate ); |
6991 aDataPackage.UnPackData( mskUpdate ); |
7039 |
6992 |
7045 params.trId = ETrIdEMbmsMskUpdate; |
6998 params.trId = ETrIdEMbmsMskUpdate; |
7046 params.apdu.Append( KClaNoSm ); // CLA |
6999 params.apdu.Append( KClaNoSm ); // CLA |
7047 params.apdu.Append( KOddInstructionCode ); // INS |
7000 params.apdu.Append( KOddInstructionCode ); // INS |
7048 params.apdu.Append( KFirstBlockOfAuthenticationData ); // P1 |
7001 params.apdu.Append( KFirstBlockOfAuthenticationData ); // P1 |
7049 params.apdu.Append( KMBMSAuthenticationContext ); // P2 |
7002 params.apdu.Append( KMBMSAuthenticationContext ); // P2 |
7050 params.apdu.Append( lc ); // Lc |
7003 params.apdu.Append( lc ); // Lc |
7051 params.apdu.Append( KMBMSDataObjectTag ); // MBMS Data object tag |
7004 params.apdu.Append( KMBMSDataObjectTag ); // MBMS Data object tag |
7052 params.apdu.Append( mskUpdate.iMikey.Size() + 1 ); // MBMS data obj len |
7005 params.apdu.Append( mskUpdate.iMikey.Size() + 1 ); // MBMS data obj len |
7053 params.apdu.Append( KMskUpdateMode ); // MBMS Security Context Mode |
7006 params.apdu.Append( KMskUpdateMode ); // MBMS Security Context Mode |
7054 params.apdu.Append( mskUpdate.iMikey ); // Mikey |
7007 params.apdu.Append( mskUpdate.iMikey ); // Mikey |
7055 } |
7008 } |
7056 |
7009 |
7057 |
7010 |
7058 // ----------------------------------------------------------------------------- |
7011 // ----------------------------------------------------------------------------- |
7059 // CMmCustomMessHandler::UiccMbmsMskUpdateApduResp |
7012 // CMmCustomMessHandler::UiccMbmsMskUpdateApduResp |
7060 // Handles response APDU for MBMS security context AUTHENTICATE APDU |
7013 // Handles response APDU for MBMS security context AUTHENTICATE APDU |
7061 // (MSK Update Mode) |
7014 // (MSK Update Mode) |
7062 // ----------------------------------------------------------------------------- |
7015 // ----------------------------------------------------------------------------- |
7063 // |
7016 // |
7064 void CMmCustomMessHandler::UiccMbmsMskUpdateApduResp( |
7017 void CMmCustomMessHandler::UiccMbmsMskUpdateApduResp( |
7065 TInt aStatus, |
7018 TInt aStatus, |
7254 // CMmCustomMessHandler::UiccCreateMbmsMtkGenerationApdu |
7207 // CMmCustomMessHandler::UiccCreateMbmsMtkGenerationApdu |
7255 // Constructs MBMS security context AUTHENTICATE APDU (MTK Generation Mode) |
7208 // Constructs MBMS security context AUTHENTICATE APDU (MTK Generation Mode) |
7256 // ----------------------------------------------------------------------------- |
7209 // ----------------------------------------------------------------------------- |
7257 // |
7210 // |
7258 void CMmCustomMessHandler::UiccCreateMbmsMtkGenerationApdu( |
7211 void CMmCustomMessHandler::UiccCreateMbmsMtkGenerationApdu( |
7259 TUiccSendApdu& params, |
7212 TUiccSendApdu& params, |
7260 const CMmDataPackage& aDataPackage ) |
7213 const CMmDataPackage& aDataPackage ) |
7261 { |
7214 { |
7262 TFLOGSTRING("TSY: CMmCustomMessHandler::UiccCreateMbmsMtkGenerationApdu.\n" ); |
7215 TFLOGSTRING("TSY: CMmCustomMessHandler::UiccCreateMbmsMtkGenerationApdu.\n" ); |
7263 OstTrace0( TRACE_NORMAL, CMMCUSTOMMESSHANDLER_UICCCREATEMBMSMTKGENERATIONAPDU, "CMmCustomMessHandler::UiccCreateMbmsMtkGenerationApdu" ); |
7216 OstTrace0( TRACE_NORMAL, CMMCUSTOMMESSHANDLER_UICCCREATEMBMSMTKGENERATIONAPDU, "CMmCustomMessHandler::UiccCreateMbmsMtkGenerationApdu" ); |
7264 |
7217 |
7265 // Note. MBMS functionality is not tested in real hardware and in real environment |
7218 // Note. MBMS functionality is not tested in real hardware and in real environment |
7266 // because of at the moment there is no users for this authentication type. |
7219 // because of at the moment there is no users for this authentication type. |
7267 // So this is implemented with the best knowledge at the moment and it can contain |
7220 // So this is implemented with the best knowledge at the moment and it can contain |
7268 // some bugs which can be found when this is tested in real environment. |
7221 // some bugs which can be found when this is tested in real environment. |
7269 |
7222 |
7270 RMmCustomAPI::TSimAuthenticationMgvMtkGeneration mtkGen; |
7223 RMmCustomAPI::TSimAuthenticationMgvMtkGeneration mtkGen; |
7271 aDataPackage.UnPackData( mtkGen ); |
7224 aDataPackage.UnPackData( mtkGen ); |
7272 |
7225 |
7278 params.trId = ETrIdEMbmsMtkGeneration; |
7231 params.trId = ETrIdEMbmsMtkGeneration; |
7279 params.apdu.Append( KClaNoSm ); // CLA |
7232 params.apdu.Append( KClaNoSm ); // CLA |
7280 params.apdu.Append( KOddInstructionCode ); // INS |
7233 params.apdu.Append( KOddInstructionCode ); // INS |
7281 params.apdu.Append( KFirstBlockOfAuthenticationData ); // P1 |
7234 params.apdu.Append( KFirstBlockOfAuthenticationData ); // P1 |
7282 params.apdu.Append( KMBMSAuthenticationContext ); // P2 |
7235 params.apdu.Append( KMBMSAuthenticationContext ); // P2 |
7283 params.apdu.Append( lc ); // Lc |
7236 params.apdu.Append( lc ); // Lc |
7284 params.apdu.Append( KMBMSDataObjectTag ); // MBMS Data object tag |
7237 params.apdu.Append( KMBMSDataObjectTag ); // MBMS Data object tag |
7285 params.apdu.Append( mtkGen.iMikey.Size() + 1 ); // MBMS data obj len |
7238 params.apdu.Append( mtkGen.iMikey.Size() + 1 ); // MBMS data obj len |
7286 params.apdu.Append( KMtkGenerationMode ); // MBMS Security Context Mode |
7239 params.apdu.Append( KMtkGenerationMode ); // MBMS Security Context Mode |
7287 params.apdu.Append( mtkGen.iMikey ); // Mikey |
7240 params.apdu.Append( mtkGen.iMikey ); // Mikey |
7288 } |
7241 } |
7289 |
7242 |
7290 |
7243 |
7291 // ----------------------------------------------------------------------------- |
7244 // ----------------------------------------------------------------------------- |
7292 // CMmCustomMessHandler::UiccMbmsMtkGenerationApduResp |
7245 // CMmCustomMessHandler::UiccMbmsMtkGenerationApduResp |
7293 // Handles response APDU for MBMS security context AUTHENTICATE APDU |
7246 // Handles response APDU for MBMS security context AUTHENTICATE APDU |
7294 // (MTK Generation Mode) |
7247 // (MTK Generation Mode) |
7295 // ----------------------------------------------------------------------------- |
7248 // ----------------------------------------------------------------------------- |
7296 // |
7249 // |
7297 void CMmCustomMessHandler::UiccMbmsMtkGenerationApduResp( |
7250 void CMmCustomMessHandler::UiccMbmsMtkGenerationApduResp( |
7298 TInt aStatus, |
7251 TInt aStatus, |
7405 // ----------------------------------------------------------------------------- |
7358 // ----------------------------------------------------------------------------- |
7406 // CMmCustomMessHandler::UiccMtkGenHandleMbmsOperationData |
7359 // CMmCustomMessHandler::UiccMtkGenHandleMbmsOperationData |
7407 // Handles MBMS operation data from MTK Generation authenticate APDU |
7360 // Handles MBMS operation data from MTK Generation authenticate APDU |
7408 // ----------------------------------------------------------------------------- |
7361 // ----------------------------------------------------------------------------- |
7409 // |
7362 // |
7410 void CMmCustomMessHandler::UiccMtkGenHandleMbmsOperationData( |
7363 void CMmCustomMessHandler::UiccMtkGenHandleMbmsOperationData( |
7411 RMmCustomAPI::TSimAuthenticationMgvMtkGeneration& aMtkGen, |
7364 RMmCustomAPI::TSimAuthenticationMgvMtkGeneration& aMtkGen, |
7412 TDesC8& aMbmsData ) |
7365 TDesC8& aMbmsData ) |
7413 { |
7366 { |
7414 TFLOGSTRING("TSY: CMmCustomMessHandler::UiccMtkGenHandleMbmsOperationData.\n" ); |
7367 TFLOGSTRING("TSY: CMmCustomMessHandler::UiccMtkGenHandleMbmsOperationData.\n" ); |
7415 OstTrace0( TRACE_NORMAL, CMMCUSTOMMESSHANDLER_UICCMTKGENHANDLEMBMSOPERATIONDATA, "CMmCustomMessHandler::UiccMtkGenHandleMbmsOperationData" ); |
7368 OstTrace0( TRACE_NORMAL, CMMCUSTOMMESSHANDLER_UICCMTKGENHANDLEMBMSOPERATIONDATA, "CMmCustomMessHandler::UiccMtkGenHandleMbmsOperationData" ); |
7416 |
7369 |
7417 TUint8 index( 0 ); |
7370 TUint8 index( 0 ); |
7418 TUint32 objLen( aMbmsData.Length() ); |
7371 TUint32 objLen( aMbmsData.Length() ); |
7419 |
7372 |
7420 if( KSuccessfullMbmsOperationTag == aMbmsData[index] && |
7373 if( KSuccessfullMbmsOperationTag == aMbmsData[index] && |
7421 1 <= objLen && |
7374 1 <= objLen && |
7422 ( KMaxMbmsSaltLen + 1 ) >= objLen ) // + 1 for 0xDB TLV tag |
7375 ( KMaxMbmsSaltLen + 1 ) >= objLen ) // + 1 for 0xDB TLV tag |
7423 { |
7376 { |
7424 index++; |
7377 index++; |
7425 |
7378 |
7426 // len of SALT is obj len - 1 because of |
7379 // len of SALT is obj len - 1 because of |
7427 // obj data contains 1 byte for |
7380 // obj data contains 1 byte for |
7428 // Successfull Mbms Operation Tag |
7381 // Successfull Mbms Operation Tag |
7429 TUint8 saltLen( objLen - 1 ); |
7382 TUint8 saltLen( objLen - 1 ); |
7430 if( 0 < saltLen ) |
7383 if( 0 < saltLen ) |
7431 { |
7384 { |
7432 aMtkGen.iMtkSalt.Copy( aMbmsData.Mid( index, saltLen ) ); |
7385 aMtkGen.iMtkSalt.Copy( aMbmsData.Mid( index, saltLen ) ); |
7485 // CMmCustomMessHandler::UiccCreateMbmsMskDeletionApdu |
7438 // CMmCustomMessHandler::UiccCreateMbmsMskDeletionApdu |
7486 // Constructs MBMS security context AUTHENTICATE APDU (MSK Deletion Mode) |
7439 // Constructs MBMS security context AUTHENTICATE APDU (MSK Deletion Mode) |
7487 // ----------------------------------------------------------------------------- |
7440 // ----------------------------------------------------------------------------- |
7488 // |
7441 // |
7489 void CMmCustomMessHandler::UiccCreateMbmsMskDeletionApdu( |
7442 void CMmCustomMessHandler::UiccCreateMbmsMskDeletionApdu( |
7490 TUiccSendApdu& params, |
7443 TUiccSendApdu& params, |
7491 const CMmDataPackage& aDataPackage ) |
7444 const CMmDataPackage& aDataPackage ) |
7492 { |
7445 { |
7493 TFLOGSTRING("TSY: CMmCustomMessHandler::UiccCreateMbmsMskDeletionApdu.\n" ); |
7446 TFLOGSTRING("TSY: CMmCustomMessHandler::UiccCreateMbmsMskDeletionApdu.\n" ); |
7494 OstTrace0( TRACE_NORMAL, CMMCUSTOMMESSHANDLER_UICCCREATEMBMSMSKDELETIONAPDU, "CMmCustomMessHandler::UiccCreateMbmsMskDeletionApdu" ); |
7447 OstTrace0( TRACE_NORMAL, CMMCUSTOMMESSHANDLER_UICCCREATEMBMSMSKDELETIONAPDU, "CMmCustomMessHandler::UiccCreateMbmsMskDeletionApdu" ); |
7495 |
7448 |
7496 // Note. MBMS functionality is not tested in real hardware and in real environment |
7449 // Note. MBMS functionality is not tested in real hardware and in real environment |
7497 // because of at the moment there is no users for this authentication type. |
7450 // because of at the moment there is no users for this authentication type. |
7498 // So this is implemented with the best knowledge at the moment and it can contain |
7451 // So this is implemented with the best knowledge at the moment and it can contain |
7499 // some bugs which can be found when this is tested in real environment. |
7452 // some bugs which can be found when this is tested in real environment. |
7500 |
7453 |
7501 RMmCustomAPI::TSimAuthenticationMgvMskDeletion mskDel; |
7454 RMmCustomAPI::TSimAuthenticationMgvMskDeletion mskDel; |
7502 aDataPackage.UnPackData( mskDel ); |
7455 aDataPackage.UnPackData( mskDel ); |
7503 |
7456 |
7504 // len of data is MBMS Data Object tag (1 byte) + |
7457 // len of data is MBMS Data Object tag (1 byte) + |
7505 // MBMS Data Object length (1 byte) + |
7458 // MBMS Data Object length (1 byte) + |
7506 // MBMS Security Context Mode (1 byte) + |
7459 // MBMS Security Context Mode (1 byte) + |
7507 // size of Key Domain Id + size of Key Group Id Part |
7460 // size of Key Domain Id + size of Key Group Id Part |
7508 TUint8 lc( 1 + |
7461 TUint8 lc( 1 + |
7509 1 + |
7462 1 + |
7510 1 + |
7463 1 + |
7511 mskDel.iKeyDomainId.Size() + |
7464 mskDel.iKeyDomainId.Size() + |
7512 mskDel.iKeyGroupIdPart.Size() ); |
7465 mskDel.iKeyGroupIdPart.Size() ); |
7513 |
7466 |
7514 // data size in MBMS Data Object Tag is: |
7467 // data size in MBMS Data Object Tag is: |
7515 // MBMS Security Context Mode (1 byte) + |
7468 // MBMS Security Context Mode (1 byte) + |
7516 // size of Key Domain Id + size of Key Group Id Part |
7469 // size of Key Domain Id + size of Key Group Id Part |
7517 TUint8 dataSize( 1 + |
7470 TUint8 dataSize( 1 + |
7518 mskDel.iKeyDomainId.Size() + |
7471 mskDel.iKeyDomainId.Size() + |
7519 mskDel.iKeyGroupIdPart.Size() ); |
7472 mskDel.iKeyGroupIdPart.Size() ); |
7520 |
7473 |
7521 params.trId = ETrIdEMbmsMskDeletion; |
7474 params.trId = ETrIdEMbmsMskDeletion; |
7522 params.apdu.Append( KClaNoSm ); // CLA |
7475 params.apdu.Append( KClaNoSm ); // CLA |
7523 params.apdu.Append( KOddInstructionCode ); // INS |
7476 params.apdu.Append( KOddInstructionCode ); // INS |
7524 params.apdu.Append( KFirstBlockOfAuthenticationData ); // P1 |
7477 params.apdu.Append( KFirstBlockOfAuthenticationData ); // P1 |
7525 params.apdu.Append( KMBMSAuthenticationContext ); // P2 |
7478 params.apdu.Append( KMBMSAuthenticationContext ); // P2 |
7526 params.apdu.Append( lc ); // Lc |
7479 params.apdu.Append( lc ); // Lc |
7527 params.apdu.Append( KMBMSDataObjectTag ); // MBMS Data object tag |
7480 params.apdu.Append( KMBMSDataObjectTag ); // MBMS Data object tag |
7528 params.apdu.Append( dataSize ); // MBMS data obj len |
7481 params.apdu.Append( dataSize ); // MBMS data obj len |
7529 params.apdu.Append( KMskDeletionMode ); // MBMS Security Context Mode |
7482 params.apdu.Append( KMskDeletionMode ); // MBMS Security Context Mode |
7530 params.apdu.Append( mskDel.iKeyDomainId ); // Key Domain Id |
7483 params.apdu.Append( mskDel.iKeyDomainId ); // Key Domain Id |
7531 params.apdu.Append( mskDel.iKeyGroupIdPart ); // Key Group Id |
7484 params.apdu.Append( mskDel.iKeyGroupIdPart ); // Key Group Id |
7532 } |
7485 } |
7533 |
7486 |
7534 |
7487 |
7535 // ----------------------------------------------------------------------------- |
7488 // ----------------------------------------------------------------------------- |
7536 // CMmCustomMessHandler::UiccMbmsMskDeletionApduResp |
7489 // CMmCustomMessHandler::UiccMbmsMskDeletionApduResp |
7537 // Handles response APDU for MBMS security context AUTHENTICATE APDU |
7490 // Handles response APDU for MBMS security context AUTHENTICATE APDU |
7538 // (MSK Deletion Mode) |
7491 // (MSK Deletion Mode) |
7539 // ----------------------------------------------------------------------------- |
7492 // ----------------------------------------------------------------------------- |
7540 // |
7493 // |
7541 void CMmCustomMessHandler::UiccMbmsMskDeletionApduResp( |
7494 void CMmCustomMessHandler::UiccMbmsMskDeletionApduResp( |
7542 TInt aStatus, |
7495 TInt aStatus, |
7648 params.trId = aTrId; |
7601 params.trId = aTrId; |
7649 params.apdu.Append( KClaNoSm ); // CLA |
7602 params.apdu.Append( KClaNoSm ); // CLA |
7650 params.apdu.Append( KOddInstructionCode ); // INS |
7603 params.apdu.Append( KOddInstructionCode ); // INS |
7651 params.apdu.Append( KFirstBlockOfAuthenticationResponseData ); // P1 |
7604 params.apdu.Append( KFirstBlockOfAuthenticationResponseData ); // P1 |
7652 params.apdu.Append( 0x00 ); // P2 |
7605 params.apdu.Append( 0x00 ); // P2 |
7653 params.apdu.Append( 0x00 ); // Le |
7606 params.apdu.Append( 0x00 ); // Le |
7654 |
7607 |
7655 iMmUiccMessHandler->CreateUiccApplCmdReq( params ); |
7608 iMmUiccMessHandler->CreateUiccApplCmdReq( params ); |
7656 } |
7609 } |
7657 |
7610 |
7658 |
7611 |
7659 // ----------------------------------------------------------------------------- |
7612 // ----------------------------------------------------------------------------- |
7660 // CMmCustomMessHandler::MapSw1Sw2ToAuthenticateResult |
7613 // CMmCustomMessHandler::MapSw1Sw2ToAuthenticateResult |
7661 // Maps sw1 and sw2 from response authenticate apdu to result |
7614 // Maps sw1 and sw2 from response authenticate apdu to result |
7662 // ----------------------------------------------------------------------------- |
7615 // ----------------------------------------------------------------------------- |
7663 // |
7616 // |
7664 TUint8 CMmCustomMessHandler::MapSw1Sw2ToAuthenticateResult( TUint8 sw1, TUint8 sw2 ) |
7617 TUint8 CMmCustomMessHandler::MapSw1Sw2ToAuthenticateResult( TUint8 sw1, TUint8 sw2 ) |
7665 { |
7618 { |
7666 TFLOGSTRING3("TSY: CMmCustomMessHandler::MapSw1Sw2ToAuthenticateResult. sw1: 0x%x sw2: 0x%x\n", sw1, sw2 ); |
7619 TFLOGSTRING3("TSY: CMmCustomMessHandler::MapSw1Sw2ToAuthenticateResult. sw1: 0x%x sw2: 0x%x\n", sw1, sw2 ); |
8007 TFLOGSTRING("TSY: CMmCustomMessHandler::ValidateGBANafDerivationApduResp.\n" ); |
7960 TFLOGSTRING("TSY: CMmCustomMessHandler::ValidateGBANafDerivationApduResp.\n" ); |
8008 OstTrace0( TRACE_NORMAL, CMMCUSTOMMESSHANDLER_VALIDATEGBANAFDERIVATIONAPDURESP, "CMmCustomMessHandler::ValidateGBANafDerivationApduResp" ); |
7961 OstTrace0( TRACE_NORMAL, CMMCUSTOMMESSHANDLER_VALIDATEGBANAFDERIVATIONAPDURESP, "CMmCustomMessHandler::ValidateGBANafDerivationApduResp" ); |
8009 |
7962 |
8010 TUint8 ret = KApduNok; |
7963 TUint8 ret = KApduNok; |
8011 |
7964 |
8012 // Let's calculate total APDU data len in aApdu. Length is |
7965 // Let's calculate total APDU data len in aApdu. Length is |
8013 // decremented by 2 because of aApdu contains also sw1 and sw2 |
7966 // decremented by 2 because of aApdu contains also sw1 and sw2 |
8014 // and these are total 2 bytes long. |
7967 // and these are total 2 bytes long. |
8015 TUint8 apduLen( aApdu.Length() - 2 ); |
7968 TUint8 apduLen( aApdu.Length() - 2 ); |
8016 TUint32 index( 0 ); |
7969 TUint32 index( 0 ); |
8017 TUint8 tag( aApdu[index++] ); |
7970 TUint8 tag( aApdu[index++] ); |
8018 |
7971 |
8019 if( apduLen > 1 ) |
7972 if( apduLen > 1 ) |
8020 { |
7973 { |
8021 if( KSuccessfull3GAuthTag == tag ) |
7974 if( KSuccessfull3GAuthTag == tag ) |
8022 { |
7975 { |
8023 // response apdu contains only parameter Ks Ext NAF |
7976 // response apdu contains only parameter Ks Ext NAF |
8024 // so, let's check that apdu len contains parameter |
7977 // so, let's check that apdu len contains parameter |
8025 // correctly. So apduLen should be len of Ks Ext NAF |
7978 // correctly. So apduLen should be len of Ks Ext NAF |
8026 // + 2 ("Successful GBA operation" field + |
7979 // + 2 ("Successful GBA operation" field + |
8027 // Length of Ks_ext_NAF field) |
7980 // Length of Ks_ext_NAF field) |
8028 if( apduLen == aApdu[index] + 2 ) |
7981 if( apduLen == aApdu[index] + 2 ) |
8029 { |
7982 { |
8030 ret = KApduOk; |
7983 ret = KApduOk; |
8031 } |
7984 } |