crypto/weakcrypto/test/tsymmetric/tsymmetricmain.cpp
changeset 71 dd83586b62d6
equal deleted inserted replaced
66:8873e6835f7b 71:dd83586b62d6
       
     1 /*
       
     2 * Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     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".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <e32base.h>
       
    20 #include "t_testhandler.h"
       
    21 #include "t_testsetup.h"
       
    22 #include "tscripttests.h"
       
    23 #include "tactionvector.h"
       
    24 #include "tperformancetest.h"
       
    25 #include "tactionincremental.h"
       
    26 #include "tactionmontecarlo.h"
       
    27 
       
    28 LOCAL_D void callExampleL() // initialize and call example code under cleanup stack
       
    29 {
       
    30     START_SCRIPT_LIST
       
    31 	SCRIPT_ITEM(CActionVector,_L8("Vector")),
       
    32 	SCRIPT_ITEM(CPerformanceTest,_L8("Performance")),
       
    33 	SCRIPT_ITEM(CActionIncremental,_L8("Incremental")),
       
    34 	SCRIPT_ITEM(CActionMonteCarlo, _L8("MonteCarlo"))
       
    35 	END_SCRIPT_LIST
       
    36 	
       
    37 	TDriveUnit sysDrive (RFs::GetSystemDrive());
       
    38 	TDriveName sysDriveName (sysDrive.Name());
       
    39 	TBuf<64> scriptFile (sysDriveName);
       
    40 	scriptFile.Append(_L("\\tsymmetric\\tsymmetrictests.txt"));
       
    41 	
       
    42 	TBuf<64> logFile (sysDriveName);
       
    43 	logFile.Append(_L("\\tsymmetric\\tsymmetrictests.log"));
       
    44 	
       
    45 	
       
    46 //	RC2, RC4, DES, 3DES (ECB and CBC modes)
       
    47 /*	CTestSetup::CreateAndRunTestsL(theTestTypes, _L("c:\\tsymmetric\\symmetricOOMtests.txt"),
       
    48 		_L("c:\\tsymmetric\\symmetricOOMtests.log"));*/
       
    49 	CTestSetup::CreateAndRunTestsL(theTestTypes, scriptFile, logFile);
       
    50 
       
    51 //	CTestSetup::CreateAndRunTestsL(theTestTypes, _L("c:\\tsymmetric\\tsymmetricperformancetests.txt"),
       
    52 //		_L("c:\\tsymmetric\\tsymmetricperformancetests.log"));
       
    53 
       
    54 //	There are so many other test scripts because it is impossible to put all the test
       
    55 //	data in one big script.  The test framework just falls over with out of memory because
       
    56 //	it attempts to create all test objects at the start of the test.  All these tests
       
    57 //	are (of course) necessary hence they've been split.  Either run the top level build
       
    58 //	and test script or, if running this test specifically, uncomment the following and it'll run them
       
    59 //	all one after the other	
       
    60 //	AES (ECB) using Rijndael vectors for all table values	
       
    61 /*	CTestSetup::CreateAndRunTestsL(theTestTypes, _L("c:\\tsymmetric\\AESECBVectorsScript.txt"),
       
    62 		_L("c:\\tsymmetric\\aesecb_vectors.log"));
       
    63 
       
    64 //	AES (ECB) KAT using variable text, known key
       
    65 	CTestSetup::CreateAndRunTestsL(theTestTypes, _L("c:\\tsymmetric\\AESECB_KAT_VT.txt"),
       
    66 		_L("c:\\tsymmetric\\aesecb_kat_vt.log"));
       
    67  
       
    68 //	AES (ECB) KAT using variable key, known text
       
    69 	CTestSetup::CreateAndRunTestsL(theTestTypes, _L("c:\\tsymmetric\\AESECB_KAT_VK.txt"),
       
    70 		_L("c:\\tsymmetric\\aesecb_kat_vk.log"));
       
    71 
       
    72 //	AES Monte Carlo tests (ECB encrypt) with 128 bit key
       
    73 	CTestSetup::CreateAndRunTestsL(theTestTypes, _L("c:\\tsymmetric\\AESMonteCarloEncryptECB128.txt"),
       
    74 		_L("c:\\tsymmetric\\aesmontecarlo_encryptECB128.log"));
       
    75 
       
    76 //	AES Monte Carlo tests (ECB encrypt) with 192 bit key
       
    77 	CTestSetup::CreateAndRunTestsL(theTestTypes, _L("c:\\tsymmetric\\AESMonteCarloEncryptECB192.txt"),
       
    78 		_L("c:\\tsymmetric\\aesmontecarlo_encryptECB192.log"));
       
    79 
       
    80 //	AES Monte Carlo tests (ECB encrypt) with 256 bit key
       
    81 	CTestSetup::CreateAndRunTestsL(theTestTypes, _L("c:\\tsymmetric\\AESMonteCarloEncryptECB256.txt"),
       
    82 		_L("c:\\tsymmetric\\aesmontecarlo_encryptECB256.log"));
       
    83 
       
    84 //	AES Monte Carlo tests (ECB decrypt) with 128 bit key
       
    85 	CTestSetup::CreateAndRunTestsL(theTestTypes, _L("c:\\tsymmetric\\AESMonteCarloDecryptECB128.txt"),
       
    86 		_L("c:\\tsymmetric\\aesmontecarlo_decryptECB128.log"));
       
    87 
       
    88 //	AES Monte Carlo tests (ECB decrypt) with 192 bit key
       
    89 	CTestSetup::CreateAndRunTestsL(theTestTypes, _L("c:\\tsymmetric\\AESMonteCarloDecryptECB192.txt"),
       
    90 		_L("c:\\tsymmetric\\aesmontecarlo_decryptECB192.log"));
       
    91 
       
    92 //	AES Monte Carlo tests (ECB decrypt) with 256 bit key
       
    93 	CTestSetup::CreateAndRunTestsL(theTestTypes, _L("c:\\tsymmetric\\AESMonteCarloDecryptECB256.txt"),
       
    94 		_L("c:\\tsymmetric\\aesmontecarlo_decryptECB256.log"));
       
    95 
       
    96 //	AES Monte Carlo tests (CBC encrypt) with 128 bit key
       
    97 	CTestSetup::CreateAndRunTestsL(theTestTypes, _L("c:\\tsymmetric\\AESMonteCarloEncryptCBC128.txt"),
       
    98 		_L("c:\\tsymmetric\\aesmontecarlo_encryptCBC128.log"));
       
    99 
       
   100 //	AES Monte Carlo tests (CBC encrypt) with 192 bit key
       
   101 	CTestSetup::CreateAndRunTestsL(theTestTypes, _L("c:\\tsymmetric\\AESMonteCarloEncryptCBC192.txt"),
       
   102 		_L("c:\\tsymmetric\\aesmontecarlo_encryptCBC192.log"));
       
   103 
       
   104 //	AES Monte Carlo tests (CBC encrypt) with 256 bit key	
       
   105 	CTestSetup::CreateAndRunTestsL(theTestTypes, _L("c:\\tsymmetric\\AESMonteCarloEncryptCBC256.txt"),
       
   106 		_L("c:\\tsymmetric\\aesmontecarlo_encryptCBC256.log"));
       
   107 
       
   108 //	AES Monte Carlo tests (CBC decrypt) with 128 bit key
       
   109 	CTestSetup::CreateAndRunTestsL(theTestTypes, _L("c:\\tsymmetric\\AESMonteCarloDecryptCBC128.txt"),
       
   110 		_L("c:\\tsymmetric\\aesmontecarlo_decryptCBC128.log"));
       
   111 
       
   112 //	AES Monte Carlo tests (CBC decrypt) with 192 bit key
       
   113 	CTestSetup::CreateAndRunTestsL(theTestTypes, _L("c:\\tsymmetric\\AESMonteCarloDecryptCBC192.txt"),
       
   114 		_L("c:\\tsymmetric\\aesmontecarlo_decryptCBC192.log"));
       
   115 
       
   116 //	AES Monte Carlo tests (CBC decrypt) with 256 bit key
       
   117 	CTestSetup::CreateAndRunTestsL(theTestTypes, _L("c:\\tsymmetric\\AESMonteCarloDecryptCBC256.txt"),
       
   118 		_L("c:\\tsymmetric\\aesmontecarlo_decryptCBC256.log"));
       
   119 
       
   120 	CTestSetup::CreateAndRunTestsL(theTestTypes, _L("c:\\tsymmetric\\symmetricOOMtests.txt"),
       
   121 		_L("c:\\tsymmetric\\symmetricOOMtests.log"));
       
   122 */}
       
   123 
       
   124 GLDEF_C TInt E32Main() // main function called by E32
       
   125     {
       
   126 	__UHEAP_MARK;
       
   127 	CTrapCleanup* cleanup = CTrapCleanup::New(); // get clean-up stack
       
   128 	TRAPD(error, callExampleL());
       
   129 	__ASSERT_ALWAYS(!error,User::Panic(_L("tsymmetric"),error));
       
   130 	delete cleanup; // destroy clean-up stack
       
   131 	__UHEAP_MARKEND;
       
   132 	return 0;
       
   133     }