1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/security/cryptoplugins/cryptospiplugins/source/softwarecrypto/md2impl.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,95 @@
1.4 +/*
1.5 +* Copyright (c) 2006-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 +* Software md2 implementation
1.19 +*
1.20 +*/
1.21 +
1.22 +
1.23 +/**
1.24 + @file
1.25 + @internalComponent
1.26 + @released
1.27 +*/
1.28 +
1.29 +#ifndef __CRYPTOAPI_SOFTWAREMD2IMPL_H__
1.30 +#define __CRYPTOAPI_SOFTWAREMD2IMPL_H__
1.31 +
1.32 +#include "softwarehashbase.h"
1.33 +
1.34 +namespace SoftwareCrypto
1.35 + {
1.36 + using namespace CryptoSpi;
1.37 +
1.38 + const TInt KMD2BlockSize = 16;
1.39 + const TInt KMD2HashSize = 16;
1.40 +
1.41 + NONSHARABLE_CLASS(CMD2Impl) : public CBase, public MSoftwareHash
1.42 + {
1.43 + public:
1.44 + //NewL & NewLC
1.45 + static CMD2Impl* NewL();
1.46 + static CMD2Impl* NewLC();
1.47 +
1.48 + //From MPlugin
1.49 + void Reset();
1.50 + void Close();
1.51 + void GetCharacteristicsL(const TCharacteristics*& aPluginCharacteristics);
1.52 + static CExtendedCharacteristics* CreateExtendedCharacteristicsL();
1.53 + const CExtendedCharacteristics* GetExtendedCharacteristicsL();
1.54 + TAny* GetExtension(TUid aExtensionId);
1.55 +
1.56 + //From MHash
1.57 + TPtrC8 Hash(const TDesC8& aMessage);
1.58 + void Update(const TDesC8& aMessage);
1.59 + TPtrC8 Final(const TDesC8& aMessage);
1.60 + MHash* ReplicateL();
1.61 + MHash* CopyL();
1.62 + void SetKeyL(const CKey& aKey);
1.63 + void SetOperationModeL(TUid aOperationMode);
1.64 +
1.65 +
1.66 + //From MSoftwareHash
1.67 + void RestoreState();
1.68 + void StoreState();
1.69 +
1.70 + private:
1.71 + //Constructors
1.72 + CMD2Impl();
1.73 + CMD2Impl(const CMD2Impl& aCMD2Impl);
1.74 +
1.75 + //Destructor
1.76 + ~CMD2Impl();
1.77 +
1.78 + TUid ImplementationUid();
1.79 +
1.80 + void DoUpdate(const TUint8* aData,TUint aLength);
1.81 + void DoFinal(void);
1.82 + void Block(const TUint8* aData);
1.83 +
1.84 +
1.85 + private:
1.86 +
1.87 + TBuf8<KMD2HashSize> iHash;
1.88 + TInt iNum;
1.89 + TUint8 iData[KMD2BlockSize];
1.90 + TUint iChecksum[KMD2BlockSize];
1.91 + TUint iState[KMD2BlockSize];
1.92 + TUint8 iDataTemp[KMD2BlockSize];
1.93 + TUint iChecksumTemp[KMD2BlockSize];
1.94 + TUint iStateTemp[KMD2BlockSize];
1.95 + };
1.96 + }
1.97 +
1.98 +#endif //__CRYPTOAPI_SOFTWAREMD2IMPL_H__