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