os/security/crypto/weakcrypto/test/tsymmetric/cryptotestaction.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
/*
sl@0
     2
* Copyright (c) 1998-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
#ifndef __CRYPTOTESTACTION_H__
sl@0
    20
#define __CRYPTOTESTACTION_H__
sl@0
    21
sl@0
    22
#include "t_testaction.h"
sl@0
    23
#include "t_input.h"
sl@0
    24
sl@0
    25
_LIT8(KVectorStart, "<vector>");
sl@0
    26
_LIT8(KVectorEnd, "</vector>");
sl@0
    27
_LIT8(KIncrementalStart, "<incremental>");
sl@0
    28
_LIT8(KIncrementalEnd, "</incremental>");
sl@0
    29
_LIT8(KKeyStart, "<key>");
sl@0
    30
_LIT8(KKeyEnd, "</key>");
sl@0
    31
_LIT8(KInputStart, "<input>");
sl@0
    32
_LIT8(KInputEnd, "</input>");
sl@0
    33
_LIT8(KOutputStart, "<output>");
sl@0
    34
_LIT8(KOutputEnd, "</output>");
sl@0
    35
_LIT8(KCipherTypeStart, "<ciphertype>");
sl@0
    36
_LIT8(KCipherTypeEnd, "</ciphertype>");
sl@0
    37
_LIT8(KIVStart, "<iv>");
sl@0
    38
_LIT8(KIVEnd, "</iv>");
sl@0
    39
_LIT8(KMonteCarloStart, "<MonteCarlo>");
sl@0
    40
_LIT8(KMonteCarloEnd, "</MonteCarlo>");
sl@0
    41
_LIT8(KEffKeyLenStart, "<effectiveKeyLength>");
sl@0
    42
_LIT8(KEffKeyLenEnd, "</effectiveKeyLength>");
sl@0
    43
_LIT8(KIterationsStart, "<iterations>");
sl@0
    44
_LIT8(KIterationsEnd, "</iterations>");
sl@0
    45
_LIT8(KRandDataSizeStart, "<randDataSize>"); //Used specifically in performance tests where random data is used rather than specific input and output data pairs
sl@0
    46
_LIT8(KRandDataSizeEnd, "</randDataSize>");  //Used specifically in performance tests where random data is used rather than specific input and output data pairs
sl@0
    47
sl@0
    48
sl@0
    49
class CCryptoTestAction : public CTestAction
sl@0
    50
{
sl@0
    51
public:
sl@0
    52
	CCryptoTestAction(RFs& aFs, CConsoleBase& aConsole, Output& aOut);
sl@0
    53
	~CCryptoTestAction();
sl@0
    54
public:
sl@0
    55
	virtual void ConstructL(const TTestActionSpec& aTestActionSpec);
sl@0
    56
	virtual void DoPerformPrerequisite(TRequestStatus& aStatus);
sl@0
    57
	virtual void DoPerformPostrequisite(TRequestStatus& aStatus);
sl@0
    58
	virtual void PerformAction(TRequestStatus& aStatus);
sl@0
    59
	virtual void DoReportAction(void);
sl@0
    60
	virtual void DoCheckResult(TInt);
sl@0
    61
	virtual void Reset(){}
sl@0
    62
protected:	
sl@0
    63
	virtual void DoPerformPrerequisiteL() = 0;
sl@0
    64
	virtual void DoPerformActionL() = 0;
sl@0
    65
	virtual void DoPerformPostrequisiteL() {}
sl@0
    66
protected:
sl@0
    67
	void Hex(HBufC8& string);
sl@0
    68
	void DoInputParseL(TDesC8& aScriptBuffer);
sl@0
    69
protected:
sl@0
    70
	enum TCipherType
sl@0
    71
	{
sl@0
    72
		EDESECB,
sl@0
    73
		EDESCBC,
sl@0
    74
		E3DESECB,
sl@0
    75
		E3DESCBC,
sl@0
    76
		EAESECB,
sl@0
    77
		EAESCBC,
sl@0
    78
		EAESMonteCarloEncryptECB,	//	These extra categories have been added
sl@0
    79
		EAESMonteCarloDecryptECB,	//	because the Monte-Carlo tests have to be
sl@0
    80
		EAESMonteCarloEncryptCBC,	//	split between encrypt and decrypt scripts 
sl@0
    81
		EAESMonteCarloDecryptCBC,	//	(too big for test framework in one chunk)
sl@0
    82
		ERC2ECB,
sl@0
    83
		ERC2CBC,
sl@0
    84
		ERC4,
sl@0
    85
		ECipherNull
sl@0
    86
	};
sl@0
    87
protected:
sl@0
    88
	RFs& iFs;
sl@0
    89
	HBufC8* iBody;
sl@0
    90
	HBufC8* iKey;
sl@0
    91
	HBufC8* iInput;
sl@0
    92
	HBufC8* iOutput;
sl@0
    93
	HBufC8* iIV;
sl@0
    94
	HBufC8* iEResult;
sl@0
    95
	HBufC8* iDResult;
sl@0
    96
	TInt iEffectiveKeyLen;
sl@0
    97
	TInt iIterationTime;
sl@0
    98
	TInt iEncryptIterations;
sl@0
    99
	TInt iDecryptIterations;
sl@0
   100
	TCipherType iCipherType;
sl@0
   101
	TTimeIntervalMicroSeconds iEncryptorCreateTime;
sl@0
   102
	TTimeIntervalMicroSeconds iDecryptorCreateTime;
sl@0
   103
	TInt iExpectedWeakResult;
sl@0
   104
	TInt iRandDataSize;
sl@0
   105
};
sl@0
   106
sl@0
   107
#endif	//	__CRYPTOTESTACTION_H__