os/security/crypto/weakcryptospi/test/tsymmetric/tsymmetricmain.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/security/crypto/weakcryptospi/test/tsymmetric/tsymmetricmain.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,135 @@
     1.4 +/*
     1.5 +* Copyright (c) 1998-2010 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 +#include <e32base.h>
    1.23 +#include "t_testhandler.h"
    1.24 +#include "t_testsetup.h"
    1.25 +#include "tScriptTests.h"
    1.26 +#include "tactionvector.h"
    1.27 +#include "tperformancetest.h"
    1.28 +#include "tactionincremental.h"
    1.29 +#include "tactionmontecarlo.h"
    1.30 +#include "tactionincrementallegacy.h"
    1.31 +
    1.32 +LOCAL_D void callExampleL() // initialize and call example code under cleanup stack
    1.33 +{
    1.34 +    START_SCRIPT_LIST
    1.35 +	SCRIPT_ITEM(CActionVector,_L8("Vector")),
    1.36 +	SCRIPT_ITEM(CPerformanceTest,_L8("Performance")),
    1.37 +	SCRIPT_ITEM(CActionIncremental,_L8("Incremental")),	
    1.38 +	SCRIPT_ITEM(CActionMonteCarlo, _L8("MonteCarlo")),
    1.39 +	SCRIPT_ITEM(CActionIncrementalLegacy,_L8("IncrementalLegacy"))
    1.40 +	END_SCRIPT_LIST
    1.41 +	
    1.42 +	TDriveUnit sysDrive (RFs::GetSystemDrive());
    1.43 +	TDriveName sysDriveName (sysDrive.Name());
    1.44 +	TBuf<64> scriptFile (sysDriveName);
    1.45 +	scriptFile.Append(_L("\\tsymmetric\\tsymmetrictests.txt"));
    1.46 +	
    1.47 +	TBuf<64> logFile (sysDriveName);
    1.48 +	logFile.Append(_L("\\tsymmetric\\tsymmetrictests.log"));
    1.49 +	
    1.50 +	
    1.51 +//	RC2, RC4, DES, 3DES (ECB and CBC modes)
    1.52 +/*	CTestSetup::CreateAndRunTestsL(theTestTypes, _L("c:\\tsymmetric\\symmetricOOMtests.txt"),
    1.53 +		_L("c:\\tsymmetric\\symmetricOOMtests.log"));*/
    1.54 +	CTestSetup::CreateAndRunTestsL(theTestTypes, scriptFile, logFile);
    1.55 +
    1.56 +//	CTestSetup::CreateAndRunTestsL(theTestTypes, _L("c:\\tsymmetric\\tsymmetricperformancetests.txt"),
    1.57 +//		_L("c:\\tsymmetric\\tsymmetricperformancetests.log"));
    1.58 +
    1.59 +//	There are so many other test scripts because it is impossible to put all the test
    1.60 +//	data in one big script.  The test framework just falls over with out of memory because
    1.61 +//	it attempts to create all test objects at the start of the test.  All these tests
    1.62 +//	are (of course) necessary hence they've been split.  Either run the top level build
    1.63 +//	and test script or, if running this test specifically, uncomment the following and it'll run them
    1.64 +//	all one after the other	
    1.65 +//	AES (ECB) using Rijndael vectors for all table values	
    1.66 +/*	CTestSetup::CreateAndRunTestsL(theTestTypes, _L("c:\\tsymmetric\\AESECBVectorsScript.txt"),
    1.67 +		_L("c:\\tsymmetric\\aesecb_vectors.log"));
    1.68 +
    1.69 +//	AES (ECB) KAT using variable text, known key
    1.70 +	CTestSetup::CreateAndRunTestsL(theTestTypes, _L("c:\\tsymmetric\\AESECB_KAT_VT.txt"),
    1.71 +		_L("c:\\tsymmetric\\aesecb_kat_vt.log"));
    1.72 + 
    1.73 +//	AES (ECB) KAT using variable key, known text
    1.74 +	CTestSetup::CreateAndRunTestsL(theTestTypes, _L("c:\\tsymmetric\\AESECB_KAT_VK.txt"),
    1.75 +		_L("c:\\tsymmetric\\aesecb_kat_vk.log"));
    1.76 +
    1.77 +//	AES Monte Carlo tests (ECB encrypt) with 128 bit key
    1.78 +	CTestSetup::CreateAndRunTestsL(theTestTypes, _L("c:\\tsymmetric\\AESMonteCarloEncryptECB128.txt"),
    1.79 +		_L("c:\\tsymmetric\\aesmontecarlo_encryptECB128.log"));
    1.80 +
    1.81 +//	AES Monte Carlo tests (ECB encrypt) with 192 bit key
    1.82 +	CTestSetup::CreateAndRunTestsL(theTestTypes, _L("c:\\tsymmetric\\AESMonteCarloEncryptECB192.txt"),
    1.83 +		_L("c:\\tsymmetric\\aesmontecarlo_encryptECB192.log"));
    1.84 +
    1.85 +//	AES Monte Carlo tests (ECB encrypt) with 256 bit key
    1.86 +	CTestSetup::CreateAndRunTestsL(theTestTypes, _L("c:\\tsymmetric\\AESMonteCarloEncryptECB256.txt"),
    1.87 +		_L("c:\\tsymmetric\\aesmontecarlo_encryptECB256.log"));
    1.88 +
    1.89 +//	AES Monte Carlo tests (ECB decrypt) with 128 bit key
    1.90 +	CTestSetup::CreateAndRunTestsL(theTestTypes, _L("c:\\tsymmetric\\AESMonteCarloDecryptECB128.txt"),
    1.91 +		_L("c:\\tsymmetric\\aesmontecarlo_decryptECB128.log"));
    1.92 +
    1.93 +//	AES Monte Carlo tests (ECB decrypt) with 192 bit key
    1.94 +	CTestSetup::CreateAndRunTestsL(theTestTypes, _L("c:\\tsymmetric\\AESMonteCarloDecryptECB192.txt"),
    1.95 +		_L("c:\\tsymmetric\\aesmontecarlo_decryptECB192.log"));
    1.96 +
    1.97 +//	AES Monte Carlo tests (ECB decrypt) with 256 bit key
    1.98 +	CTestSetup::CreateAndRunTestsL(theTestTypes, _L("c:\\tsymmetric\\AESMonteCarloDecryptECB256.txt"),
    1.99 +		_L("c:\\tsymmetric\\aesmontecarlo_decryptECB256.log"));
   1.100 +
   1.101 +//	AES Monte Carlo tests (CBC encrypt) with 128 bit key
   1.102 +	CTestSetup::CreateAndRunTestsL(theTestTypes, _L("c:\\tsymmetric\\AESMonteCarloEncryptCBC128.txt"),
   1.103 +		_L("c:\\tsymmetric\\aesmontecarlo_encryptCBC128.log"));
   1.104 +
   1.105 +//	AES Monte Carlo tests (CBC encrypt) with 192 bit key
   1.106 +	CTestSetup::CreateAndRunTestsL(theTestTypes, _L("c:\\tsymmetric\\AESMonteCarloEncryptCBC192.txt"),
   1.107 +		_L("c:\\tsymmetric\\aesmontecarlo_encryptCBC192.log"));
   1.108 +
   1.109 +//	AES Monte Carlo tests (CBC encrypt) with 256 bit key	
   1.110 +	CTestSetup::CreateAndRunTestsL(theTestTypes, _L("c:\\tsymmetric\\AESMonteCarloEncryptCBC256.txt"),
   1.111 +		_L("c:\\tsymmetric\\aesmontecarlo_encryptCBC256.log"));
   1.112 +
   1.113 +//	AES Monte Carlo tests (CBC decrypt) with 128 bit key
   1.114 +	CTestSetup::CreateAndRunTestsL(theTestTypes, _L("c:\\tsymmetric\\AESMonteCarloDecryptCBC128.txt"),
   1.115 +		_L("c:\\tsymmetric\\aesmontecarlo_decryptCBC128.log"));
   1.116 +
   1.117 +//	AES Monte Carlo tests (CBC decrypt) with 192 bit key
   1.118 +	CTestSetup::CreateAndRunTestsL(theTestTypes, _L("c:\\tsymmetric\\AESMonteCarloDecryptCBC192.txt"),
   1.119 +		_L("c:\\tsymmetric\\aesmontecarlo_decryptCBC192.log"));
   1.120 +
   1.121 +//	AES Monte Carlo tests (CBC decrypt) with 256 bit key
   1.122 +	CTestSetup::CreateAndRunTestsL(theTestTypes, _L("c:\\tsymmetric\\AESMonteCarloDecryptCBC256.txt"),
   1.123 +		_L("c:\\tsymmetric\\aesmontecarlo_decryptCBC256.log"));
   1.124 +
   1.125 +	CTestSetup::CreateAndRunTestsL(theTestTypes, _L("c:\\tsymmetric\\symmetricOOMtests.txt"),
   1.126 +		_L("c:\\tsymmetric\\symmetricOOMtests.log"));
   1.127 +*/}
   1.128 +
   1.129 +GLDEF_C TInt E32Main() // main function called by E32
   1.130 +    {
   1.131 +	__UHEAP_MARK;
   1.132 +	CTrapCleanup* cleanup = CTrapCleanup::New(); // get clean-up stack
   1.133 +	TRAPD(error, callExampleL());
   1.134 +	__ASSERT_ALWAYS(!error,User::Panic(_L("tsymmetric"),error));
   1.135 +	delete cleanup; // destroy clean-up stack
   1.136 +	__UHEAP_MARKEND;
   1.137 +	return 0;
   1.138 +    }