Update contrib.
2 * Copyright (c) 2006-2010 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.
15 * Software hash base definition
26 #ifndef __CRYPTOAPI_SOFTWAREHASHBASE_H__
27 #define __CRYPTOAPI_SOFTWAREHASHBASE_H__
29 #include <cryptospi/hashplugin.h>
30 #include <cryptospi/keys.h>
32 namespace SoftwareCrypto
34 using namespace CryptoSpi;
36 Interfaces for Software Hash
38 class MSoftwareHash : public MHash
42 Restores the internal state of the message digest
43 to a previously stored state.
45 virtual void RestoreState() = 0;
48 Stores the internal state of the message digest.
50 virtual void StoreState() = 0;
54 Proxy class Software Hash and Hmac implementation
56 class CSoftwareHash : public MHash, public CBase
62 static CSoftwareHash* NewL(TUid aAlgorithm, TUid aOperationMode, const CKey* aKey);
63 static CSoftwareHash* NewLC(TUid aAlgorithm, TUid aOperationMode, const CKey* aKey);
65 #ifdef SYMBIAN_SDP_IPSEC_VOIP_SUPPORT
66 static CSoftwareHash* NewL(TUid aAlgorithm);
78 void GetCharacteristicsL(const TCharacteristics*& aPluginCharacteristics);
79 const CExtendedCharacteristics* GetExtendedCharacteristicsL();
80 TAny* GetExtension(TUid aExtensionId);
84 TPtrC8 Hash(const TDesC8& aMessage);
85 void Update(const TDesC8& aMessage);
86 TPtrC8 Final(const TDesC8& aMessage);
89 void SetKeyL(const CKey& aKey);
90 void SetOperationModeL(TUid aOperationMode);
97 void ConstructL(TUid aAlgorithm, TUid aOperationMode, const CKey* aKey);
100 //get the active implementation
102 MSoftwareHash* Impl();
106 The Key for HMAC mode operation
111 The Uid for the operation mode
116 The hash implementation
118 MSoftwareHash* iHashImpl;
121 The Hmac implementation
123 MSoftwareHash* iHmacImpl;
126 GLDEF_C inline TUint CMD_R(TUint a,TUint s)
128 return (a<<s) | (a>>(32-s));
133 #endif // __CRYPTOAPI_SOFTWAREHASHBASE_H__