diff -r da2ae96f639b -r cd501b96611d crypto/weakcryptospi/source/symmetric/mstreamcipher.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/crypto/weakcryptospi/source/symmetric/mstreamcipher.cpp Fri Nov 06 13:21:00 2009 +0200 @@ -0,0 +1,57 @@ +/* +* Copyright (c) 2002-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: +* streamcipher.cpp +* +*/ + + +#include "streamcipher.h" +#include + +EXPORT_C void CStreamCipher::ProcessFinalL(const TDesC8& aInput, TDes8& aOutput) + { + Process(aInput, aOutput); + } + +EXPORT_C void CStreamCipher::Process(const TDesC8& aInput, TDes8& aOutput) + { + TInt outputIndex = aOutput.Size(); + + // aOutput may already have outputIndex bytes of data in it + // check there will still be enough space to process the result + __ASSERT_DEBUG(aOutput.MaxLength() - outputIndex >= MaxOutputLength(aInput.Length()), User::Panic(KCryptoPanic, ECryptoPanicOutputDescriptorOverflow)); + + aOutput.Append(aInput); + + TPtr8 transformBuf((TUint8*)(aOutput.Ptr()) + outputIndex, aInput.Size(), + aInput.Size()); + DoProcess(transformBuf); + } + +EXPORT_C TInt CStreamCipher::BlockSize() const + { + return (1); + } + +EXPORT_C TInt CStreamCipher::MaxOutputLength(TInt aInputLength) const + { + return aInputLength; + } + +EXPORT_C TInt CStreamCipher::MaxFinalOutputLength(TInt aInputLength) const + { + return aInputLength; + } +