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