cryptoplugins/cryptospiplugins/source/softwarecrypto/macimpl.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Fri, 12 Mar 2010 15:51:07 +0200
branchRCL_3
changeset 48 eb9b28acd381
parent 17 cd501b96611d
permissions -rw-r--r--
Revision: 201008 Kit: 201008
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
17
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
     1
/*
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
     2
* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
     3
* All rights reserved.
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
     4
* This component and the accompanying materials are made available
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
     5
* under the terms of the License "Eclipse Public License v1.0"
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
     6
* which accompanies this distribution, and is available
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
     8
*
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
     9
* Initial Contributors:
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    11
*
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    12
* Contributors:
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    13
*
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    14
* Description: 
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    15
* Software Mac Implementation
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    16
* Software Mac Implementation
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    17
* MAC plugin header
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    18
*
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    19
*/
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    20
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    21
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    22
/**
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    23
 @file
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    24
*/
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    25
#include "macimpl.h"
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    26
#include "pluginconfig.h"
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    27
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    28
/**
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    29
 * HMAC plugin headers
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    30
 */ 
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    31
#include "md2impl.h"
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    32
#include "md4impl.h"
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    33
#include "md5impl.h"
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    34
#include "sha1impl.h"
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    35
#include "sha2impl.h"
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    36
#include "hmacimpl.h"
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    37
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    38
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    39
using namespace SoftwareCrypto;
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    40
using namespace CryptoSpi;
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    41
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    42
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    43
CMacImpl* CMacImpl::NewL(const CKey& aKey, const TUid aImplementationId, const CCryptoParams* aAlgorithmParams)
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    44
	{
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    45
	CMacImpl* self = new (ELeave) CMacImpl();
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    46
	CleanupStack::PushL(self);
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    47
	self->ConstructL(aKey, aImplementationId, aAlgorithmParams);
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    48
	CleanupStack::Pop();
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    49
	return self;
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    50
	}
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    51
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    52
CMacImpl::CMacImpl() 
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    53
	{
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    54
	}
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    55
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    56
void CMacImpl::ConstructL(const CKey& aKey, const TUid aImplementationId, const CCryptoParams* /*aAlgorithmParams*/) 
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    57
	{
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    58
	iImplementationUid = aImplementationId; 
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    59
	iKey = CryptoSpi::CKey::NewL(aKey);
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    60
		
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    61
	MSoftwareHash* hashImpl = NULL;
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    62
	
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    63
	switch (aImplementationId.iUid)
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    64
		{
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    65
		case KCryptoPluginMacHashMd2:
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    66
			{
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    67
			hashImpl = CMD2Impl::NewL();
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    68
			CleanupClosePushL(*hashImpl);
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    69
			iHmacImpl=CHMacImpl::NewL(*iKey, hashImpl);
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    70
			iBase = EHashBased;
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    71
			}
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    72
			break;
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    73
		case KCryptoPluginMacHashMd5:
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    74
			{
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    75
			hashImpl = CMD5Impl::NewL();
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    76
			CleanupClosePushL(*hashImpl);
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    77
			iHmacImpl=CHMacImpl::NewL(*iKey, hashImpl);
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    78
			iBase = EHashBased;
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    79
			}
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    80
			break;
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    81
		case KCryptoPluginMacHashMd4:
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    82
			{
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    83
			hashImpl = CMD4Impl::NewL();
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    84
			CleanupClosePushL(*hashImpl);
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    85
			iHmacImpl=CHMacImpl::NewL(*iKey, hashImpl);
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    86
			iBase = EHashBased;
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    87
			}
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    88
			break;
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    89
		case KCryptoPluginMacHashSha1:
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    90
			{
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    91
			hashImpl = CSHA1Impl::NewL();
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    92
			CleanupClosePushL(*hashImpl);
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    93
			iHmacImpl=CHMacImpl::NewL(*iKey, hashImpl);
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    94
			iBase = EHashBased;
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    95
			}
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    96
			break;
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    97
		case KCryptoPluginMacHashSha224:
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    98
			{
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
    99
			hashImpl = CSHA2Impl::NewL(KCryptoPluginSha224);
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   100
			CleanupClosePushL(*hashImpl);
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   101
			iHmacImpl=CHMacImpl::NewL(*iKey, hashImpl);
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   102
			iBase = EHashBased;
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   103
			}
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   104
			break;
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   105
		case KCryptoPluginMacHashSha256:
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   106
			{
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   107
			hashImpl = CSHA2Impl::NewL(KCryptoPluginSha256);
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   108
			CleanupClosePushL(*hashImpl);
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   109
			iHmacImpl=CHMacImpl::NewL(*iKey, hashImpl);
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   110
			iBase = EHashBased;
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   111
			}
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   112
			break;
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   113
		case KCryptoPluginMacHashSha384:
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   114
			{
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   115
			hashImpl = CSHA2Impl::NewL(KCryptoPluginSha384);
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   116
			CleanupClosePushL(*hashImpl);
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   117
			iHmacImpl=CHMacImpl::NewL(*iKey, hashImpl);
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   118
			iBase = EHashBased;
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   119
			}
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   120
			break;
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   121
		case KCryptoPluginMacHashSha512:
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   122
			{
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   123
			hashImpl = CSHA2Impl::NewL(KCryptoPluginSha512);
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   124
			CleanupClosePushL(*hashImpl);
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   125
			iHmacImpl=CHMacImpl::NewL(*iKey, hashImpl);
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   126
			iBase = EHashBased;
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   127
			}
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   128
			break;
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   129
		case KCryptoPluginMacAesXcbcMac96:
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   130
			{
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   131
			CSymmetricCipher* symmetricCipher = NULL;
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   132
			CryptoSpi::CSymmetricCipherFactory::CreateSymmetricCipherL(symmetricCipher,
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   133
														CryptoSpi::KAesUid, *iKey,
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   134
														CryptoSpi::KCryptoModeEncryptUid,
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   135
														CryptoSpi::KOperationModeCBCUid,
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   136
														CryptoSpi::KPaddingModeNoneUid,
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   137
														NULL);
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   138
			
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   139
			iCmacImpl= CCMacImpl::NewL(*iKey, symmetricCipher, CryptoSpi::KAlgorithmCipherAesXcbcMac96);
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   140
			iBase = ECipherBased;
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   141
			}
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   142
			break;
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   143
		case KCryptoPluginMacAesXcbcPrf128:
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   144
			{
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   145
			TBuf8<16> tempKey;
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   146
			tempKey.SetLength(16);
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   147
			
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   148
			CryptoSpi::CCryptoParams* keyParams = CryptoSpi::CCryptoParams::NewLC();
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   149
			keyParams->AddL(tempKey, CryptoSpi::KSymmetricKeyParameterUid);
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   150
			CryptoSpi::CKey* key = CryptoSpi::CKey::NewLC(aKey.KeyProperty(),*keyParams);
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   151
				
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   152
			CSymmetricCipher* symmetricCipher = NULL;
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   153
			CryptoSpi::CSymmetricCipherFactory::CreateSymmetricCipherL(symmetricCipher,
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   154
														CryptoSpi::KAesUid, *key,
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   155
														CryptoSpi::KCryptoModeEncryptUid,
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   156
														CryptoSpi::KOperationModeCBCUid,
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   157
														CryptoSpi::KPaddingModeNoneUid,
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   158
														NULL);
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   159
			CleanupStack::PopAndDestroy(2, keyParams); //key and keyParams
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   160
			
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   161
			iCmacImpl= CCMacImpl::NewL(*iKey, symmetricCipher, CryptoSpi::KAlgorithmCipherAesXcbcPrf128);
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   162
			iBase = ECipherBased;
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   163
			}
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   164
			break;
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   165
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   166
		default:
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   167
			User::Leave(KErrNotSupported);
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   168
		}
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   169
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   170
	if(iBase == EHashBased)
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   171
		{
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   172
		CleanupStack::PopAndDestroy(hashImpl);
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   173
		}
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   174
	}
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   175
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   176
CMacImpl::~CMacImpl()
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   177
	{
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   178
	delete iKey;
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   179
	if(iHmacImpl)
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   180
		{
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   181
		iHmacImpl->Close();
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   182
		}
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   183
	delete iCmacImpl;
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   184
	}
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   185
	
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   186
void CMacImpl::Reset()
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   187
	{
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   188
	if (iBase == EHashBased)
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   189
		{
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   190
		iHmacImpl->Reset();
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   191
		}
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   192
	else if (iBase == ECipherBased)
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   193
		{
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   194
		iCmacImpl->Reset();
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   195
		}
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   196
	}
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   197
	
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   198
void CMacImpl::Close()
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   199
	{
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   200
	delete this;	
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   201
	}
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   202
	
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   203
void CMacImpl::GetCharacteristicsL(const TCharacteristics*& aPluginCharacteristics)
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   204
	{
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   205
	aPluginCharacteristics=NULL;
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   206
	TInt macNum=sizeof(KMacCharacteristics)/sizeof(TMacCharacteristics*);
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   207
	for (TInt i=0;i<macNum;++i)
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   208
		{
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   209
		if (KMacCharacteristics[i]->iMacChar.iImplementationUID==ImplementationUid().iUid)
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   210
			{
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   211
			aPluginCharacteristics = KMacCharacteristics[i];
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   212
			break;
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   213
			}
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   214
		}	
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   215
	}
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   216
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   217
const CExtendedCharacteristics* CMacImpl::GetExtendedCharacteristicsL()
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   218
	{
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   219
	return (iBase == EHashBased) ? iHmacImpl->GetExtendedCharacteristicsL(): iCmacImpl->GetExtendedCharacteristicsL();
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   220
	}
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   221
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   222
TAny* CMacImpl::GetExtension(TUid aExtensionId)
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   223
	{
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   224
	return (iBase == EHashBased) ? iHmacImpl->GetExtension(aExtensionId): NULL;
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   225
	}
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   226
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   227
TUid CMacImpl::ImplementationUid() const
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   228
	{
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   229
	return iImplementationUid;
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   230
	}
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   231
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   232
TPtrC8 CMacImpl::MacL(const TDesC8& aMessage)
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   233
	{
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   234
	return (iBase == EHashBased) ? iHmacImpl->Hash(aMessage):iCmacImpl->MacL(aMessage);
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   235
	}		
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   236
	
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   237
void CMacImpl::UpdateL(const TDesC8& aMessage)
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   238
	{
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   239
	(iBase == EHashBased) ? iHmacImpl->Update(aMessage):iCmacImpl->UpdateL(aMessage);
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   240
	}
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   241
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   242
TPtrC8 CMacImpl::FinalL(const TDesC8& aMessage)
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   243
	{
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   244
	return (iBase == EHashBased) ? iHmacImpl->Final(aMessage):iCmacImpl->FinalL(aMessage);
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   245
	}
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   246
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   247
void CMacImpl::ReInitialiseAndSetKeyL(const CKey& aKey)
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   248
	{
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   249
	delete iKey;
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   250
	iKey = NULL;
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   251
	iKey = CryptoSpi::CKey::NewL(aKey);
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   252
	
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   253
	if (iBase == EHashBased)
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   254
		{
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   255
		iHmacImpl->SetKeyL(aKey);
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   256
		iHmacImpl->Reset();
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   257
		}
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   258
	else if (iBase == ECipherBased)
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   259
		{
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   260
		iCmacImpl->ReInitialiseAndSetKeyL(aKey);
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   261
		}
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   262
	}
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   263
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   264
MMac* CMacImpl::ReplicateL()
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   265
	{
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   266
	CMacImpl* that= new(ELeave) CMacImpl();
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   267
	CleanupStack::PushL(that);
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   268
	that->iImplementationUid = iImplementationUid;
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   269
	that->iBase = iBase;
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   270
	that->iKey=CKey::NewL(*iKey);
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   271
	
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   272
	if(iBase == EHashBased)
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   273
		{
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   274
		that->iHmacImpl=static_cast<CHMacImpl*>(iHmacImpl->ReplicateL());
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   275
		}
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   276
	else if (iBase == ECipherBased)
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   277
		{
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   278
		that->iCmacImpl= iCmacImpl->ReplicateL();
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   279
		}
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   280
	CleanupStack::Pop(that);
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   281
	return that;
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   282
	}
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   283
	
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   284
MMac* CMacImpl::CopyL()
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   285
	{
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   286
	CMacImpl* that= new(ELeave) CMacImpl();
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   287
	CleanupStack::PushL(that);
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   288
	that->iImplementationUid = iImplementationUid;
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   289
	that->iBase = iBase;
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   290
	that->iKey=CKey::NewL(*iKey);
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   291
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   292
	if(iBase == EHashBased)
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   293
		{
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   294
		that->iHmacImpl=static_cast<CHMacImpl*>(iHmacImpl->CopyL());
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   295
		}
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   296
	else if (iBase == ECipherBased)
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   297
		{
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   298
		that->iCmacImpl= iCmacImpl->CopyL();
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   299
		}
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   300
	CleanupStack::Pop(that);
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   301
	return that;
cd501b96611d Revision: 200945
Mikko Sunikka <mikko.sunikka@nokia.com>
parents:
diff changeset
   302
	}