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