crypto/weakcrypto/source/symmetric/bufferedtransformation.cpp
author hgs
Thu, 12 Aug 2010 21:07:10 +0530
changeset 90 8c545fea2798
parent 72 de46a57f75fb
permissions -rw-r--r--
201031_01
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
72
de46a57f75fb 201023_02
hgs
parents:
diff changeset
     1
/*
de46a57f75fb 201023_02
hgs
parents:
diff changeset
     2
* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
de46a57f75fb 201023_02
hgs
parents:
diff changeset
     3
* All rights reserved.
de46a57f75fb 201023_02
hgs
parents:
diff changeset
     4
* This component and the accompanying materials are made available
de46a57f75fb 201023_02
hgs
parents:
diff changeset
     5
* under the terms of the License "Eclipse Public License v1.0"
de46a57f75fb 201023_02
hgs
parents:
diff changeset
     6
* which accompanies this distribution, and is available
de46a57f75fb 201023_02
hgs
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
de46a57f75fb 201023_02
hgs
parents:
diff changeset
     8
*
de46a57f75fb 201023_02
hgs
parents:
diff changeset
     9
* Initial Contributors:
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    11
*
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    12
* Contributors:
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    13
*
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    14
* Description: 
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    15
*
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    16
*/
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    17
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    18
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    19
#include "bufferedtransformation.h"
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    20
#include "blocktransformation.h"
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    21
#include "padding.h"
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    22
#include "../common/inlines.h"
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    23
#include <cryptopanic.h>
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    24
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    25
EXPORT_C CBufferedTransformation::~CBufferedTransformation()
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    26
	{
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    27
	delete iBT;
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    28
	delete iPadding;
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    29
	delete iInputStoreBuf;
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    30
	}
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    31
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    32
void CBufferedTransformation::Process(const TDesC8& aInput, TDes8& aOutput)
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    33
	{
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    34
	__ASSERT_DEBUG(aOutput.MaxLength() >= MaxOutputLength(aInput.Length()), User::Panic(KCryptoPanic, ECryptoPanicOutputDescriptorOverflow));
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    35
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    36
	TInt blockSize = iBT->BlockSize();
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    37
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    38
	if ( (aInput.Size() + iInputStore.Size()) < blockSize )
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    39
		{
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    40
		iInputStore.Append(aInput);
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    41
		}
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    42
	else
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    43
		{
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    44
		TInt outputIndex = aOutput.Size();
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    45
		aOutput.Append(iInputStore);
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    46
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    47
		TInt inputIndex = blockSize - iInputStore.Size();
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    48
		aOutput.Append(aInput.Mid(0, inputIndex));
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    49
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    50
		TPtr8 transformBuf((TUint8*)(aOutput.Ptr()) + outputIndex, blockSize,
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    51
			blockSize);
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    52
		//This should read: 
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    53
		//TPtr8 transformBuf(aOutput.Mid(outputIndex, blockSize));
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    54
		//but in the wonderful world of descriptors, Mid returns a TPtrC8 even
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    55
		//when called on a TPtr8.  Fantastic eh?
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    56
		iBT->Transform(transformBuf);
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    57
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    58
		outputIndex += blockSize;
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    59
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    60
		TInt len = aInput.Size() - blockSize;
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    61
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    62
		for (; inputIndex<=len; inputIndex+=blockSize)
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    63
			{
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    64
			aOutput.Append(aInput.Mid(inputIndex, blockSize));			
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    65
			transformBuf.Set((TUint8*)(aOutput.Ptr()) + outputIndex, blockSize,
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    66
				blockSize);
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    67
			iBT->Transform(transformBuf);
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    68
			outputIndex += blockSize;
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    69
			}
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    70
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    71
		iInputStore.Zero();
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    72
		if (inputIndex < aInput.Size())
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    73
			iInputStore.Append(aInput.Mid(inputIndex));
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    74
		}
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    75
	}
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    76
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    77
TInt CBufferedTransformation::MaxOutputLength(TInt aInputLength) const
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    78
	{
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    79
	TInt rem = (aInputLength + iInputStore.Size()) % (iBT->BlockSize());
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    80
	return ((aInputLength + iInputStore.Size()) - rem);
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    81
	}
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    82
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    83
void CBufferedTransformation::Reset()
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    84
	{
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    85
	iBT->Reset();
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    86
	iInputStore.Zero();
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    87
	}
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    88
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    89
TInt CBufferedTransformation::BlockSize() const
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    90
	{
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    91
	return (iBT->BlockSize());
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    92
	}
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    93
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    94
TInt CBufferedTransformation::KeySize() const
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    95
	{
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    96
	return (iBT->KeySize());
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    97
	}
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    98
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    99
EXPORT_C CBlockTransformation* CBufferedTransformation::BlockTransformer() const
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   100
{
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   101
	return (iBT);
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   102
}
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   103
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   104
CBufferedTransformation::CBufferedTransformation()
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   105
	: iInputStore(0,0,0)
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   106
	{
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   107
	}
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   108
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   109
void CBufferedTransformation::ConstructL(CBlockTransformation* aBT, CPadding* aPadding)
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   110
	{
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   111
	iInputStoreBuf = HBufC8::NewL(aBT->BlockSize());
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   112
	iInputStore.Set(iInputStoreBuf->Des());
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   113
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   114
	// Take ownership last - doesn't take ownership if we leave
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   115
	iBT = aBT;
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   116
	iPadding = aPadding;
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   117
	}
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   118
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   119
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   120
// CBufferedEncryptor
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   121
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   122
EXPORT_C CBufferedEncryptor* CBufferedEncryptor::NewL(
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   123
	CBlockTransformation* aBT, CPadding* aPadding)
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   124
	{
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   125
	CBufferedEncryptor* self = NewLC(aBT,aPadding);
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   126
	CleanupStack::Pop(self);
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   127
	return self;
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   128
	}
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   129
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   130
EXPORT_C CBufferedEncryptor* CBufferedEncryptor::NewLC(
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   131
	CBlockTransformation* aBT, CPadding* aPadding)
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   132
	{
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   133
	CBufferedEncryptor* self = new (ELeave) CBufferedEncryptor();
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   134
	CleanupStack::PushL(self);
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   135
	self->ConstructL(aBT, aPadding);
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   136
	return self;
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   137
	}
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   138
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   139
CBufferedEncryptor::CBufferedEncryptor()
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   140
	{
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   141
	}
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   142
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   143
void CBufferedEncryptor::ProcessFinalL(const TDesC8& aInput, TDes8& aOutput)
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   144
	{
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   145
	__ASSERT_DEBUG(aOutput.MaxLength() >= MaxFinalOutputLength(aInput.Length()), User::Panic(KCryptoPanic, ECryptoPanicOutputDescriptorOverflow));
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   146
	Process(aInput, aOutput);
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   147
	
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   148
	TInt outputIndex = aOutput.Size();
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   149
	iPadding->PadL(iInputStore, aOutput);
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   150
	assert(aOutput.Size() % iBT->BlockSize() == 0);
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   151
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   152
	TUint blockSize = iBT->BlockSize();
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   153
	TInt len = aOutput.Size() - outputIndex;
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   154
	
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   155
	for(TInt i=len; i>0; i-=blockSize)
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   156
		{
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   157
		TPtr8 transformBuf((TUint8*)(aOutput.Ptr()) + outputIndex, blockSize,
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   158
			blockSize);
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   159
		iBT->Transform(transformBuf);
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   160
		outputIndex+=blockSize;
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   161
		}
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   162
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   163
	iInputStore.Zero();
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   164
	}
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   165
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   166
TInt CBufferedEncryptor::MaxFinalOutputLength(TInt aInputLength) const
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   167
	{
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   168
    return iPadding->MaxPaddedLength(iInputStore.Size() + aInputLength);
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   169
	}
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   170
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   171
// CBufferedDecryptor
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   172
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   173
EXPORT_C CBufferedDecryptor* CBufferedDecryptor::NewL(
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   174
	CBlockTransformation* aBT, CPadding* aPadding)
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   175
	{
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   176
	CBufferedDecryptor* self = NewLC(aBT,aPadding);
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   177
	CleanupStack::Pop(self);
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   178
	return self;
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   179
	}
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   180
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   181
EXPORT_C CBufferedDecryptor* CBufferedDecryptor::NewLC(
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   182
	CBlockTransformation* aBT, CPadding* aPadding)
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   183
	{
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   184
	CBufferedDecryptor* self = new (ELeave) CBufferedDecryptor();
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   185
	CleanupStack::PushL(self);
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   186
	self->ConstructL(aBT, aPadding);
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   187
	return self;
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   188
	}
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   189
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   190
CBufferedDecryptor::CBufferedDecryptor()
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   191
	{
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   192
	}
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   193
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   194
void CBufferedDecryptor::ProcessFinalL(const TDesC8& aInput, TDes8& aOutput)
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   195
	{
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   196
	__ASSERT_DEBUG(aOutput.MaxLength() >= MaxFinalOutputLength(aInput.Length()), User::Panic(KCryptoPanic, ECryptoPanicOutputDescriptorOverflow));
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   197
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   198
	assert((aInput.Size() + iInputStore.Size()) % iPadding->BlockSize()==0);
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   199
	assert(aInput.Size() + iInputStore.Size() !=0 );
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   200
	assert(iPadding->BlockSize() % BlockSize() == 0);
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   201
	//1) Decrypt into aOutput up till the last full _padding_ blocksize
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   202
	//If this panics with descriptor problems, you've probably called
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   203
	//ProcessFinalL with a non-_padding_ blocksized aligned amount of data.
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   204
	TInt lenToDecrypt = aInput.Size() - iPadding->BlockSize();
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   205
	if(lenToDecrypt > 0)
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   206
		{
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   207
		Process(aInput.Left(lenToDecrypt), aOutput);
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   208
		assert(iInputStore.Size()==0);
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   209
		}
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   210
	else
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   211
		{
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   212
		lenToDecrypt = 0;
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   213
		}
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   214
	
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   215
	//2) Decrypt the last _padding_ blocksize into a new buffer
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   216
	HBufC8* padBuf = HBufC8::NewLC(iPadding->BlockSize());
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   217
	TPtr8 padPtr = padBuf->Des(); 
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   218
	Process(aInput.Mid(lenToDecrypt), padPtr);
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   219
	assert(iInputStore.Size()==0);
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   220
		
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   221
	//3) Unpad that last _padding_ blocksize into aOutput
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   222
	// Note that padding systems must always, like everything else in crypto,
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   223
	// _append_ data.
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   224
	iPadding->UnPadL(padPtr, aOutput);
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   225
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   226
	CleanupStack::PopAndDestroy(padBuf);
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   227
	}
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   228
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   229
TInt CBufferedDecryptor::MaxFinalOutputLength(TInt aInputLength) const
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   230
	{
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   231
	return iPadding->MaxUnPaddedLength(aInputLength + iInputStore.Size());
de46a57f75fb 201023_02
hgs
parents:
diff changeset
   232
	}