sl@0: /* sl@0: * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of the License "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: sl@0: * sl@0: */ sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @file sl@0: @internalComponent sl@0: @released sl@0: */ sl@0: sl@0: sl@0: #ifndef __CRYPTOAPI_SOFTWARESHA224AND256IMPL_H_ sl@0: #define __CRYPTOAPI_SOFTWARESHA224AND256IMPL_H_ sl@0: sl@0: sl@0: #include "softwarehashbase.h" sl@0: #include "shacommon.h" sl@0: sl@0: namespace SoftwareCrypto sl@0: { sl@0: using namespace CryptoSpi; sl@0: sl@0: const TInt KSHA256BlockSize = 64; sl@0: const TInt KSHA224HashSize = 28; sl@0: const TInt KSHA256HashSize = 32; sl@0: sl@0: NONSHARABLE_CLASS(CSHA224And256Impl) : public CBase, public MSHA2Impl sl@0: { sl@0: public: sl@0: //NewL sl@0: static CSHA224And256Impl* NewL(); sl@0: CSHA224And256Impl(const CSHA224And256Impl& aSHA256Impl); sl@0: sl@0: // Functions from MSHA2Impl sl@0: virtual void RestoreState(); sl@0: virtual void StoreState(); sl@0: virtual void Reset(const TAny*); sl@0: virtual void Update(const TUint8* aData,TUint aLength); sl@0: virtual const TDes8& Final(void); sl@0: sl@0: private: sl@0: //Constructors sl@0: CSHA224And256Impl(); sl@0: inline void AddLength(const TUint aLength); sl@0: inline void CopyWordToHash(TUint aVal, TUint aIndex); sl@0: void Block(); sl@0: void PadMessage(); sl@0: sl@0: private: sl@0: TBuf8 iHash; sl@0: TUint iA; sl@0: TUint iB; sl@0: TUint iC; sl@0: TUint iD; sl@0: TUint iE; sl@0: TUint iF; sl@0: TUint iG; sl@0: TUint iH; sl@0: TUint iData[KSHA256BlockSize]; sl@0: sl@0: TUint iACopy; sl@0: TUint iBCopy; sl@0: TUint iCCopy; sl@0: TUint iDCopy; sl@0: TUint iECopy; sl@0: TUint iFCopy; sl@0: TUint iGCopy; sl@0: TUint iHCopy; sl@0: TUint iNlCopy; sl@0: TUint64 iNhCopy; sl@0: TUint iDataCopy[KSHA256BlockSize]; sl@0: sl@0: TUint iNl; sl@0: TUint64 iNh; sl@0: }; sl@0: } sl@0: sl@0: #endif // __CRYPTOAPI_SOFTWARESHA224AND256IMPL_H_