os/security/cryptoplugins/cryptospiplugins/test/h4drv/crypto_h4_plugin/pluginentry.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
/*
sl@0
     2
* Copyright (c) 2007-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
/**
sl@0
    20
 @file
sl@0
    21
 @internalComponent
sl@0
    22
 @released
sl@0
    23
*/
sl@0
    24
#include "pluginentry.h"
sl@0
    25
#include "pluginconfig.h"
sl@0
    26
#include "keys.h"
sl@0
    27
#include "randomimpl.h"
sl@0
    28
#include "rijndaelimpl.h"
sl@0
    29
#include "randomimpl.h"
sl@0
    30
#include <cryptospi/cryptospidef.h>
sl@0
    31
sl@0
    32
sl@0
    33
using namespace HwCrypto;
sl@0
    34
sl@0
    35
EXPORT_C const TCharacteristics** CCryptoPluginEntry::Enumerate(TUid aInterface, TInt& aNumPlugins)
sl@0
    36
	{
sl@0
    37
	const TCharacteristics** ptr(0);
sl@0
    38
	aNumPlugins = 0;
sl@0
    39
sl@0
    40
	switch (aInterface.iUid)
sl@0
    41
		{
sl@0
    42
	case KRandomInterface:
sl@0
    43
		{
sl@0
    44
		aNumPlugins=sizeof(KRandomCharacteristics)/sizeof(TRandomCharacteristics*);
sl@0
    45
		ptr= (const TCharacteristics**) &KRandomCharacteristics[0];			
sl@0
    46
		}
sl@0
    47
		break;
sl@0
    48
sl@0
    49
	case KSymmetricCipherInterface:
sl@0
    50
		{
sl@0
    51
		aNumPlugins=sizeof(KSymmetricCipherCharacteristics)/sizeof(TSymmetricCipherCharacteristics*);
sl@0
    52
		ptr = (const TCharacteristics**) &KSymmetricCipherCharacteristics[0];			
sl@0
    53
		}
sl@0
    54
		break;
sl@0
    55
sl@0
    56
	default:;
sl@0
    57
		}
sl@0
    58
		
sl@0
    59
	return ptr;
sl@0
    60
	}
sl@0
    61
sl@0
    62
EXPORT_C void CCryptoPluginEntry::GetExtendedCharacteristicsL(TUid aImplementationUid, CExtendedCharacteristics*& aExt)
sl@0
    63
	{
sl@0
    64
	switch (aImplementationUid.iUid)
sl@0
    65
		{
sl@0
    66
	case KCryptoPluginRandom:          
sl@0
    67
		aExt=CRandomImpl::StaticGetExtendedCharacteristicsL();
sl@0
    68
		break;
sl@0
    69
	case KCryptoPluginAes:
sl@0
    70
		aExt=CH4RijndaelImpl::StaticGetExtendedCharacteristicsL();
sl@0
    71
		break;
sl@0
    72
	default:
sl@0
    73
		User::Leave(KErrNotSupported);
sl@0
    74
		}
sl@0
    75
	}	
sl@0
    76
	
sl@0
    77
EXPORT_C void CCryptoPluginEntry::CreateAsymmetricCipherL(MAsymmetricCipher*& /*aPlugin*/,
sl@0
    78
														  TUid /*aImplementationId*/,
sl@0
    79
														  const CKey& /*aKey*/,
sl@0
    80
														  TUid /*aCryptoMode*/,
sl@0
    81
														  TUid /*aPaddingMode*/,
sl@0
    82
														  const CCryptoParams* /*aAlgorithmParams*/)
sl@0
    83
	{
sl@0
    84
	User::Leave(KErrNotFound);
sl@0
    85
	}
sl@0
    86
														
sl@0
    87
														
sl@0
    88
														
sl@0
    89
EXPORT_C void CCryptoPluginEntry::CreateAsymmetricSignerL(MSigner*& /*aPlugin*/,
sl@0
    90
														  TUid /*aImplementationId*/,
sl@0
    91
														  const CKey& /*aKey*/,
sl@0
    92
														  TUid /*aPaddingMode*/,
sl@0
    93
														const CCryptoParams* /*aAlgorithmParams*/)
sl@0
    94
	{
sl@0
    95
	User::Leave(KErrNotFound);
sl@0
    96
	}
sl@0
    97
														
sl@0
    98
														
sl@0
    99
EXPORT_C void CCryptoPluginEntry::CreateAsymmetricVerifierL(MVerifier*& /*aPlugin*/,
sl@0
   100
															TUid /*aImplementationId*/,
sl@0
   101
															const CKey& /*aKey*/,
sl@0
   102
															TUid /*aPaddingMode*/,
sl@0
   103
															const CCryptoParams* /*aAlgorithmParams*/)
sl@0
   104
	{
sl@0
   105
	User::Leave(KErrNotFound);
sl@0
   106
	}																
sl@0
   107
sl@0
   108
EXPORT_C void CCryptoPluginEntry::CreateHashL(MHash*& /*aPlugin*/,
sl@0
   109
											  TUid /*aImplementationId*/,
sl@0
   110
											  TUid /*aOperationMode*/,
sl@0
   111
											  const CKey* /*aKey*/,											
sl@0
   112
											const CCryptoParams* /*aAlgorithmParams*/)
sl@0
   113
	{
sl@0
   114
	User::Leave(KErrNotFound);
sl@0
   115
	}
sl@0
   116
	
sl@0
   117
EXPORT_C void CCryptoPluginEntry::CreateKeyAgreementL(MKeyAgreement*& /*aPlugin*/,
sl@0
   118
													  TUid /*aImplementationId*/,
sl@0
   119
													  const CKey& /*aPrivateKey*/,
sl@0
   120
													  const CCryptoParams* /*aAlgorithmParams*/)
sl@0
   121
	{
sl@0
   122
	User::Leave(KErrNotFound);
sl@0
   123
	}
sl@0
   124
sl@0
   125
EXPORT_C void CCryptoPluginEntry::CreateKeyPairGeneratorL(MKeyPairGenerator*& /*aPlugin*/,
sl@0
   126
														  TUid /*aImplementationId*/,
sl@0
   127
														  const CCryptoParams* /*aAlgorithmParams*/)
sl@0
   128
	{
sl@0
   129
	User::Leave(KErrNotFound);
sl@0
   130
	}
sl@0
   131
	
sl@0
   132
														
sl@0
   133
EXPORT_C void CCryptoPluginEntry::CreateRandomL(MRandom*& aPlugin,
sl@0
   134
												TUid /*aImplementationId*/,
sl@0
   135
												const CCryptoParams* /*aAlgorithmParams*/)
sl@0
   136
	{
sl@0
   137
	aPlugin=CRandomImpl::NewL();
sl@0
   138
	//User::Leave(KErrNotFound);
sl@0
   139
	}	
sl@0
   140
sl@0
   141
EXPORT_C void CCryptoPluginEntry::CreateSymmetricCipherL(MSymmetricCipher*& aPlugin,
sl@0
   142
														 TUid aImplementationId,
sl@0
   143
														 const CKey& aKey,
sl@0
   144
														 TUid aCryptoMode,
sl@0
   145
														 TUid aOperationMode,
sl@0
   146
														 TUid aPadding,
sl@0
   147
														 const CCryptoParams* /*aAlgorithmParams*/)
sl@0
   148
	{
sl@0
   149
	switch (aImplementationId.iUid)
sl@0
   150
		{
sl@0
   151
	case KCryptoPluginAes:
sl@0
   152
		{
sl@0
   153
		aPlugin=CH4RijndaelImpl::NewL(aKey, aCryptoMode, aOperationMode, aPadding);
sl@0
   154
		//User::Leave(KErrNotFound);
sl@0
   155
		}	
sl@0
   156
		break;
sl@0
   157
		
sl@0
   158
	default:
sl@0
   159
		User::Leave(KErrNotFound);
sl@0
   160
		}
sl@0
   161
	}												
sl@0
   162
														
sl@0
   163
// End of file