author | sl@SLION-WIN7.fritz.box |
Fri, 15 Jun 2012 03:10:57 +0200 | |
changeset 0 | bde4ae8d615e |
permissions | -rw-r--r-- |
sl@0 | 1 |
/* |
sl@0 | 2 |
* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
sl@0 | 3 |
* All rights reserved. |
sl@0 | 4 |
* This component and the accompanying materials are made available |
sl@0 | 5 |
* under the terms of the License "Eclipse Public License v1.0" |
sl@0 | 6 |
* which accompanies this distribution, and is available |
sl@0 | 7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
sl@0 | 8 |
* |
sl@0 | 9 |
* Initial Contributors: |
sl@0 | 10 |
* Nokia Corporation - initial contribution. |
sl@0 | 11 |
* |
sl@0 | 12 |
* Contributors: |
sl@0 | 13 |
* |
sl@0 | 14 |
* Description: |
sl@0 | 15 |
* |
sl@0 | 16 |
*/ |
sl@0 | 17 |
|
sl@0 | 18 |
|
sl@0 | 19 |
|
sl@0 | 20 |
|
sl@0 | 21 |
/** |
sl@0 | 22 |
@file |
sl@0 | 23 |
@internalComponent |
sl@0 | 24 |
@released |
sl@0 | 25 |
*/ |
sl@0 | 26 |
|
sl@0 | 27 |
|
sl@0 | 28 |
#ifndef __CRYPTOAPI_SOFTWARESHA384AND512IMPL_H_ |
sl@0 | 29 |
#define __CRYPTOAPI_SOFTWARESHA384AND512IMPL_H_ |
sl@0 | 30 |
|
sl@0 | 31 |
|
sl@0 | 32 |
#include "softwarehashbase.h" |
sl@0 | 33 |
#include "shacommon.h" |
sl@0 | 34 |
|
sl@0 | 35 |
namespace SoftwareCrypto |
sl@0 | 36 |
{ |
sl@0 | 37 |
using namespace CryptoSpi; |
sl@0 | 38 |
|
sl@0 | 39 |
const TInt KSHA512BlockSize = 128; |
sl@0 | 40 |
const TInt KSHA384HashSize = 48; |
sl@0 | 41 |
const TInt KSHA512HashSize = 64; |
sl@0 | 42 |
|
sl@0 | 43 |
NONSHARABLE_CLASS(CSHA384And512Impl) : public CBase, public MSHA2Impl |
sl@0 | 44 |
{ |
sl@0 | 45 |
public: |
sl@0 | 46 |
//NewL |
sl@0 | 47 |
static CSHA384And512Impl* NewL(TInt aHashSize = KSHA512HashSize); |
sl@0 | 48 |
CSHA384And512Impl(const CSHA384And512Impl& aSHA512Impl); |
sl@0 | 49 |
|
sl@0 | 50 |
//From MSHAImpl |
sl@0 | 51 |
virtual void Reset(const TAny* aValueArr); |
sl@0 | 52 |
virtual const TDesC8& Final(void); |
sl@0 | 53 |
virtual void Update(const TUint8* aData,TUint aLength); |
sl@0 | 54 |
virtual void StoreState(); |
sl@0 | 55 |
virtual void RestoreState(); |
sl@0 | 56 |
|
sl@0 | 57 |
private: |
sl@0 | 58 |
//Constructors |
sl@0 | 59 |
CSHA384And512Impl(TInt aHashSize); |
sl@0 | 60 |
|
sl@0 | 61 |
private: |
sl@0 | 62 |
// Private member functions |
sl@0 | 63 |
/** |
sl@0 | 64 |
* @param aLength - Length of message added in bytes. |
sl@0 | 65 |
*/ |
sl@0 | 66 |
inline void AddLength(const TUint64 aLength); |
sl@0 | 67 |
inline void CopyWordToHash(TUint64 aVal, TUint aIndex); |
sl@0 | 68 |
void Block(); |
sl@0 | 69 |
void PadMessage(); |
sl@0 | 70 |
|
sl@0 | 71 |
private: |
sl@0 | 72 |
TBuf8<KSHA512HashSize> iHash; |
sl@0 | 73 |
TUint64 iA; |
sl@0 | 74 |
TUint64 iB; |
sl@0 | 75 |
TUint64 iC; |
sl@0 | 76 |
TUint64 iD; |
sl@0 | 77 |
TUint64 iE; |
sl@0 | 78 |
TUint64 iF; |
sl@0 | 79 |
TUint64 iG; |
sl@0 | 80 |
TUint64 iH; |
sl@0 | 81 |
TUint64 iData[KSHA512BlockSize]; |
sl@0 | 82 |
|
sl@0 | 83 |
TUint64 iACopy; |
sl@0 | 84 |
TUint64 iBCopy; |
sl@0 | 85 |
TUint64 iCCopy; |
sl@0 | 86 |
TUint64 iDCopy; |
sl@0 | 87 |
TUint64 iECopy; |
sl@0 | 88 |
TUint64 iFCopy; |
sl@0 | 89 |
TUint64 iGCopy; |
sl@0 | 90 |
TUint64 iHCopy; |
sl@0 | 91 |
TUint64 iNlCopy; |
sl@0 | 92 |
TUint64 iNhCopy; |
sl@0 | 93 |
TUint iBlockIndexCopy; |
sl@0 | 94 |
TUint64 iDataCopy[KSHA512BlockSize]; |
sl@0 | 95 |
|
sl@0 | 96 |
TUint64 iNl; // Lower word of Message Length |
sl@0 | 97 |
TUint64 iNh; // Higher word of Message Length |
sl@0 | 98 |
TUint iBlockIndex; // Message Length in the current block |
sl@0 | 99 |
}; |
sl@0 | 100 |
} |
sl@0 | 101 |
|
sl@0 | 102 |
#endif // __CRYPTOAPI_SOFTWARESHA384AND512IMPL_H_ |