sl@0: /* sl@0: * Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of the License "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: sl@0: * streamcipher.cpp sl@0: * sl@0: */ sl@0: sl@0: sl@0: #include "streamcipher.h" sl@0: #include sl@0: sl@0: EXPORT_C void CStreamCipher::ProcessFinalL(const TDesC8& aInput, TDes8& aOutput) sl@0: { sl@0: Process(aInput, aOutput); sl@0: } sl@0: sl@0: EXPORT_C void CStreamCipher::Process(const TDesC8& aInput, TDes8& aOutput) sl@0: { sl@0: TInt outputIndex = aOutput.Size(); sl@0: sl@0: // aOutput may already have outputIndex bytes of data in it sl@0: // check there will still be enough space to process the result sl@0: __ASSERT_DEBUG(aOutput.MaxLength() - outputIndex >= MaxOutputLength(aInput.Length()), User::Panic(KCryptoPanic, ECryptoPanicOutputDescriptorOverflow)); sl@0: sl@0: aOutput.Append(aInput); sl@0: sl@0: TPtr8 transformBuf((TUint8*)(aOutput.Ptr()) + outputIndex, aInput.Size(), sl@0: aInput.Size()); sl@0: DoProcess(transformBuf); sl@0: } sl@0: sl@0: EXPORT_C TInt CStreamCipher::BlockSize() const sl@0: { sl@0: return (1); sl@0: } sl@0: sl@0: EXPORT_C TInt CStreamCipher::MaxOutputLength(TInt aInputLength) const sl@0: { sl@0: return aInputLength; sl@0: } sl@0: sl@0: EXPORT_C TInt CStreamCipher::MaxFinalOutputLength(TInt aInputLength) const sl@0: { sl@0: return aInputLength; sl@0: } sl@0: