1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/security/crypto/weakcryptospi/source/symmetric/mstreamcipher.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,57 @@
1.4 +/*
1.5 +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 +* All rights reserved.
1.7 +* This component and the accompanying materials are made available
1.8 +* under the terms of the License "Eclipse Public License v1.0"
1.9 +* which accompanies this distribution, and is available
1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.11 +*
1.12 +* Initial Contributors:
1.13 +* Nokia Corporation - initial contribution.
1.14 +*
1.15 +* Contributors:
1.16 +*
1.17 +* Description:
1.18 +* streamcipher.cpp
1.19 +*
1.20 +*/
1.21 +
1.22 +
1.23 +#include "streamcipher.h"
1.24 +#include <cryptopanic.h>
1.25 +
1.26 +EXPORT_C void CStreamCipher::ProcessFinalL(const TDesC8& aInput, TDes8& aOutput)
1.27 + {
1.28 + Process(aInput, aOutput);
1.29 + }
1.30 +
1.31 +EXPORT_C void CStreamCipher::Process(const TDesC8& aInput, TDes8& aOutput)
1.32 + {
1.33 + TInt outputIndex = aOutput.Size();
1.34 +
1.35 + // aOutput may already have outputIndex bytes of data in it
1.36 + // check there will still be enough space to process the result
1.37 + __ASSERT_DEBUG(aOutput.MaxLength() - outputIndex >= MaxOutputLength(aInput.Length()), User::Panic(KCryptoPanic, ECryptoPanicOutputDescriptorOverflow));
1.38 +
1.39 + aOutput.Append(aInput);
1.40 +
1.41 + TPtr8 transformBuf((TUint8*)(aOutput.Ptr()) + outputIndex, aInput.Size(),
1.42 + aInput.Size());
1.43 + DoProcess(transformBuf);
1.44 + }
1.45 +
1.46 +EXPORT_C TInt CStreamCipher::BlockSize() const
1.47 + {
1.48 + return (1);
1.49 + }
1.50 +
1.51 +EXPORT_C TInt CStreamCipher::MaxOutputLength(TInt aInputLength) const
1.52 + {
1.53 + return aInputLength;
1.54 + }
1.55 +
1.56 +EXPORT_C TInt CStreamCipher::MaxFinalOutputLength(TInt aInputLength) const
1.57 + {
1.58 + return aInputLength;
1.59 + }
1.60 +