os/security/cryptoplugins/cryptospiplugins/source/softwarecrypto/sha224and256impl.h
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/security/cryptoplugins/cryptospiplugins/source/softwarecrypto/sha224and256impl.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,94 @@
1.4 +/*
1.5 +* Copyright (c) 2007-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 +*
1.19 +*/
1.20 +
1.21 +
1.22 +
1.23 +
1.24 +/**
1.25 + @file
1.26 + @internalComponent
1.27 + @released
1.28 +*/
1.29 +
1.30 +
1.31 +#ifndef __CRYPTOAPI_SOFTWARESHA224AND256IMPL_H_
1.32 +#define __CRYPTOAPI_SOFTWARESHA224AND256IMPL_H_
1.33 +
1.34 +
1.35 +#include "softwarehashbase.h"
1.36 +#include "shacommon.h"
1.37 +
1.38 +namespace SoftwareCrypto
1.39 + {
1.40 + using namespace CryptoSpi;
1.41 +
1.42 + const TInt KSHA256BlockSize = 64;
1.43 + const TInt KSHA224HashSize = 28;
1.44 + const TInt KSHA256HashSize = 32;
1.45 +
1.46 + NONSHARABLE_CLASS(CSHA224And256Impl) : public CBase, public MSHA2Impl
1.47 + {
1.48 + public:
1.49 + //NewL
1.50 + static CSHA224And256Impl* NewL();
1.51 + CSHA224And256Impl(const CSHA224And256Impl& aSHA256Impl);
1.52 +
1.53 + // Functions from MSHA2Impl
1.54 + virtual void RestoreState();
1.55 + virtual void StoreState();
1.56 + virtual void Reset(const TAny*);
1.57 + virtual void Update(const TUint8* aData,TUint aLength);
1.58 + virtual const TDes8& Final(void);
1.59 +
1.60 + private:
1.61 + //Constructors
1.62 + CSHA224And256Impl();
1.63 + inline void AddLength(const TUint aLength);
1.64 + inline void CopyWordToHash(TUint aVal, TUint aIndex);
1.65 + void Block();
1.66 + void PadMessage();
1.67 +
1.68 + private:
1.69 + TBuf8<KSHA256HashSize> iHash;
1.70 + TUint iA;
1.71 + TUint iB;
1.72 + TUint iC;
1.73 + TUint iD;
1.74 + TUint iE;
1.75 + TUint iF;
1.76 + TUint iG;
1.77 + TUint iH;
1.78 + TUint iData[KSHA256BlockSize];
1.79 +
1.80 + TUint iACopy;
1.81 + TUint iBCopy;
1.82 + TUint iCCopy;
1.83 + TUint iDCopy;
1.84 + TUint iECopy;
1.85 + TUint iFCopy;
1.86 + TUint iGCopy;
1.87 + TUint iHCopy;
1.88 + TUint iNlCopy;
1.89 + TUint64 iNhCopy;
1.90 + TUint iDataCopy[KSHA256BlockSize];
1.91 +
1.92 + TUint iNl;
1.93 + TUint64 iNh;
1.94 + };
1.95 + }
1.96 +
1.97 +#endif // __CRYPTOAPI_SOFTWARESHA224AND256IMPL_H_