1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/security/crypto/weakcrypto/test/tsymmetric/cryptotestaction.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,107 @@
1.4 +/*
1.5 +* Copyright (c) 1998-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 +#ifndef __CRYPTOTESTACTION_H__
1.23 +#define __CRYPTOTESTACTION_H__
1.24 +
1.25 +#include "t_testaction.h"
1.26 +#include "t_input.h"
1.27 +
1.28 +_LIT8(KVectorStart, "<vector>");
1.29 +_LIT8(KVectorEnd, "</vector>");
1.30 +_LIT8(KIncrementalStart, "<incremental>");
1.31 +_LIT8(KIncrementalEnd, "</incremental>");
1.32 +_LIT8(KKeyStart, "<key>");
1.33 +_LIT8(KKeyEnd, "</key>");
1.34 +_LIT8(KInputStart, "<input>");
1.35 +_LIT8(KInputEnd, "</input>");
1.36 +_LIT8(KOutputStart, "<output>");
1.37 +_LIT8(KOutputEnd, "</output>");
1.38 +_LIT8(KCipherTypeStart, "<ciphertype>");
1.39 +_LIT8(KCipherTypeEnd, "</ciphertype>");
1.40 +_LIT8(KIVStart, "<iv>");
1.41 +_LIT8(KIVEnd, "</iv>");
1.42 +_LIT8(KMonteCarloStart, "<MonteCarlo>");
1.43 +_LIT8(KMonteCarloEnd, "</MonteCarlo>");
1.44 +_LIT8(KEffKeyLenStart, "<effectiveKeyLength>");
1.45 +_LIT8(KEffKeyLenEnd, "</effectiveKeyLength>");
1.46 +_LIT8(KIterationsStart, "<iterations>");
1.47 +_LIT8(KIterationsEnd, "</iterations>");
1.48 +_LIT8(KRandDataSizeStart, "<randDataSize>"); //Used specifically in performance tests where random data is used rather than specific input and output data pairs
1.49 +_LIT8(KRandDataSizeEnd, "</randDataSize>"); //Used specifically in performance tests where random data is used rather than specific input and output data pairs
1.50 +
1.51 +
1.52 +class CCryptoTestAction : public CTestAction
1.53 +{
1.54 +public:
1.55 + CCryptoTestAction(RFs& aFs, CConsoleBase& aConsole, Output& aOut);
1.56 + ~CCryptoTestAction();
1.57 +public:
1.58 + virtual void ConstructL(const TTestActionSpec& aTestActionSpec);
1.59 + virtual void DoPerformPrerequisite(TRequestStatus& aStatus);
1.60 + virtual void DoPerformPostrequisite(TRequestStatus& aStatus);
1.61 + virtual void PerformAction(TRequestStatus& aStatus);
1.62 + virtual void DoReportAction(void);
1.63 + virtual void DoCheckResult(TInt);
1.64 + virtual void Reset(){}
1.65 +protected:
1.66 + virtual void DoPerformPrerequisiteL() = 0;
1.67 + virtual void DoPerformActionL() = 0;
1.68 + virtual void DoPerformPostrequisiteL() {}
1.69 +protected:
1.70 + void Hex(HBufC8& string);
1.71 + void DoInputParseL(TDesC8& aScriptBuffer);
1.72 +protected:
1.73 + enum TCipherType
1.74 + {
1.75 + EDESECB,
1.76 + EDESCBC,
1.77 + E3DESECB,
1.78 + E3DESCBC,
1.79 + EAESECB,
1.80 + EAESCBC,
1.81 + EAESMonteCarloEncryptECB, // These extra categories have been added
1.82 + EAESMonteCarloDecryptECB, // because the Monte-Carlo tests have to be
1.83 + EAESMonteCarloEncryptCBC, // split between encrypt and decrypt scripts
1.84 + EAESMonteCarloDecryptCBC, // (too big for test framework in one chunk)
1.85 + ERC2ECB,
1.86 + ERC2CBC,
1.87 + ERC4,
1.88 + ECipherNull
1.89 + };
1.90 +protected:
1.91 + RFs& iFs;
1.92 + HBufC8* iBody;
1.93 + HBufC8* iKey;
1.94 + HBufC8* iInput;
1.95 + HBufC8* iOutput;
1.96 + HBufC8* iIV;
1.97 + HBufC8* iEResult;
1.98 + HBufC8* iDResult;
1.99 + TInt iEffectiveKeyLen;
1.100 + TInt iIterationTime;
1.101 + TInt iEncryptIterations;
1.102 + TInt iDecryptIterations;
1.103 + TCipherType iCipherType;
1.104 + TTimeIntervalMicroSeconds iEncryptorCreateTime;
1.105 + TTimeIntervalMicroSeconds iDecryptorCreateTime;
1.106 + TInt iExpectedWeakResult;
1.107 + TInt iRandDataSize;
1.108 +};
1.109 +
1.110 +#endif // __CRYPTOTESTACTION_H__