crypto/weakcrypto/test/tasymmetric/tasymmetricmain.cpp
author hgs
Thu, 12 Aug 2010 21:07:10 +0530
changeset 90 8c545fea2798
parent 72 de46a57f75fb
permissions -rw-r--r--
201031_01
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
72
de46a57f75fb 201023_02
hgs
parents:
diff changeset
     1
/*
de46a57f75fb 201023_02
hgs
parents:
diff changeset
     2
* Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
de46a57f75fb 201023_02
hgs
parents:
diff changeset
     3
* All rights reserved.
de46a57f75fb 201023_02
hgs
parents:
diff changeset
     4
* This component and the accompanying materials are made available
de46a57f75fb 201023_02
hgs
parents:
diff changeset
     5
* under the terms of the License "Eclipse Public License v1.0"
de46a57f75fb 201023_02
hgs
parents:
diff changeset
     6
* which accompanies this distribution, and is available
de46a57f75fb 201023_02
hgs
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
de46a57f75fb 201023_02
hgs
parents:
diff changeset
     8
*
de46a57f75fb 201023_02
hgs
parents:
diff changeset
     9
* Initial Contributors:
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    11
*
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    12
* Contributors:
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    13
*
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    14
* Description: 
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    15
*
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    16
*/
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    17
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    18
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    19
#include <e32base.h>
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    20
#include "t_testhandler.h"
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    21
#include "tscripttests.h"
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    22
#include "trsaencryptfb.h"
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    23
#include "trsasignfb.h"
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    24
#include "tdsasignfb.h"
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    25
#include "trsavector.h"
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    26
#include "tdsavector.h"
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    27
#include "tdsasignfb.h"
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    28
#include "tdsaprimegen.h"
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    29
#include "performancetest.h"
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    30
#include "tdhvector.h"
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    31
#include "trsaparams.h"
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    32
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    33
LOCAL_D void callExampleL() // initialize and call example code under cleanup stack
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    34
    {
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    35
	START_SCRIPT_LIST
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    36
	SCRIPT_ITEM(CRSAEncryptFB,_L8("RSAEncryptStandardAndCRTFB")),
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    37
	SCRIPT_ITEM(CRSASignFB,_L8("RSASignStandardAndCRTFB")),
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    38
	SCRIPT_ITEM(CDSASignFB,_L8("DSASignFB")),
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    39
	SCRIPT_ITEM(CRSAEncryptVector,_L8("RSAEncryptVector")),
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    40
	SCRIPT_ITEM(CRSADecryptVector,_L8("RSADecryptVector")),
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    41
	SCRIPT_ITEM(CRSADecryptVectorCRT,_L8("RSADecryptVectorCRT")),
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    42
	SCRIPT_ITEM(CRSASignVector,_L8("RSASignVector")),
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    43
	SCRIPT_ITEM(CRSASignVectorCRT,_L8("RSASignVectorCRT")),
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    44
	SCRIPT_ITEM(CRSAVerifyVector,_L8("RSAVerifyVector")),
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    45
	SCRIPT_ITEM(CDSASignVector,_L8("DSASignVector")),
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    46
	SCRIPT_ITEM(CDSAVerifyVector,_L8("DSAVerifyVector")),
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    47
	SCRIPT_ITEM(CDSASignFB,_L8("DSASignFB")),
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    48
	SCRIPT_ITEM(CDSAPrimeGen,_L8("DSAPrimeGen")),
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    49
	SCRIPT_ITEM(CPerformanceTest, _L8("PerformanceTestSettings")),
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    50
	SCRIPT_ITEM(CDHVector,_L8("DHVector")),
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    51
	SCRIPT_ITEM(CRSATestPublicKey,_L8("RSAPublicKeyParams")),
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    52
	SCRIPT_ITEM(CRSATestPrivateKey,_L8("RSAPrivateKeyParams")),
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    53
	SCRIPT_ITEM(CRSATestPrivateKeyCRT,_L8("RSAPrivateKeyCRTParams"))
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    54
	END_SCRIPT_LIST
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    55
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    56
//	Either run the top level build and test script or, if running this test specifically, 
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    57
//	uncomment the following and it'll run them all one after the other
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    58
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    59
	//get the system drive.	
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    60
	TDriveUnit sysDrive (RFs::GetSystemDrive());
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    61
	TBuf<64> scriptFile = sysDrive.Name();
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    62
	scriptFile.Append(_L("\\tasymmetric\\tasymmetrictests.txt"));
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    63
	TBuf<64> logFile = sysDrive.Name();
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    64
	logFile.Append(_L("\\tasymmetric\\tasymmetrictests.log"));
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    65
	CTestSetup::CreateAndRunTestsL(theTestTypes, scriptFile, logFile);
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    66
	
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    67
/* The test framework can't handle more than one script
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    68
 * at a time.  If you want to run all of the asymmetric tests from the command
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    69
 * line, uncomment this next section.
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    70
#ifndef _DEBUG
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    71
	CTestSetup::CreateAndRunTestsL(theTestTypes, _L("c:\\tasymmetric\\asymmetricPerformance.txt"),
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    72
		_L("c:\\tasymmetric\\asymmetricPerformance.log"));	
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    73
#endif
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    74
*/
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    75
    }
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    76
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    77
GLDEF_C TInt E32Main() // main function called by E32
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    78
    {
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    79
	__UHEAP_MARK;
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    80
	CTrapCleanup* cleanup = CTrapCleanup::New(); // get clean-up stack
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    81
	CPerformance::NewL();
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    82
	TRAPD(error, callExampleL());
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    83
	CPerformance::ClosePerformanceTester();
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    84
	__ASSERT_ALWAYS(!error,User::Panic(_L("tasymmetricmain"),error));
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    85
	delete cleanup; // destroy clean-up stack
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    86
	__UHEAP_MARKEND;
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    87
	return 0;
de46a57f75fb 201023_02
hgs
parents:
diff changeset
    88
    }