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