diff -r 000000000000 -r bde4ae8d615e os/security/crypto/weakcrypto/test/tsymmetric/cryptotestaction.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/os/security/crypto/weakcrypto/test/tsymmetric/cryptotestaction.h Fri Jun 15 03:10:57 2012 +0200 @@ -0,0 +1,107 @@ +/* +* Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#ifndef __CRYPTOTESTACTION_H__ +#define __CRYPTOTESTACTION_H__ + +#include "t_testaction.h" +#include "t_input.h" + +_LIT8(KVectorStart, ""); +_LIT8(KVectorEnd, ""); +_LIT8(KIncrementalStart, ""); +_LIT8(KIncrementalEnd, ""); +_LIT8(KKeyStart, ""); +_LIT8(KKeyEnd, ""); +_LIT8(KInputStart, ""); +_LIT8(KInputEnd, ""); +_LIT8(KOutputStart, ""); +_LIT8(KOutputEnd, ""); +_LIT8(KCipherTypeStart, ""); +_LIT8(KCipherTypeEnd, ""); +_LIT8(KIVStart, ""); +_LIT8(KIVEnd, ""); +_LIT8(KMonteCarloStart, ""); +_LIT8(KMonteCarloEnd, ""); +_LIT8(KEffKeyLenStart, ""); +_LIT8(KEffKeyLenEnd, ""); +_LIT8(KIterationsStart, ""); +_LIT8(KIterationsEnd, ""); +_LIT8(KRandDataSizeStart, ""); //Used specifically in performance tests where random data is used rather than specific input and output data pairs +_LIT8(KRandDataSizeEnd, ""); //Used specifically in performance tests where random data is used rather than specific input and output data pairs + + +class CCryptoTestAction : public CTestAction +{ +public: + CCryptoTestAction(RFs& aFs, CConsoleBase& aConsole, Output& aOut); + ~CCryptoTestAction(); +public: + virtual void ConstructL(const TTestActionSpec& aTestActionSpec); + virtual void DoPerformPrerequisite(TRequestStatus& aStatus); + virtual void DoPerformPostrequisite(TRequestStatus& aStatus); + virtual void PerformAction(TRequestStatus& aStatus); + virtual void DoReportAction(void); + virtual void DoCheckResult(TInt); + virtual void Reset(){} +protected: + virtual void DoPerformPrerequisiteL() = 0; + virtual void DoPerformActionL() = 0; + virtual void DoPerformPostrequisiteL() {} +protected: + void Hex(HBufC8& string); + void DoInputParseL(TDesC8& aScriptBuffer); +protected: + enum TCipherType + { + EDESECB, + EDESCBC, + E3DESECB, + E3DESCBC, + EAESECB, + EAESCBC, + EAESMonteCarloEncryptECB, // These extra categories have been added + EAESMonteCarloDecryptECB, // because the Monte-Carlo tests have to be + EAESMonteCarloEncryptCBC, // split between encrypt and decrypt scripts + EAESMonteCarloDecryptCBC, // (too big for test framework in one chunk) + ERC2ECB, + ERC2CBC, + ERC4, + ECipherNull + }; +protected: + RFs& iFs; + HBufC8* iBody; + HBufC8* iKey; + HBufC8* iInput; + HBufC8* iOutput; + HBufC8* iIV; + HBufC8* iEResult; + HBufC8* iDResult; + TInt iEffectiveKeyLen; + TInt iIterationTime; + TInt iEncryptIterations; + TInt iDecryptIterations; + TCipherType iCipherType; + TTimeIntervalMicroSeconds iEncryptorCreateTime; + TTimeIntervalMicroSeconds iDecryptorCreateTime; + TInt iExpectedWeakResult; + TInt iRandDataSize; +}; + +#endif // __CRYPTOTESTACTION_H__