1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/security/cryptoplugins/cryptospiplugins/source/softwarecrypto/md5impl.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,102 @@
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 md5 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_SOFTWAREMD5IMPL_H__
1.30 +#define __CRYPTOAPI_SOFTWAREMD5IMPL_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 KMD5BlockSize = 16;
1.39 + const TInt KMD5HashSize = 16;
1.40 +
1.41 + NONSHARABLE_CLASS(CMD5Impl) : public CBase, public MSoftwareHash
1.42 + {
1.43 + public:
1.44 + //NewL & NewLC
1.45 + static CMD5Impl* NewL();
1.46 + static CMD5Impl* 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 + //From MSoftwareHash
1.66 + void RestoreState();
1.67 + void StoreState();
1.68 +
1.69 + private:
1.70 + //Constructors
1.71 + CMD5Impl();
1.72 + CMD5Impl(const CMD5Impl& aCMD5Impl);
1.73 +
1.74 + //Destructor
1.75 + ~CMD5Impl();
1.76 +
1.77 + TUid ImplementationUid();
1.78 +
1.79 + void DoUpdate(const TUint8* aData,TUint aLength);
1.80 + void DoFinal(void);
1.81 + void Block();
1.82 +
1.83 + private:
1.84 + TBuf8<KMD5HashSize> iHash;
1.85 +
1.86 + TUint iA;
1.87 + TUint iB;
1.88 + TUint iC;
1.89 + TUint iD;
1.90 + TUint iNl;
1.91 + TUint iNh;
1.92 + TUint iData[KMD5BlockSize];
1.93 +
1.94 + TUint iACopy;
1.95 + TUint iBCopy;
1.96 + TUint iCCopy;
1.97 + TUint iDCopy;
1.98 + TUint iNlCopy;
1.99 + TUint iNhCopy;
1.100 + TUint iDataCopy[KMD5BlockSize];
1.101 + };
1.102 + }
1.103 +
1.104 +#endif // __CRYPTOAPI_SOFTWAREMD5IMPL_H__
1.105 +