diff -r 817c922b90eb -r 3f7c7e6eea8a multimediacommsengine/mmcesrv/mmcemediamanager/src/mcesecuredesstream.cpp --- a/multimediacommsengine/mmcesrv/mmcemediamanager/src/mcesecuredesstream.cpp Thu Aug 19 10:18:22 2010 +0300 +++ b/multimediacommsengine/mmcesrv/mmcemediamanager/src/mcesecuredesstream.cpp Tue Aug 31 15:35:13 2010 +0300 @@ -83,12 +83,12 @@ CMccSecureInterface& aSecureInterface, CMceComMediaStream& aMediaStream ): - iWaitingBinding(EFalse), + iSecureSession(aSecureSession), iSecInf(aSecureInterface), iMediaStream(aMediaStream), iIsSAVP(ETrue), - iRemoteChangeKey(EFalse), + iWaitingBinding(EFalse), iCryptoContextOutId(0), iCryptoContextInId(0), iOldLocalMediaPort(0) @@ -337,11 +337,6 @@ MCEMM_DEBUG(" Set Multiple Client Cryptoto") User::LeaveIfError ( CountCryptoInOffer( aMediaField ) ); Session().iIsSecureSession = !iGnoreSdpMsg ? ETrue : EFalse; - if( iSecureSession.iNatBind ) - { - SetCryptoContextL( ETrue ); - iSecureSession.iNatBind = EFalse; - } } MCEMM_DEBUG("CMceSecureDesStream::DecodeSecureSdpL(), Exit") MSG_IGNORE_RETURN() @@ -382,8 +377,7 @@ } if ( iSecureSession.iLSReadyToBind ) { - SetCryptoContextL( EFalse ); - iRemoteChangeKey = EFalse; + SetCryptoContextL(); } MSG_IGNORE_RETURN() if ( !iCryptoIn.iCryptoSuite.Length() ) @@ -444,10 +438,9 @@ // Sets crypto context to MCC // ----------------------------------------------------------------------------- // -void CMceSecureDesStream::SetCryptoContextL( TBool aAnswer ) +void CMceSecureDesStream::SetCryptoContextL( ) { - MCEMM_DEBUG("SetCryptoContext(), Entry") - TBool bindContext = ETrue; + MCEMM_DEBUG("SetCryptoContext(), Entry") TBool storedIgnoreSdpMsg = EFalse; //Check state first if the crypto has been set if ( !iCryptoIn.iIfCryptoContextIdSet && @@ -462,12 +455,6 @@ CreateCryptoContextL( iCryptoOut ); MCEMM_DEBUG_DVALUE( "iCryptoContextOutId", iCryptoIn.iCryptoContextId ) MCEMM_DEBUG_DVALUE( "iCryptoContextInId", iCryptoOut.iCryptoContextId ) - - if( !aAnswer ) - { - bindContext = EFalse; - MCEMM_DEBUG("delay to bind!"); - } iCryptoOuts->Reset(); @@ -486,7 +473,7 @@ } MCEMM_DEBUG_DVALUE( "Updated iCryptoContextOutId", iCryptoIn.iCryptoContextId ) MCEMM_DEBUG_DVALUE( "Updated iCryptoContextInId", iCryptoOut.iCryptoContextId ) - if ( iSecureSession.iKeyNeedUpdated || iRemoteChangeKey ) + if ( iSecureSession.iKeyNeedUpdated ) { UpdateCryptoContextL( iCryptoIn ); storedIgnoreSdpMsg = iGnoreSdpMsg; @@ -502,7 +489,7 @@ iGnoreSdpMsg = (iCryptoIn.iIfCryptoContextIdSet && iCryptoOut.iIfCryptoContextIdSet ) && !iGnoreSdpMsg ? EFalse : ETrue; - if ( iWaitingBinding && bindContext ) + if ( iWaitingBinding ) { iSecureSession.BindStreamCrypto(); } @@ -857,13 +844,6 @@ } else { - if( iRemoteChangeKey ) - { - MCEMM_DEBUG("Update CryptoIn" ) - TBool tmpSet = iCryptoIn.iIfCryptoContextIdSet; - iCryptoIn.Copy( iCryptoIns->At( 0 ) ); - iCryptoIn.iIfCryptoContextIdSet = tmpSet; - } if(iOldLocalMediaPort != iMediaStream.iLocalMediaPort) { GenerateRandomKeys( iCryptoOut ); @@ -877,8 +857,7 @@ MSG_IGNORE_RETURN() if ( iSecureSession.iLSReadyToBind ) { - SetCryptoContextL( ETrue ); - iRemoteChangeKey = EFalse; + SetCryptoContextL(); } MSG_IGNORE_RETURN() } @@ -1228,14 +1207,13 @@ } TPtrC8 keyInfo = aSecDec.Mid(keyInfoPos, keyInfoLen); - + if ( iSecureSession.iKeyNeedUpdated ) + { - TBool valid = ValidateSecurityDescriptions( keyInfo ); - if ( valid ) - { - iRemoteChangeKey = iCryptoIn.iEncodedKey.Compare( keyInfo ) != 0; - if( iSecureSession.iKeyNeedUpdated || iRemoteChangeKey ) + TBool valid = ValidateSecurityDescriptions( keyInfo ); + if ( valid ) { + // check keyInfo if (iCryptoOut.iEncodedKey.Compare( keyInfo ) == 0) { @@ -1249,11 +1227,11 @@ iCryptoIn.iEncodedKey = keyInfo; StoreKeys(iCryptoIn.iEncodedKey); } - } - else - { - User::Leave( KErrArgument ); - } + else + { + User::Leave( KErrArgument ); + } + } } else { @@ -1308,12 +1286,7 @@ if ( valid ) { - if( !iSecureSession.iKeyNeedUpdated && - iCryptoIn.iEncodedKey.Compare( keyInfo ) != 0 ) - { - MCEMM_DEBUG("Remote change the key"); - iRemoteChangeKey = ETrue; - } + //check keyinfo mki DecodeMKIValueL( aSecDec, EFalse, crypto ); MSG_IGNORE_RETURN()