diff -r 675a964f4eb5 -r 35751d3474b7 crypto/weakcryptospi/source/spi/cryptocharacteristics.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/crypto/weakcryptospi/source/spi/cryptocharacteristics.cpp Thu Sep 10 14:01:51 2009 +0300 @@ -0,0 +1,500 @@ +/* +* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "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: +* crypto plugins loader implementation +* crypto spi state implementation +* +*/ + + +/** + @file +*/ + +#include +#include +#include "cryptospiutil.h" +#include + + +using namespace CryptoSpi; + + +// +// Implementation of CCharacteristics +// +CCharacteristics::CCharacteristics() + { + } + +CCharacteristics::~CCharacteristics() + { + iCreatorName.Close(); + iAlgorithmName.Close(); + } + +void CCharacteristics::InternalizeL(RReadStream& aStream) + { + iInterfaceUid=aStream.ReadInt32L(); + iAlgorithmUid=aStream.ReadInt32L(); + iImplementationUid=aStream.ReadInt32L(); + iCreatorName.CreateL(aStream, KMaxFileName); + iIsFIPSApproved=aStream.ReadInt8L(); + iIsHardwareSupported=aStream.ReadInt8L(); + iMaxConcurrencySupported=aStream.ReadUint32L(); + iAlgorithmName.CreateL(aStream, KMaxFileName); + iLatency=aStream.ReadInt32L(); + iThroughput=aStream.ReadInt32L(); + } + +// +// Implementation of CHashCharacteristics +// +CHashCharacteristics* CHashCharacteristics::NewL() + { + CHashCharacteristics* self=CHashCharacteristics::NewLC(); + CleanupStack::Pop(self); + return self; + } + +CHashCharacteristics* CHashCharacteristics::NewLC() + { + CHashCharacteristics* self=new(ELeave) CHashCharacteristics(); + CleanupStack::PushL(self); + return self; + } + +CHashCharacteristics::~CHashCharacteristics() + { + iSupportedOperationModes.Close(); + } + +CHashCharacteristics::CHashCharacteristics() + { + } + +void CHashCharacteristics::InternalizeL(RReadStream& aStream) + { + CCharacteristics::InternalizeL(aStream); + iBlockSize=aStream.ReadUint32L(); + iOutputSize=aStream.ReadUint32L(); + TUint32 count=aStream.ReadUint32L(); + for (TUint i=0;iInternalizeL(aStream); + } +#endif +// +// Implementation of CRandomCharacteristics +// +CRandomCharacteristics* CRandomCharacteristics::NewL() + { + CRandomCharacteristics* self=CRandomCharacteristics::NewLC(); + CleanupStack::Pop(self); + return self; + } + +CRandomCharacteristics* CRandomCharacteristics::NewLC() + { + CRandomCharacteristics* self=new(ELeave) CRandomCharacteristics(); + CleanupStack::PushL(self); + return self; + } + +CRandomCharacteristics::~CRandomCharacteristics() + { + } + +CRandomCharacteristics::CRandomCharacteristics() + { + } + +void CRandomCharacteristics::InternalizeL(RReadStream& aStream) + { + CCharacteristics::InternalizeL(aStream); + iBlockingMode=aStream.ReadUint32L(); + } + +// +// Implementation of CSymmetricCipherCharacteristics +// +CSymmetricCipherCharacteristics* CSymmetricCipherCharacteristics::NewL() + { + CSymmetricCipherCharacteristics* self=CSymmetricCipherCharacteristics::NewLC(); + CleanupStack::Pop(self); + return self; + } + +CSymmetricCipherCharacteristics* CSymmetricCipherCharacteristics::NewLC() + { + CSymmetricCipherCharacteristics* self=new(ELeave) CSymmetricCipherCharacteristics(); + CleanupStack::PushL(self); + return self; + } + +CSymmetricCipherCharacteristics::~CSymmetricCipherCharacteristics() + { + iSupportedPaddingModes.Close(); + iSupportedOperationModes.Close(); + } + +CSymmetricCipherCharacteristics::CSymmetricCipherCharacteristics() + { + } + +void CSymmetricCipherCharacteristics::InternalizeL(RReadStream& aStream) + { + CCharacteristics::InternalizeL(aStream); + iMaximumKeyLength=aStream.ReadUint32L(); + iBlockSize=aStream.ReadUint32L(); + TUint32 count=aStream.ReadUint32L(); + for (TUint i=0;iConstructL(aInterface); + return self; + } + +CCharacteristicsAndPluginName::CCharacteristicsAndPluginName() + { + } + +CCharacteristicsAndPluginName::~CCharacteristicsAndPluginName() + { + delete iCharacteristic; + if (iExtendedCharacteristic) + { + delete iExtendedCharacteristic; + } + } + +void CCharacteristicsAndPluginName::ConstructL(TInt32 aInterface) + { + iCharacteristic=CryptoSpiUtil::CreateCharacteristicsL(aInterface); + } + +void CCharacteristicsAndPluginName::InternalizeL(RReadStream& aStream) + { + iCharacteristic->InternalizeL(aStream); + TInt index=aStream.ReadInt8L(); + CryptoSpiUtil::DllIndexToName(index, iDllName); + } +