# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1270065603 -10800 # Node ID 86979fe66c4cadd8fc37c36da8526013393247ae # Parent 9e9792ae22e37db7a0de9f7ef4dd09728c3e3317 Revision: 201011 Kit: 201013 diff -r 9e9792ae22e3 -r 86979fe66c4c fotaapplication/fotaserver/FotaEngine/SRC/fotaengstream.cpp --- a/fotaapplication/fotaserver/FotaEngine/SRC/fotaengstream.cpp Mon Mar 15 12:43:15 2010 +0200 +++ b/fotaapplication/fotaserver/FotaEngine/SRC/fotaengstream.cpp Wed Mar 31 23:00:03 2010 +0300 @@ -72,7 +72,7 @@ FLOG(_L("TDP2StreamBuf::ResetL() >>" )); // Define write area (chunk) TArea a (EWrite) ; - TInt limitedwritearea(-1); + //TInt limitedwritearea(-1); TInt chunksize = iMyWriteStream->iFotaEngineSession->iChunk.Size(); // TInt writelimit = iMyWriteStream->iWriteLimit; /* 08-nov-06 flexible mem handling overrides this diff -r 9e9792ae22e3 -r 86979fe66c4c fotaapplication/fotaserver/FotaServer/group/fotaserver.mmp --- a/fotaapplication/fotaserver/FotaServer/group/fotaserver.mmp Mon Mar 15 12:43:15 2010 +0200 +++ b/fotaapplication/fotaserver/FotaServer/group/fotaserver.mmp Wed Mar 31 23:00:03 2010 +0300 @@ -117,7 +117,6 @@ LIBRARY fmsclient.lib //FMS Client LIBRARY cmmanager.lib //Connection Manager -LIBRARY devenccommonutils.lib LIBRARY aknnotify.lib // #ifdef _FOTA_DEBUG LIBRARY flogger.lib diff -r 9e9792ae22e3 -r 86979fe66c4c fotaapplication/fotaserver/FotaServer/inc/DevEncController.h --- a/fotaapplication/fotaserver/FotaServer/inc/DevEncController.h Mon Mar 15 12:43:15 2010 +0200 +++ b/fotaapplication/fotaserver/FotaServer/inc/DevEncController.h Wed Mar 31 23:00:03 2010 +0300 @@ -20,15 +20,14 @@ // INCLUDES #include -#include + #include #include "DevEncProgressDlg.h" #define KDevEncUIUid 0x2000259A //Forward declaration class CFotaServer; - - +class CDevEncSessionBase; class CDevEncStarterStarter; class CDevEncProgressObserver; @@ -62,6 +61,10 @@ TBool IsDeviceEncryptionSupportedL(); + void LoadDevEncSessionL(); + + void UnloadDevEncSession(); + void StartDecryptionL(); void StartEncryptionL(); @@ -71,7 +74,9 @@ // Data CFotaServer* iCallback; // parent - CDevEncSession* iEncMemorySession; // Device Encryption engine session + RLibrary iLibrary; + + CDevEncSessionBase* iEncMemorySession; // Device Encryption engine session CDevEncProgressObserver* iDevEncObserver; //Observer for the encryption/decryption operation diff -r 9e9792ae22e3 -r 86979fe66c4c fotaapplication/fotaserver/FotaServer/inc/DevEncProgressObserver.h --- a/fotaapplication/fotaserver/FotaServer/inc/DevEncProgressObserver.h Mon Mar 15 12:43:15 2010 +0200 +++ b/fotaapplication/fotaserver/FotaServer/inc/DevEncProgressObserver.h Wed Mar 31 23:00:03 2010 +0300 @@ -26,7 +26,7 @@ //Forward declarations class CDevEncController; -class CDevEncSession; +class CDevEncSessionBase; class CDevEncProgressDlg; //Constants used in this class @@ -60,7 +60,7 @@ * @return None */ - void StartMonitoringL(CDevEncSession* aSession); + void StartMonitoringL(CDevEncSessionBase* aSession); public: // Functions from base classes @@ -91,7 +91,7 @@ CPeriodic* iPeriodicTimer; //Not owned - CDevEncSession* iEncMemorySession; + CDevEncSessionBase* iEncMemorySession; }; diff -r 9e9792ae22e3 -r 86979fe66c4c fotaapplication/fotaserver/FotaServer/src/DevEncController.cpp --- a/fotaapplication/fotaserver/FotaServer/src/DevEncController.cpp Mon Mar 15 12:43:15 2010 +0200 +++ b/fotaapplication/fotaserver/FotaServer/src/DevEncController.cpp Wed Mar 31 23:00:03 2010 +0300 @@ -15,18 +15,22 @@ * */ +//System Include #include // for RApaLsSession #include // for CApaCommandLine #include #include // for checking DE feature +#include +#include //for device encryption +#include //for device encryption +#include + +//User Include #include "DevEncController.h" #include "FotaServer.h" +#include "DevEncProgressObserver.h" #include "FotaSrvDebug.h" -#include "DevEncSession.h" -#include -#include "DevEncProgressObserver.h" -#include -#include + #define __LEAVE_IF_ERROR(x) if(KErrNone!=x) {FLOG(_L("LEAVE in %s: %d"), __FILE__, __LINE__); User::Leave(x); } // ================= MEMBER FUNCTIONS ======================= @@ -74,11 +78,16 @@ { FLOG(_L("CDevEncController::ConstructL >>")); - if (!IsDeviceEncryptionSupportedL()) + if (IsDeviceEncryptionSupportedL()) { - FLOG(_L("Device doesn't support encryption!!")); + LoadDevEncSessionL(); + } + else + { + FLOG(_L("Device doesn't support encryption!!")); User::Leave(KErrNotSupported); - } + } + FLOG(_L("CDevEncController::ConstructL <<")); } @@ -118,12 +127,7 @@ { FLOG(_L("CDevEncController::~CDevEncController >>")); - if (iEncMemorySession) - { - iEncMemorySession->Close(); - delete iEncMemorySession; - iEncMemorySession = NULL; - } + UnloadDevEncSession(); if (iDevEncObserver) { @@ -134,6 +138,60 @@ FLOG(_L("CDevEncController::~CDevEncController <<")); } +// ---------------------------------------------------------- +// CDevEncController::LoadDevEncSessionL() +// Loads the devenc library +// ---------------------------------------------------------- +// +void CDevEncController::LoadDevEncSessionL() + { + FLOG(_L("CDevEncController::LoadDevEncSessionL >> ")); + + if (!iEncMemorySession) + { + TInt err = iLibrary.Load(KDevEncCommonUtils); + if (err != KErrNone) + { + FLOG(_L("Error in finding the library... %d"), err); + } + else + { + TLibraryFunction entry = iLibrary.Lookup(1); + + if (!entry) + { + FLOG(_L("Error in loading the library...")); + User::Leave(KErrBadLibraryEntryPoint); + } + iEncMemorySession = (CDevEncSessionBase*) entry(); + FLOG(_L("Library is found and loaded successfully...")); + } + } + FLOG(_L("CDevEncController::LoadDevEncSessionL << ")); + } + +// ---------------------------------------------------------- +// CDevEncController::UnloadDevEncSessionL() +// Unloads the devenc library +// ---------------------------------------------------------- +// +void CDevEncController::UnloadDevEncSession() + { + FLOG(_L("CDevEncController::UnloadDevEncSession >> ")); + + if (iEncMemorySession) + { + delete iEncMemorySession; + iEncMemorySession = NULL; + } + + if (iLibrary.Handle()) + { + iLibrary.Close(); + } + FLOG(_L("CDevEncController::UnloadDevEncSession << ")); + } + TBool CDevEncController::NeedToDecryptL(const TDriveNumber &aDrive) { FLOG(_L("CDevEncController::NeedToDecryptL, drive = %d >>"), (TInt) aDrive); @@ -152,8 +210,7 @@ User::Leave(KErrNotReady); } - if (!iEncMemorySession) - iEncMemorySession = new (ELeave) CDevEncSession( aDrive ); + iEncMemorySession->SetDrive( aDrive); err = iEncMemorySession->Connect(); if (err != KErrNone) @@ -181,8 +238,7 @@ #endif iEncMemorySession->Close(); - delete iEncMemorySession; iEncMemorySession = NULL; - + FLOG(_L("CDevEncController::NeedToDecrypt, ret = %d <<"), ret); return ret; } @@ -217,9 +273,8 @@ TInt status (KErrNone); - if (!iEncMemorySession) - iEncMemorySession = new (ELeave) CDevEncSession( iStorageDrive ); - + iEncMemorySession->SetDrive ( iStorageDrive ); + __LEAVE_IF_ERROR(iEncMemorySession->Connect()); __LEAVE_IF_ERROR(iEncMemorySession->DiskStatus(status)); @@ -247,7 +302,6 @@ iDevEncOperation = EIdle; iEncMemorySession->Close(); - delete iEncMemorySession; iEncMemorySession = NULL; iCallback->HandleDecryptionCompleteL(KErrBadPower, EBatteryLevelLevel4); } @@ -258,7 +312,6 @@ iDevEncOperation = EIdle; iEncMemorySession->Close(); - delete iEncMemorySession; iEncMemorySession = NULL; iCallback->HandleDecryptionCompleteL(KErrNone); } @@ -269,7 +322,6 @@ iDevEncOperation = EIdle; iEncMemorySession->Close(); - delete iEncMemorySession; iEncMemorySession = NULL; iCallback->HandleDecryptionCompleteL(KErrNotReady); } @@ -286,7 +338,6 @@ if (iEncMemorySession) { iEncMemorySession->Close(); - delete iEncMemorySession; iEncMemorySession = NULL; } CRepository *centrep = CRepository::NewL( KCRUidFotaServer ); @@ -366,8 +417,7 @@ TInt status (KErrNone); - if (!iEncMemorySession) - iEncMemorySession = new (ELeave) CDevEncSession( iStorageDrive ); + iEncMemorySession->SetDrive( iStorageDrive ); __LEAVE_IF_ERROR(iEncMemorySession->Connect()); @@ -396,7 +446,6 @@ iDevEncOperation = EIdle; iEncMemorySession->Close(); - delete iEncMemorySession; iEncMemorySession = NULL; iCallback->HandleEncryptionCompleteL(KErrBadPower); } @@ -407,7 +456,6 @@ iDevEncOperation = EIdle; iEncMemorySession->Close(); - delete iEncMemorySession; iEncMemorySession = NULL; iCallback->HandleEncryptionCompleteL(KErrNone); } @@ -418,7 +466,6 @@ iDevEncOperation = EIdle; iEncMemorySession->Close(); - delete iEncMemorySession; iEncMemorySession = NULL; iCallback->HandleEncryptionCompleteL(KErrNotReady); } diff -r 9e9792ae22e3 -r 86979fe66c4c fotaapplication/fotaserver/FotaServer/src/DevEncProgressObserver.cpp --- a/fotaapplication/fotaserver/FotaServer/src/DevEncProgressObserver.cpp Mon Mar 15 12:43:15 2010 +0200 +++ b/fotaapplication/fotaserver/FotaServer/src/DevEncProgressObserver.cpp Wed Mar 31 23:00:03 2010 +0300 @@ -18,7 +18,7 @@ // INCLUDE FILES - +#include //User Includes #include "DevEncProgressObserver.h" @@ -131,7 +131,7 @@ // This method don't leave // ----------------------------------------------------------------------------- -void CDevEncProgressObserver::StartMonitoringL(CDevEncSession* aSession) +void CDevEncProgressObserver::StartMonitoringL(CDevEncSessionBase* aSession) { FLOG(_L("CDevEncProgressObserver::StartMonitoringL >>")); diff -r 9e9792ae22e3 -r 86979fe66c4c package_definition.xml --- a/package_definition.xml Mon Mar 15 12:43:15 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,185 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 9e9792ae22e3 -r 86979fe66c4c remotemgmt_plat/scp_server_api/inc/SCPServerInterface.h --- a/remotemgmt_plat/scp_server_api/inc/SCPServerInterface.h Mon Mar 15 12:43:15 2010 +0200 +++ b/remotemgmt_plat/scp_server_api/inc/SCPServerInterface.h Wed Mar 31 23:00:03 2010 +0300 @@ -27,6 +27,8 @@ typedef TBuf<8> TSCPSecCode; const TInt KSCPMaxEnhCodeLen = 256; +// New DataType to store encrypted information of maximum size 128. +typedef TBuf<128> TSCPCryptoCode; // LOCAL CONSTANTS _LIT( KSCPServerName, "!SCPServer" ); diff -r 9e9792ae22e3 -r 86979fe66c4c remotemgmt_plat/syncml_ds_customization_api/group/bld.inf --- a/remotemgmt_plat/syncml_ds_customization_api/group/bld.inf Mon Mar 15 12:43:15 2010 +0200 +++ b/remotemgmt_plat/syncml_ds_customization_api/group/bld.inf Wed Mar 31 23:00:03 2010 +0300 @@ -23,4 +23,4 @@ PRJ_EXPORTS -..\inc\NsmlOperatorDataCRKeys.h MW_LAYER_PLATFORM_EXPORT_PATH(NsmlOperatorDataCRKeys.h) \ No newline at end of file +../inc/NSmlOperatorDataCRKeys.h MW_LAYER_PLATFORM_EXPORT_PATH(NsmlOperatorDataCRKeys.h) \ No newline at end of file diff -r 9e9792ae22e3 -r 86979fe66c4c remotemgmt_plat/syncml_ds_error_reporting_api/group/bld.inf --- a/remotemgmt_plat/syncml_ds_error_reporting_api/group/bld.inf Mon Mar 15 12:43:15 2010 +0200 +++ b/remotemgmt_plat/syncml_ds_error_reporting_api/group/bld.inf Wed Mar 31 23:00:03 2010 +0300 @@ -23,4 +23,4 @@ PRJ_EXPORTS -..\inc\NsmlOperatorErrorCRKeys.h MW_LAYER_PLATFORM_EXPORT_PATH(NsmlOperatorErrorCRKeys.h) \ No newline at end of file +../inc/NSmlOperatorErrorCRKeys.h MW_LAYER_PLATFORM_EXPORT_PATH(NsmlOperatorErrorCRKeys.h) \ No newline at end of file diff -r 9e9792ae22e3 -r 86979fe66c4c remotemgmt_plat/terminal_security_device_lock_api/group/bld.inf --- a/remotemgmt_plat/terminal_security_device_lock_api/group/bld.inf Mon Mar 15 12:43:15 2010 +0200 +++ b/remotemgmt_plat/terminal_security_device_lock_api/group/bld.inf Wed Mar 31 23:00:03 2010 +0300 @@ -29,3 +29,6 @@ ../inc/TerminalControl3rdPartyParamsPlugin.h MW_LAYER_PLATFORM_EXPORT_PATH(TerminalControl3rdPartyParamsPlugin.h) ../inc/TerminalControl3rdPartyParamsPluginDef.h MW_LAYER_PLATFORM_EXPORT_PATH(TerminalControl3rdPartyParamsPluginDef.h) ../inc/TerminalControl3rdPartyParamsPlugin.inl MW_LAYER_PLATFORM_EXPORT_PATH(TerminalControl3rdPartyParamsPlugin.inl) +../inc/dmencryptionutilinterface.h MW_LAYER_PLATFORM_EXPORT_PATH(dmencryptionutilinterface.h) +../inc/dmencryptionutil.h MW_LAYER_PLATFORM_EXPORT_PATH(dmencryptionutil.h) +../inc/dmencryptionutil.inl MW_LAYER_PLATFORM_EXPORT_PATH(dmencryptionutil.inl) diff -r 9e9792ae22e3 -r 86979fe66c4c remotemgmt_plat/terminal_security_device_lock_api/inc/dmencryptionutil.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/remotemgmt_plat/terminal_security_device_lock_api/inc/dmencryptionutil.h Wed Mar 31 23:00:03 2010 +0300 @@ -0,0 +1,55 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: implementation of MDMEncryptionUtilInterface. +* +*/ + +#ifndef DMENCRYPTIONUTIL_H_ +#define DMENCRYPTIONUTIL_H_ + +#include + +class CDMEncryptionUtil : public CBase, public MDMEncryptionUtilInterface + { +public: + // Instantiates an object of this type + /** + * Create instance of CDMEncryptionUtil, this NewL always loads only the secenv hardware encryption plugin. + * @param Nil + * @return Instance of CDMEncryptionUtil + */ + static CDMEncryptionUtil* NewL(); + /** + * Create instance of CDMEncryptionUtil, this NewL always loads the plugin which matches with the default_data. + * @param aData is the value of default_data. + * @return Instance of CDMEncryptionUtil + * Leaves with KErrBadName: if the default_data exists more than 1. + */ + static CDMEncryptionUtil* CDMEncryptionUtil::NewL(const TDesC8& aData); + + /** + * C++ Destructor + */ + virtual ~CDMEncryptionUtil(); + +private: + // Unique instance identifier key + TUid iDtor_ID_Key; + + }; + +#include "dmencryptionutil.inl" + + +#endif /* DMENCRYPTIONUTIL_H_ */ diff -r 9e9792ae22e3 -r 86979fe66c4c remotemgmt_plat/terminal_security_device_lock_api/inc/dmencryptionutil.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/remotemgmt_plat/terminal_security_device_lock_api/inc/dmencryptionutil.inl Wed Mar 31 23:00:03 2010 +0300 @@ -0,0 +1,119 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: dmencryptionutil Encryption/Decryption Interface +* +*/ + + +#include +#include +#include + +/** + * C++ Destructor + */ +// Inline functions +CDMEncryptionUtil::~CDMEncryptionUtil() + { + // Destroy any instance variables and then + // inform the framework that this specific + // instance of the interface has been destroyed. + REComSession::DestroyedImplementation(iDtor_ID_Key); + } + +/** + * Cleans up the ECOM plugin array + * @param aUid , implementation Uid + * @return Instance of CDMEncryptionUtil + */ +void CleanupEComArray(TAny* aArray) + { + (static_cast (aArray))->ResetAndDestroy(); + (static_cast (aArray))->Close(); + } + +/** +* Create instance of CDMEncryptionUtil, this NewL always loads only the secenv hardware encryption plugin. +* @param Nil +* @return Instance of CDMEncryptionUtil +*/ +inline CDMEncryptionUtil* CDMEncryptionUtil::NewL() + { + RImplInfoPtrArray infoArray; + // Note that a special cleanup function is required to reset and destroy + // all items in the array, and then close it. + TCleanupItem cleanup(CleanupEComArray, &infoArray); + CleanupStack::PushL(cleanup); + + //Only ROM plugins are filtered & listed. + TEComResolverParams resolverParams; + _LIT8(KOperationName,"extdmencryptionutil"); + + resolverParams.SetDataType(KOperationName()); + resolverParams.SetWildcardMatch(ETrue); // Allow wildcard matching + TRAPD(terr, REComSession::ListImplementationsL(KDMEncryptionUtilInterfaceUid, resolverParams,KRomOnlyResolverUid, infoArray)); + REComSession::FinalClose(); + if(terr) + { + User::Leave(terr); + } + if(infoArray.Count() > 1) + { + User::Leave(KErrBadName); + } + TUid retUid = infoArray[0]->ImplementationUid(); + CleanupStack::PopAndDestroy(); //cleanup + + TAny* ptr = REComSession::CreateImplementationL( retUid, _FOFF(CDMEncryptionUtil, iDtor_ID_Key)); + CDMEncryptionUtil* self = reinterpret_cast( ptr ); + + return self; + } + +/** +* Create instance of CDMEncryptionUtil, this NewL always loads the plugin which matches with the default_data. +* @param aData default_data +* @return Instance of CDMEncryptionUtil +* Leaves with KErrBadName: if the default_data exists more than 1. +*/ +inline CDMEncryptionUtil* CDMEncryptionUtil::NewL(const TDesC8& aData) + { + RImplInfoPtrArray infoArray; + // Note that a special cleanup function is required to reset and destroy + // all items in the array, and then close it. + TCleanupItem cleanup(CleanupEComArray, &infoArray); + CleanupStack::PushL(cleanup); + + //Only ROM plugins are filtered & listed. + TEComResolverParams resolverParams; + resolverParams.SetDataType(aData); + resolverParams.SetWildcardMatch(ETrue); // Allow wildcard matching + TRAPD(terr, REComSession::ListImplementationsL(KDMEncryptionUtilInterfaceUid, resolverParams,KRomOnlyResolverUid, infoArray)); + REComSession::FinalClose(); + if(terr) + { + User::Leave(terr); + } + if(infoArray.Count() > 1) + { + User::Leave(KErrBadName); + } + TUid retUid = infoArray[0]->ImplementationUid(); + CleanupStack::PopAndDestroy(); //cleanup + + TAny* ptr = REComSession::CreateImplementationL( retUid, _FOFF(CDMEncryptionUtil, iDtor_ID_Key)); + CDMEncryptionUtil* self = reinterpret_cast( ptr ); + + return self; + } \ No newline at end of file diff -r 9e9792ae22e3 -r 86979fe66c4c remotemgmt_plat/terminal_security_device_lock_api/inc/dmencryptionutilinterface.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/remotemgmt_plat/terminal_security_device_lock_api/inc/dmencryptionutilinterface.h Wed Mar 31 23:00:03 2010 +0300 @@ -0,0 +1,66 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: E/D Interface definition +* +*/ + +#ifndef _MDMEncryptionUtilInterface_H__ +#define _MDMEncryptionUtilInterface_H__ + +#include +#include + +// UID of this interface +const TUid KDMEncryptionUtilInterfaceUid = {0x2002C2F4}; + +/** + An CDMEncryptionUtil abstract class being representative of the + concrete class which the client wishes to use. + + It acts as a base, for a real class to provide all the + functionality that a client requires. + It supplies instantiation & destruction by using + the ECom framework, and functional services + by using the methods of the actual class. + */ + + +class MDMEncryptionUtilInterface + { +public: + + // Pure interface methods + // Representative of a method provided on the interface by + // the interface definer. + + /** + * Encrypts the data. + * @param aInput - is the input string which has to be encrypted. + * @param aOutput - the encrypted information is stored parameter. + * @return Return is KErrNone if successful or any System wide error code. + * + */ + virtual TInt EncryptL( TDes& aInput, TDes& aOutput) = 0; + /** + * Decrypts the data. + * @param Input - is the input string which has to be decrypted. + * @param aOutput - the decrypted information is stored in this parameter. + * @return Return is KErrNone if successful or any System wide error code. + */ + virtual TInt DecryptL( TDes& aInput, TDes& aOutput) = 0; + + }; + +#endif // _MDMEncryptionUtilInterface_H_ + diff -r 9e9792ae22e3 -r 86979fe66c4c syncmlfw/common/syncagent/src/NSmlAgentBase.cpp --- a/syncmlfw/common/syncagent/src/NSmlAgentBase.cpp Mon Mar 15 12:43:15 2010 +0200 +++ b/syncmlfw/common/syncagent/src/NSmlAgentBase.cpp Wed Mar 31 23:00:03 2010 +0300 @@ -1690,7 +1690,7 @@ CWbxml2XmlConverter* c = CWbxml2XmlConverter::NewLC(); c->ConvertL( document.Ptr(), document.Length() ); RFs fs; - fs.Connect(); // create connect to fileserver + User::LeaveIfError( fs.Connect() ); // create connect to fileserver CleanupClosePushL( fs ); if( !BaflUtils::FolderExists( fs, _L("C:\\logs\\Sync\\") ) ) { @@ -1770,7 +1770,7 @@ { c->ConvertL( document.Ptr(), document.Length() ); RFs fs; - fs.Connect(); // create connect to fileserver + User::LeaveIfError( fs.Connect() ); // create connect to fileserver CleanupClosePushL( fs ); if( !BaflUtils::FolderExists( fs, _L("C:\\logs\\Sync\\") ) ) { diff -r 9e9792ae22e3 -r 86979fe66c4c syncmlfw/dm/dmnetworkmon/src/DMNetworkMon.cpp --- a/syncmlfw/dm/dmnetworkmon/src/DMNetworkMon.cpp Mon Mar 15 12:43:15 2010 +0200 +++ b/syncmlfw/dm/dmnetworkmon/src/DMNetworkMon.cpp Wed Mar 31 23:00:03 2010 +0300 @@ -498,8 +498,8 @@ static _LIT_SECURITY_POLICY_PASS(KAllowAllPolicy); static _LIT_SECURITY_POLICY_C1(KAllowWriteDeviceDataPolicy, ECapabilityWriteDeviceData); RProperty::Define(KPSUidNSmlSOSServerKey,KNSmlDMSilentJob,RProperty::EInt,KAllowAllPolicy,KAllowWriteDeviceDataPolicy); - TInt r2=RProperty::Set(KPSUidNSmlSOSServerKey,KNSmlDMSilentJob,ESilent); - DBG_FILE_CODE(aError, _S8("CDMNetworkMon::RunError() KNSmlDMSilentJob get error code ")); + TInt r2=RProperty::Set(KPSUidNSmlSOSServerKey,KNSmlDMSilentJob,ESilent); + LOGSTRING2( "CDMNetworkMon::RunError() KNSmlDMSilentJob get error code = %i", r2); TRAPD(err, dmJob.CreateL( iSyncSession, ProfileId, IAPID)); LOGSTRING("DM JOB CREATED END"); if(err!=KErrNone) diff -r 9e9792ae22e3 -r 86979fe66c4c syncmlfw/dm/syncagent/src/nsmldmagent.cpp --- a/syncmlfw/dm/syncagent/src/nsmldmagent.cpp Mon Mar 15 12:43:15 2010 +0200 +++ b/syncmlfw/dm/syncagent/src/nsmldmagent.cpp Wed Mar 31 23:00:03 2010 +0300 @@ -1388,6 +1388,8 @@ return; } CleanupStack::PushL( profile ); + if( iError ) + { if(iError->SyncLogErrorCode() == KErrNone) { RWriteStream& LastSyncStream = profile->LastSyncWriteStreamL(); @@ -1413,6 +1415,7 @@ CleanupStack::PopAndDestroy(); } } + } CNSmlHistoryArray* array = CNSmlHistoryArray::NewL(); CleanupStack::PushL( array ); array->SetOwnerShip( ETrue ); @@ -1835,15 +1838,16 @@ for(TInt i =0; i< count ; i++) { - CNSmlDMAlertItem* iItem = new (ELeave) CNSmlDMAlertItem ; - iItem->iSource = ((*aItemList)[i].iSource)->AllocL(); - iItem->iTarget = ((*aItemList)[i].iTarget)->AllocL(); - iItem->iMetaType = ((*aItemList)[i].iMetaType)->AllocL(); - iItem->iMetaFormat = ((*aItemList)[i].iMetaFormat)->AllocL(); - iItem->iMetaMark = ((*aItemList)[i].iMetaMark)->AllocL(); - iItem->iData = ((*aItemList)[i].iData)->AllocL(); - iDataItem->AppendL(*iItem); - delete iItem; + CNSmlDMAlertItem* tempItem = new (ELeave) CNSmlDMAlertItem ; + CleanupStack::PushL( tempItem ); + tempItem->iSource = ((*aItemList)[i].iSource)->AllocL(); + tempItem->iTarget = ((*aItemList)[i].iTarget)->AllocL(); + tempItem->iMetaType = ((*aItemList)[i].iMetaType)->AllocL(); + tempItem->iMetaFormat = ((*aItemList)[i].iMetaFormat)->AllocL(); + tempItem->iMetaMark = ((*aItemList)[i].iMetaMark)->AllocL(); + tempItem->iData = ((*aItemList)[i].iData)->AllocL(); + iDataItem->AppendL(*tempItem); + CleanupStack::PopAndDestroy( tempItem ); } } diff -r 9e9792ae22e3 -r 86979fe66c4c syncmlfw/dm/treedbclient/src/nsmldmtreedbclient.cpp --- a/syncmlfw/dm/treedbclient/src/nsmldmtreedbclient.cpp Mon Mar 15 12:43:15 2010 +0200 +++ b/syncmlfw/dm/treedbclient/src/nsmldmtreedbclient.cpp Wed Mar 31 23:00:03 2010 +0300 @@ -599,7 +599,10 @@ if( upperURI.Compare(aURI) != 0 ) { iEnforceCheckdone++; - CheckDynamicAclL( upperURI, aCmdType, aMgmtTree ); + if(CheckDynamicAclL( upperURI, aCmdType, aMgmtTree )) + { + _DBG_FILE("RNSmlDMCallbackSession::CheckDynamicAclL() : returns true"); + } } } else diff -r 9e9792ae22e3 -r 86979fe66c4c syncmlfw/ds/hostserver/dshostserverbase/bld/nsmldshostserver.mmp --- a/syncmlfw/ds/hostserver/dshostserverbase/bld/nsmldshostserver.mmp Mon Mar 15 12:43:15 2010 +0200 +++ b/syncmlfw/ds/hostserver/dshostserverbase/bld/nsmldshostserver.mmp Wed Mar 31 23:00:03 2010 +0300 @@ -52,7 +52,7 @@ SOURCE Nsmldsasyncrequesthandler.cpp SOURCE Nsmldsasynccallback.cpp SOURCE NsmldschangedItemsFetcher.cpp -SOURCE nsmldshostsessioncancel.cpp +SOURCE Nsmldshostsessioncancel.cpp LIBRARY euser.lib ecom.lib efsrv.lib edbms.lib estor.lib bafl.lib smlstoreformat.lib LIBRARY nsmldebug.lib smldataprovider.lib nsmldshostclient.lib NSmlAdapterLog.lib diff -r 9e9792ae22e3 -r 86979fe66c4c syncmlfw/ds/hostserver/dshostserverbase/src/Nsmldshostsession.cpp --- a/syncmlfw/ds/hostserver/dshostserverbase/src/Nsmldshostsession.cpp Mon Mar 15 12:43:15 2010 +0200 +++ b/syncmlfw/ds/hostserver/dshostserverbase/src/Nsmldshostsession.cpp Wed Mar 31 23:00:03 2010 +0300 @@ -30,7 +30,7 @@ #include "NSmlAdapterLog.h" #include "nsmldshostconstants.h" #include "Nsmldshostserver.h" -#include "nsmldshostsessioncanceleventhandler.h" +#include "Nsmldshostsessioncanceleventhandler.h" #include "Nsmldshostsessioncancel.h" #include "Nsmldshostsession.h" #include "nsmldsdpinformation.h" diff -r 9e9792ae22e3 -r 86979fe66c4c syncmlfw/ds/hostserver/dshostserverbase/src/Nsmldshostsessioncancel.cpp --- a/syncmlfw/ds/hostserver/dshostserverbase/src/Nsmldshostsessioncancel.cpp Mon Mar 15 12:43:15 2010 +0200 +++ b/syncmlfw/ds/hostserver/dshostserverbase/src/Nsmldshostsessioncancel.cpp Wed Mar 31 23:00:03 2010 +0300 @@ -20,8 +20,8 @@ #include #include #include -#include "nsmldshostsessioncanceleventhandler.h" -#include "nsmldshostsessioncancel.h" +#include "Nsmldshostsessioncanceleventhandler.h" +#include "Nsmldshostsessioncancel.h" // -------------------------------------------------------------------------- // CNSmlHostSessionCancel* CNSmlHostSessionCancel::NewL( MNSmlDsHostSessionCancelEventHandler* aHandler ) // -------------------------------------------------------------------------- diff -r 9e9792ae22e3 -r 86979fe66c4c syncmlfw/ds/provisioningadapter/src/NSmlDsProvisioningAdapter.cpp --- a/syncmlfw/ds/provisioningadapter/src/NSmlDsProvisioningAdapter.cpp Mon Mar 15 12:43:15 2010 +0200 +++ b/syncmlfw/ds/provisioningadapter/src/NSmlDsProvisioningAdapter.cpp Wed Mar 31 23:00:03 2010 +0300 @@ -29,7 +29,7 @@ #include #include #include //For central Repository -#include // KCRUidOperatorDatasyncInternalKeys +#include // KCRUidOperatorDatasyncInternalKeys #include #include diff -r 9e9792ae22e3 -r 86979fe66c4c syncmlfw/ds/settings/src/NSmlDSSettings.cpp --- a/syncmlfw/ds/settings/src/NSmlDSSettings.cpp Mon Mar 15 12:43:15 2010 +0200 +++ b/syncmlfw/ds/settings/src/NSmlDSSettings.cpp Wed Mar 31 23:00:03 2010 +0300 @@ -30,8 +30,8 @@ #include "NSmlProfileContentHandler.h" #include "nsmldsagconstants.h" #include //CRepository -#include // KCRUidOperatorDatasyncInternalKeys -#include // KCRUidOperatorDatasyncErrorKeys +#include // KCRUidOperatorDatasyncInternalKeys +#include // KCRUidOperatorDatasyncErrorKeys _LIT(Kinfile,"z:\\Private\\101F99FB\\VariantData.xml"); const TInt KUrlLength = 256; diff -r 9e9792ae22e3 -r 86979fe66c4c syncmlfw/syncmlnotifier/src/SyncMLFwUpdNotifier.cpp --- a/syncmlfw/syncmlnotifier/src/SyncMLFwUpdNotifier.cpp Mon Mar 15 12:43:15 2010 +0200 +++ b/syncmlfw/syncmlnotifier/src/SyncMLFwUpdNotifier.cpp Wed Mar 31 23:00:03 2010 +0300 @@ -1145,6 +1145,13 @@ stringHolder = StringLoader::LoadLC( R_FOTA_POSTPONE_UPDATE_ONE_DAY, *aIntparam); } + else + { + CleanupStack::PopAndDestroy( aIntparam ); + CleanupStack::PopAndDestroy( aStrArr ); + return retval; + } + CAknInformationNote* infoNote = new (ELeave) CAknInformationNote; infoNote->ExecuteLD( *stringHolder ); diff -r 9e9792ae22e3 -r 86979fe66c4c terminalsecurity/SCP/SCPClient/src/SCPQueryDialog.cpp --- a/terminalsecurity/SCP/SCPClient/src/SCPQueryDialog.cpp Mon Mar 15 12:43:15 2010 +0200 +++ b/terminalsecurity/SCP/SCPClient/src/SCPQueryDialog.cpp Wed Mar 31 23:00:03 2010 +0300 @@ -291,8 +291,8 @@ } else { - DrawableWindow()->SetOrdinalPosition(0,ECoeWinPriorityNormal); // - ButtonGroupContainer().ButtonGroup()->AsControl()->DrawableWindow()->SetOrdinalPosition(0,ECoeWinPriorityNormal); + DrawableWindow()->SetOrdinalPosition(0,ECoeWinPriorityNormal + 1); // + ButtonGroupContainer().ButtonGroup()->AsControl()->DrawableWindow()->SetOrdinalPosition(0,ECoeWinPriorityNormal + 1); } Dprint( (_L("CSCPQueryDialog::PreLayoutDynInitL(): Key sounds") )); diff -r 9e9792ae22e3 -r 86979fe66c4c terminalsecurity/SCP/SCPServer/group/SCPServer.mmp --- a/terminalsecurity/SCP/SCPServer/group/SCPServer.mmp Mon Mar 15 12:43:15 2010 +0200 +++ b/terminalsecurity/SCP/SCPServer/group/SCPServer.mmp Wed Mar 31 23:00:03 2010 +0300 @@ -96,7 +96,6 @@ LIBRARY featmgr.lib LIBRARY estor.lib LIBRARY charconv.lib -LIBRARY devenccommonutils.lib //Device encryption utility SMPSAFE diff -r 9e9792ae22e3 -r 86979fe66c4c terminalsecurity/SCP/SCPServer/inc/SCPConfiguration.h --- a/terminalsecurity/SCP/SCPServer/inc/SCPConfiguration.h Mon Mar 15 12:43:15 2010 +0200 +++ b/terminalsecurity/SCP/SCPServer/inc/SCPConfiguration.h Wed Mar 31 23:00:03 2010 +0300 @@ -29,7 +29,8 @@ enum TSCPParamType { EParTypeInt = 0, - EParTypeDesc + EParTypeDesc, + EParTypeBool }; // LOCAL CONSTANTS @@ -54,6 +55,13 @@ const TInt KParamIDBlockedAtTime = 6; const TInt KParamIDBlockedInOOS = 7; +// ID number for the encrypted security code. +const TInt KParamIDCryptoCode = 8; +//ID number for the boolean for the configuartion check +const TInt KParamIDConfigChecked = 9; + +// Total number of Param IDs +const TInt KTotalParamIDs = 9; //#ifdef __SAP_DEVICE_LOCK_ENHANCEMENTS #define SCP_PARAMETERS_WithFlag { &iConfigFlag, \ @@ -62,7 +70,9 @@ &iEnhSecCode, \ &iFailedAttempts, \ &iBlockedAtTime, \ - &iBlockedInOOS \ + &iBlockedInOOS, \ + &iCryptoCode, \ + &iConfigChecked \ }; #define SCP_PARAMIDS_WithFlag { KParamIDConfigFlag, \ @@ -71,7 +81,9 @@ KParamIDEnhSecCode, \ KParamIDFailedAttempts, \ KParamIDBlockedAtTime, \ - KParamIDBlockedInOOS \ + KParamIDBlockedInOOS, \ + KParamIDCryptoCode, \ + KParamIDConfigChecked \ }; #define SCP_PARAMTYPES_WithFlag { EParTypeInt, \ @@ -80,7 +92,9 @@ EParTypeDesc, \ EParTypeInt, \ EParTypeDesc, \ - EParTypeInt \ + EParTypeInt, \ + EParTypeDesc, \ + EParTypeBool \ }; //#else // !__SAP_DEVICE_LOCK_ENHANCEMENTS @@ -155,6 +169,15 @@ */ void TransformStringL( TBool aEncrypt, TDes& aInput, TDes& aOutput ); + /** + * Function to check for any ECOM plugin implementing the MDMEncryptionUtilInterface exist in ROM only. + * If any plugin is implemented then Encrypts or decrypts the input string in aInput, saving the output in aOutput. + * If the input is not an exact multiple of a DES block, 0-padding is used. The + * output buffer must be large enough to store the output blocks. + * Returns ETrue if plugin is implemented & exists in ROM only. + * EFalse if plugin is not implemented. + */ + TBool NativeTransform(TBool aEncrypt, TDes& aInput, TDes& aOutput); public: // Data /** Configuration valid -flag */ @@ -167,6 +190,9 @@ TFileName iConfigFileName; TInt iBlockedInOOS; + //Flag to check whether Configuration checked already + TBool iConfigChecked; + /** A ptr to a connected RFs, not owned */ RFs* iFsSession; @@ -178,6 +204,8 @@ /** The time since the code has been blocked */ TBuf iBlockedAtTime; //#endif // __SAP_DEVICE_LOCK_ENHANCEMENTS +// Member to hold the encrypted/decrypted security code from Crpto HW encryption algorithm + TSCPCryptoCode iCryptoCode; }; diff -r 9e9792ae22e3 -r 86979fe66c4c terminalsecurity/SCP/SCPServer/src/SCPConfiguration.cpp --- a/terminalsecurity/SCP/SCPServer/src/SCPConfiguration.cpp Mon Mar 15 12:43:15 2010 +0200 +++ b/terminalsecurity/SCP/SCPServer/src/SCPConfiguration.cpp Wed Mar 31 23:00:03 2010 +0300 @@ -27,6 +27,7 @@ #include "SCPServer.h" #include +#include // ================= MEMBER FUNCTIONS ======================= @@ -82,10 +83,9 @@ User::Leave(errf); } TInt result = KErrNone; - - TAny* KParameters[7]; - TInt KParamIDs[7]; - TSCPParamType KSCPParamTypes[7]; + TAny* KParameters[KTotalParamIDs]; + TInt KParamIDs[KTotalParamIDs]; + TSCPParamType KSCPParamTypes[KTotalParamIDs]; TInt KNumParams; @@ -155,6 +155,12 @@ break; } + case ( EParTypeBool ): + { + ret = params->Get( KParamIDs[i], *(reinterpret_cast( KParameters[i] )) ); + break; + } + default: // No implementation needed break; @@ -172,7 +178,22 @@ // Decrypt the ISA security code TSCPSecCode cryptBuf; cryptBuf.Copy( iSecCode ); - TransformStringL( EFalse, cryptBuf, iSecCode ); + Dprint( (_L("--> TSCPConfiguration::ReadSetupL NativeTransform iCryptoCode= %S "), &iCryptoCode )); + if(EFalse == NativeTransform(EFalse, iCryptoCode, iSecCode)) + { + Dprint( (_L("--> TSCPConfiguration::ReadSetupL NativeTransform returned false") )); + // If ECOM decrypt fails after modifying iSecCode. + iSecCode.Copy(cryptBuf); + TransformStringL( EFalse, cryptBuf, iSecCode ); + } + else + { + Dprint( (_L("--> TSCPConfiguration::ReadSetupL NativeTransform returned true") )); + Dprint( (_L("--> TSCPConfiguration::ReadSetupL NativeTransform iCryptoCode= %S "), &iCryptoCode )); + //Dummy code to be written of KSCPCodeMaxLen size, if plugin exist. + // Dprint((_L("iSecCode.Copy(iCryptoCode.Ptr(), KSCPCodeMaxLen);"))); + // iSecCode.Copy(iCryptoCode.Ptr(), KSCPCodeMaxLen); + } iSecCode.SetLength( KSCPCodeMaxLen ); // Remove the suffix FeatureManager::UnInitializeLib(); @@ -200,9 +221,9 @@ - TAny* KParameters[7]; - TInt KParamIDs[7]; - TSCPParamType KSCPParamTypes[7]; + TAny* KParameters[KTotalParamIDs]; + TInt KParamIDs[KTotalParamIDs]; + TSCPParamType KSCPParamTypes[KTotalParamIDs]; TInt KNumParams; @@ -245,8 +266,24 @@ TSCPSecCode cryptBuf; cryptBuf.Copy( iSecCode ); cryptBuf.Append( KSCPCryptSuffix ); // 5 chars for the code + suffix - TransformStringL( ETrue, cryptBuf, iSecCode ); - + if(EFalse == NativeTransform(ETrue, cryptBuf, iCryptoCode)) + { + cryptBuf.FillZ(); + cryptBuf.Zero(); + cryptBuf.Copy( iSecCode ); + cryptBuf.Append( KSCPCryptSuffix ); // 5 chars for the code + suffix + Dprint( (_L("--> TSCPConfiguration::WriteSetupL NativeTransform returned false") )); + TransformStringL( ETrue, cryptBuf, iSecCode ); + + } + else + { + iSecCode.FillZ(); + iSecCode.Zero(); + + Dprint( (_L("--> TSCPConfiguration::WriteSetupL NativeTransform returned true") )); + Dprint( (_L("--> TSCPConfiguration::WriteSetupL NativeTransform iCryptoCode= %S "), &iCryptoCode )); + } TInt ret = KErrNone; for ( TInt i = 0; i < KNumParams; i++ ) { @@ -265,6 +302,12 @@ break; } + case ( EParTypeBool ): + { + ret = params->Set( KParamIDs[i], *(reinterpret_cast( KParameters[i] )) ); + break; + } + default: // No implementation needed break; @@ -397,8 +440,60 @@ aOutput.SetLength( outputData.Length() / 2 ); #endif // UNICODE } +// --------------------------------------------------------- +// TSCPConfiguration::NativeTransform (TBool aEncrypt, TDes& aInput, TDes& aOutput) +// Transforms the given aInput buffer using the plugin Encryption/Decryption, +// and stores the result to aOutput +// +// Status : New +// --------------------------------------------------------- +// +TBool TSCPConfiguration::NativeTransform (TBool aEncrypt, TDes& aInput, TDes& aOutput) +{ + Dprint( (_L("--> TSCPConfiguration::NativeTransform()") )); + TInt err(KErrNone); + TBool result(ETrue); + CDMEncryptionUtil* eUtil; + Dprint( (_L("TSCPConfiguration::NativeTransform(), calling TRAP(err, eUtil = CDMEncryptionUtil::NewL()); ") )); + + TRAP(err, eUtil = CDMEncryptionUtil::NewL()); + Dprint( (_L("TSCPConfiguration::NativeTransform(), after TRAP(err, eUtil = CDMEncryptionUtil::NewL()); err= %d"), err )); + if(err) + { + result = EFalse; + return result; + } + CleanupStack::PushL(eUtil); + if(aEncrypt) + { + Dprint( (_L(" TSCPConfiguration::NativeTransform()Encrypting...") )); + TRAP(err, eUtil->EncryptL( aInput, aOutput)); + Dprint( (_L("TSCPConfiguration::NativeTransform(), after Encrypting err= %d"), err )); + } + else + { + Dprint( (_L(" TSCPConfiguration::NativeTransform()Decrypting...") )); + TRAP(err, eUtil->DecryptL( aInput, aOutput)); + Dprint( (_L("TSCPConfiguration::NativeTransform(), after Decrypting err= %d"), err )); + } + CleanupStack::PopAndDestroy(); //eUtil + if(err) + { + Dprint( (_L(" TSCPConfiguration::NativeTransform() CDMEncryptionUtil::ListImplementationsL failed") )); + result = EFalse; + } + else + { + Dprint( (_L(" TSCPConfiguration::NativeTransform() CDMEncryptionUtil::ListImplementationsL success") )); + result = ETrue; + } + + Dprint( (_L("TSCPConfiguration::NativeTransform(): result = %d"), result )); + Dprint( (_L("<-- TSCPConfiguration::NativeTransform()") )); + return result; +} // End of File diff -r 9e9792ae22e3 -r 86979fe66c4c terminalsecurity/SCP/SCPServer/src/SCPServer.cpp --- a/terminalsecurity/SCP/SCPServer/src/SCPServer.cpp Mon Mar 15 12:43:15 2010 +0200 +++ b/terminalsecurity/SCP/SCPServer/src/SCPServer.cpp Wed Mar 31 23:00:03 2010 +0300 @@ -51,7 +51,7 @@ #include // For Device encryption #include -#include +#include // ==================== LOCAL FUNCTIONS ==================== @@ -114,11 +114,16 @@ // Assign default config flag iConfiguration.iConfigFlag = KSCPConfigUnknown; + iConfiguration.iConfigChecked = EFalse; // Assign the default codes iConfiguration.iSecCode.Zero(); iConfiguration.iSecCode.Append( KSCPDefaultSecCode ); + // Assign the default codes + iConfiguration.iCryptoCode.Zero(); + iConfiguration.iCryptoCode.Append( KSCPDefaultSecCode ); + //#ifdef __SAP_DEVICE_LOCK_ENHANCEMENTS if(FeatureManager::FeatureSupported(KFeatureIdSapDeviceLockEnhancements)) { @@ -164,6 +169,25 @@ { Dprint( (_L("CSCPServer::ConstructL(): Configration read OK") )); } + + + //If Configuration is not validated already, validate it + + if (!iConfiguration.iConfigChecked) + { + TInt valerr = KErrNone; + TRAP( valerr, ValidateConfigurationL( KSCPComplete )); + if (valerr != KErrNone) + { + Dprint( (_L("CSCPServer::ConstructL(): Configuration Validation failed: %d"), valerr )); + } + else + { + Dprint( (_L("CSCPServer::ConstructL(): Configuration Validation Passed"))); + } + } + + Dprint( (_L("CSCPServer::ConstructL(): Connecting to CenRep") )); iALPeriodRep = CRepository::NewL( KCRUidSecuritySettings ); @@ -631,7 +655,21 @@ { Dprint( (_L("--> CSCPServer::ValidateConfigurationL()") )); - if ( iConfiguration.iConfigFlag == KSCPConfigOK ) + RMobilePhone::TMobilePassword storedCode; + storedCode.Zero(); + User::LeaveIfError(GetCode(storedCode)); + + + Dprint( (_L("CSCPServer::ValidateConfigurationL(): Checking code: %s"), storedCode.PtrZ() )); + // Check that the ISA code is stored correctly + TRAPD( err, CheckISACodeL( storedCode ) ); + //Bool for the correction of Defaultlockcode cenrep + TBool lCorrectDefaultlockcode = EFalse; + + Dprint( (_L("CSCPServer::ValidateConfigurationL(): iConfigFlag = %d, iConfigChecked = %d"), iConfiguration.iConfigFlag, iConfiguration.iConfigChecked)); + + if ((iConfiguration.iConfigFlag == KSCPConfigOK) + && (iConfiguration.iConfigChecked) && (err == KErrNone)) { // The configuration has already been checked, exit Dprint( (_L("CSCPServer::ValidateConfigurationL(): Configuration is non-default.") )); @@ -643,10 +681,7 @@ User::Leave( KErrAccessDenied ); } - RMobilePhone::TMobilePassword storedCode; - storedCode.Zero(); - - User::LeaveIfError( GetCode( storedCode ) ); + TInt hashedISAcode; TSCPSecCode hashedCode; //#ifdef __SAP_DEVICE_LOCK_ENHANCEMENTS @@ -659,10 +694,13 @@ } //#endif // __SAP_DEVICE_LOCK_ENHANCEMENTS - Dprint( (_L("CSCPServer::ValidateConfigurationL(): Checking code: %s"), storedCode.PtrZ() )); + - // Check that the ISA code is stored correctly - TRAPD( err, CheckISACodeL( storedCode ) ); + + if (err != KErrNone) + { + lCorrectDefaultlockcode = ETrue; + } if ( err == KErrNone ) { iConfiguration.iConfigFlag = KSCPConfigOK; @@ -710,11 +748,42 @@ if ( StoreCode( hashedCode ) == KErrNone ) { iConfiguration.iConfigFlag = KSCPConfigOK; + lCorrectDefaultlockcode = ETrue; } } } -} + + //If Correction of Defaultlockcode cenrep is required for the mismatch between Config and ISA + if (lCorrectDefaultlockcode) + { + TInt lDefCode = -1; + CRepository* lRepository = CRepository::NewL(KCRUidSCPLockCode); + CleanupStack::PushL(lRepository); + TInt lRet = lRepository->Get(KSCPLockCodeDefaultLockCode, + lDefCode); + if (lRet == KErrNone && lDefCode != -1) + { + if (lDefCode == 12345) + { + //Although lock code is already set, due to some unexpected condition + //like C drive wipe, cenrep status is wrongly shown. Correcting it here. + lRepository->Set(KSCPLockCodeDefaultLockCode, 0); + Dprint( (_L("RSCPClient::ValidateConfigurationL(): Corrected the Default lock code cenrep status to 0") )); + } + else if (lDefCode == 0) + { + //If only ISA side is formatted, then the lock code on ISA side is default; + //Cenrep status remains wrongly as the lock code is already set. Correcting it here. + lRepository->Set(KSCPLockCodeDefaultLockCode, 12345); + Dprint( (_L("RSCPClient::ValidateConfigurationL(): Corrected the Default lock code cenrep status to 12345") )); + } + } + CleanupStack::PopAndDestroy(lRepository); + } + } //#endif // __SAP_DEVICE_LOCK_ENHANCEMENTS + //Set the flag to True, after config is validated + iConfiguration.iConfigChecked = ETrue; TRAPD( err2, iConfiguration.WriteSetupL() ); if ( err2 != KErrNone ) @@ -2475,9 +2544,7 @@ TBool CSCPServer::IsDeviceMemoryEncrypted() { Dprint(_L("CSCPServer::IsDeviceMemoryEncrypted >>")); - TBool ret(EFalse); - //First check if the feature is supported on device TRAPD(ferr, FeatureManager::InitializeLibL()); if (ferr != KErrNone) @@ -2489,42 +2556,74 @@ FeatureManager::UnInitializeLib(); //If feature is supported, check if any drive is encrypted. + + + if (ret) { - CDevEncSession* devEncSession = new CDevEncSession( EDriveC ); + RLibrary library; + CDevEncSessionBase* devEncSession = NULL; + TInt err = library.Load(KDevEncCommonUtils); + if (err != KErrNone) + { + Dprint(_L("Error in finding the library... %d"), err); + ret = EFalse; + } + else + { + TLibraryFunction entry = library.Lookup(1); + + if (!entry) + { + Dprint(_L("Error in loading the library...")); + ret = EFalse; + } + else + { + devEncSession = (CDevEncSessionBase*) entry(); + Dprint(_L("Library is found and loaded successfully...")); + } + } + if (!devEncSession) { Dprint(_L("Can't instantiate device encryption session..")); - return EFalse; - } - - TInt err = devEncSession->Connect(); - if (err == KErrNone) - { - //Session with device encryption is established. Check if any drive is encrypted - TInt encStatus (KErrNone); - TInt err = devEncSession->DiskStatus( encStatus ); - Dprint(_L("err = %d, encstatus = %d"), err, encStatus); - if ( err == KErrNone && encStatus != EDecrypted ) - { - Dprint(_L("Memory is encrypted")); - ret = ETrue; - } - else - { - Dprint(_L("Memory is not encrypted")); - ret = EFalse; - } - } - else - { - Dprint(_L("Error %d while establishing connection with device encryption engine"), err); ret = EFalse; } - - delete devEncSession; devEncSession = NULL; - } + else + { + devEncSession->SetDrive( EDriveC ); + TInt err = devEncSession->Connect(); + if (err == KErrNone) + { + //Session with device encryption is established. Check if any drive is encrypted + TInt encStatus (KErrNone); + TInt err = devEncSession->DiskStatus( encStatus ); + devEncSession->Close(); + Dprint(_L("err = %d, encstatus = %d"), err, encStatus); + if ( err == KErrNone && encStatus != EDecrypted ) + { + Dprint(_L("Memory is encrypted")); + ret = ETrue; + } + else + { + Dprint(_L("Memory is not encrypted")); + ret = EFalse; + } + } + else + { + Dprint(_L("Error %d while establishing connection with device encryption engine"), err); + ret = EFalse; + } + } + delete devEncSession; devEncSession = NULL; + + if (library.Handle()) + library.Close(); + } Dprint(_L("CSCPServer::IsDeviceMemoryEncrypted, ret = %d <<"), ret); return ret; diff -r 9e9792ae22e3 -r 86979fe66c4c terminalsecurity/SCP/SCPTimestampPlugin/inc/SCPTimestampPlugin.h --- a/terminalsecurity/SCP/SCPTimestampPlugin/inc/SCPTimestampPlugin.h Mon Mar 15 12:43:15 2010 +0200 +++ b/terminalsecurity/SCP/SCPTimestampPlugin/inc/SCPTimestampPlugin.h Wed Mar 31 23:00:03 2010 +0300 @@ -51,6 +51,8 @@ const TInt KSCPTypeHours = 1; const TInt KSCPTypeDays = 2; +const TInt KSCPNoteTimeout = 2000000; + _LIT( KSCPTSConfigFile, "SCPTimestampPlugin.ini"); _LIT( KDriveZ, "Z:" ); _LIT(KSCPTimestampPluginResFilename, "\\Resource\\SCPTimestampPluginLang.rsc"); diff -r 9e9792ae22e3 -r 86979fe66c4c terminalsecurity/SCP/SCPTimestampPlugin/src/SCPTimestampPlugin.cpp --- a/terminalsecurity/SCP/SCPTimestampPlugin/src/SCPTimestampPlugin.cpp Mon Mar 15 12:43:15 2010 +0200 +++ b/terminalsecurity/SCP/SCPTimestampPlugin/src/SCPTimestampPlugin.cpp Wed Mar 31 23:00:03 2010 +0300 @@ -580,22 +580,19 @@ HBufC16* resText = NULL; TRAPD( err, resText = LoadResourceL( R_SET_SEC_CODE_AGING ) ); FormatResourceString(*resText); - if (err == KErrNone) // If this fails, go on anyway to signal the psw change + if ( err == KErrNone ) // If this fails, go on anyway to signal the psw change { - TPtr16 bufDes = resText->Des(); - TRequestStatus userResponse; - - CAknGlobalNote* note = CAknGlobalNote::NewLC(); + TPtr16 bufDes = resText->Des(); + TRAP_IGNORE( - note->SetSoftkeys(R_AVKON_SOFTKEYS_OK_EMPTY); - note->ShowNoteL(userResponse, EAknGlobalWarningNote, - bufDes); - ); - - // Wait for the User Response - User::WaitForRequest(userResponse); - CleanupStack::PopAndDestroy(note); - + CAknGlobalNote* note = CAknGlobalNote::NewLC(); + note->ShowNoteL( EAknGlobalWarningNote, bufDes ); + CleanupStack::PopAndDestroy( note ); + ); + + // Wait here a while so the dialog won't appear on top of the note + User::After( KSCPNoteTimeout ); + delete resText; } diff -r 9e9792ae22e3 -r 86979fe66c4c terminalsecurity/SCP/SCPTimestampPlugin/src/SCPUserInf.cpp --- a/terminalsecurity/SCP/SCPTimestampPlugin/src/SCPUserInf.cpp Mon Mar 15 12:43:15 2010 +0200 +++ b/terminalsecurity/SCP/SCPTimestampPlugin/src/SCPUserInf.cpp Wed Mar 31 23:00:03 2010 +0300 @@ -17,15 +17,15 @@ #include "SCPUserInf.h" #include -#include -//#include -#include + +#include +#include #include "SCPDebug.h" #include // For wipe -#include -#include +#include +#include #include #include "DMUtilClient.h" CSCPUserInf::CSCPUserInf() : @@ -100,17 +100,15 @@ { Dprint( (_L("CSCPUserInf::EGlobalConf") )); TRAP_IGNORE( - CAknGlobalConfirmationQuery* note = CAknGlobalConfirmationQuery::NewLC(); + TRequestStatus status; TPtr16 bufDes = idispText->Des(); - TRequestStatus status; - note->ShowConfirmationQueryL(status, - bufDes, - R_AVKON_SOFTKEYS_OK_EMPTY, - R_QGN_NOTE_WARNING_ANIM ); - Dprint( (_L("CSCPUserInf::WaitforReq") )); + CAknGlobalNote* lInfoNote = CAknGlobalNote :: NewLC(); + lInfoNote->SetSoftkeys(R_AVKON_SOFTKEYS_OK_EMPTY__OK); + lInfoNote->SetAnimation(R_QGN_NOTE_WARNING_ANIM); + lInfoNote->ShowNoteL(status, EAknGlobalInformationNote, bufDes); + lInfoNote->SetPriority(ECoeWinPriorityAlwaysAtFront + 1); User::WaitForRequest( status ); - Dprint( (_L("CSCPUserInf::WaitforReq done") )); - CleanupStack::PopAndDestroy( note ); + CleanupStack::PopAndDestroy(1); // note ); } else if (iState == ERfs) diff -r 9e9792ae22e3 -r 86979fe66c4c terminalsecurity/server/group/TerminalControlServer.mmp --- a/terminalsecurity/server/group/TerminalControlServer.mmp Mon Mar 15 12:43:15 2010 +0200 +++ b/terminalsecurity/server/group/TerminalControlServer.mmp Wed Mar 31 23:00:03 2010 +0300 @@ -56,6 +56,5 @@ LIBRARY charconv.lib LIBRARY flogger.lib LIBRARY featmgr.lib -LIBRARY devenccommonutils.lib // Device encryption utility SMPSAFE \ No newline at end of file diff -r 9e9792ae22e3 -r 86979fe66c4c terminalsecurity/server/src/TerminalControlSession.cpp --- a/terminalsecurity/server/src/TerminalControlSession.cpp Mon Mar 15 12:43:15 2010 +0200 +++ b/terminalsecurity/server/src/TerminalControlSession.cpp Wed Mar 31 23:00:03 2010 +0300 @@ -30,7 +30,7 @@ #include "TcTrustedSession.h" //Device encryption utility #include -#include +#include //Feature manager #include //For debugging purpose @@ -1411,9 +1411,7 @@ TBool CTerminalControlSession::IsDeviceMemoryEncrypted() { RDEBUG("CTerminalControlSession::IsDeviceMemoryEncrypted >>"); - TBool ret(EFalse); - //First check if the feature is supported on device TRAPD(ferr, FeatureManager::InitializeLibL()); if (ferr != KErrNone) @@ -1425,43 +1423,73 @@ FeatureManager::UnInitializeLib(); //If feature is supported, check if any drive is encrypted. + if (ret) { - CDevEncSession* devEncSession = new CDevEncSession( EDriveC ); + RLibrary library; + CDevEncSessionBase* devEncSession = NULL; + TInt err = library.Load(KDevEncCommonUtils); + if (err != KErrNone) + { + RDEBUG_2("Error in finding the library... %d", err); + ret = EFalse; + } + else + { + TLibraryFunction entry = library.Lookup(1); + + if (!entry) + { + RDEBUG("Error in loading the library..."); + ret = EFalse; + } + else + { + devEncSession = (CDevEncSessionBase*) entry(); + RDEBUG("Library is found and loaded successfully..."); + } + } + if (!devEncSession) { RDEBUG("Can't instantiate device encryption session.."); - return EFalse; - } - - TInt err = devEncSession->Connect(); - if (KErrNone == err) - { - //Session with device encryption is established. Check if any drive is encrypted - TInt encStatus (KErrNone); - TInt err = devEncSession->DiskStatus( encStatus ); - RDEBUG_3("err = %d, encstatus = %d", err, encStatus); - if ( KErrNone == err && encStatus != EDecrypted ) - { - RDEBUG("Memory is encrypted"); - ret = ETrue; - } - else - { - RDEBUG("Memory is not encrypted"); - ret = EFalse; - } - } - else - { - RDEBUG_2("Error %d while establishing connection with device encryption engine", err); ret = EFalse; } - - delete devEncSession; devEncSession = NULL; - } - + else + { + devEncSession->SetDrive( EDriveC ); + TInt err = devEncSession->Connect(); + if (err == KErrNone) + { + //Session with device encryption is established. Check if any drive is encrypted + TInt encStatus (KErrNone); + TInt err = devEncSession->DiskStatus( encStatus ); + devEncSession->Close(); + RDEBUG_2("encstatus = %d", encStatus); + if ( err == KErrNone && encStatus != EDecrypted ) + { + RDEBUG("Memory is encrypted"); + ret = ETrue; + } + else + { + RDEBUG("Memory is not encrypted"); + ret = EFalse; + } + } + else + { + RDEBUG_2("Error %d while establishing connection with device encryption engine", err); + ret = EFalse; + } + } + delete devEncSession; devEncSession = NULL; + + if (library.Handle()) + library.Close(); + + } RDEBUG_2("CTerminalControlSession::IsDeviceMemoryEncrypted, ret = %d <<", ret); return ret; }