os/security/cryptoplugins/cryptospiplugins/source/softwarecrypto/sha384and512impl.h
First public contribution.
2 * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of the License "Eclipse Public License v1.0"
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
28 #ifndef __CRYPTOAPI_SOFTWARESHA384AND512IMPL_H_
29 #define __CRYPTOAPI_SOFTWARESHA384AND512IMPL_H_
32 #include "softwarehashbase.h"
33 #include "shacommon.h"
35 namespace SoftwareCrypto
37 using namespace CryptoSpi;
39 const TInt KSHA512BlockSize = 128;
40 const TInt KSHA384HashSize = 48;
41 const TInt KSHA512HashSize = 64;
43 NONSHARABLE_CLASS(CSHA384And512Impl) : public CBase, public MSHA2Impl
47 static CSHA384And512Impl* NewL(TInt aHashSize = KSHA512HashSize);
48 CSHA384And512Impl(const CSHA384And512Impl& aSHA512Impl);
51 virtual void Reset(const TAny* aValueArr);
52 virtual const TDesC8& Final(void);
53 virtual void Update(const TUint8* aData,TUint aLength);
54 virtual void StoreState();
55 virtual void RestoreState();
59 CSHA384And512Impl(TInt aHashSize);
62 // Private member functions
64 * @param aLength - Length of message added in bytes.
66 inline void AddLength(const TUint64 aLength);
67 inline void CopyWordToHash(TUint64 aVal, TUint aIndex);
72 TBuf8<KSHA512HashSize> iHash;
81 TUint64 iData[KSHA512BlockSize];
93 TUint iBlockIndexCopy;
94 TUint64 iDataCopy[KSHA512BlockSize];
96 TUint64 iNl; // Lower word of Message Length
97 TUint64 iNh; // Higher word of Message Length
98 TUint iBlockIndex; // Message Length in the current block
102 #endif // __CRYPTOAPI_SOFTWARESHA384AND512IMPL_H_