os/security/crypto/weakcryptospi/source/spi/cryptospistateapi.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) 2006-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
* cryptospistate client API implemetation
sl@0
    16
* crypto spi API implementation
sl@0
    17
*
sl@0
    18
*/
sl@0
    19
sl@0
    20
sl@0
    21
/**
sl@0
    22
 @file 
sl@0
    23
*/
sl@0
    24
sl@0
    25
#include <cryptospi/cryptospistateapi.h>
sl@0
    26
#include <cryptospi/pluginselectorbase.h>
sl@0
    27
#include <cryptospi/cryptospidef.h>
sl@0
    28
#include "cryptospiutil.h"
sl@0
    29
#include <cryptospi/pluginentrydef.h>
sl@0
    30
sl@0
    31
using namespace CryptoSpi;
sl@0
    32
sl@0
    33
//
sl@0
    34
// Implementation of CryptoSpiStateApi
sl@0
    35
//
sl@0
    36
sl@0
    37
EXPORT_C void CCryptoSpiStateApi::SetSelector(MPluginSelector* aSelector)
sl@0
    38
	{
sl@0
    39
	Dll::SetTls(aSelector);
sl@0
    40
	}
sl@0
    41
sl@0
    42
EXPORT_C void CCryptoSpiStateApi::UnsetSelector()
sl@0
    43
	{
sl@0
    44
	Dll::SetTls(0);
sl@0
    45
	}
sl@0
    46
sl@0
    47
EXPORT_C void CCryptoSpiStateApi::EnumerateCharacteristicsL(RPointerArray<CCharacteristicsAndPluginName>& aCharacteristicsDll, TInt32 aInterface, TBool aExtended)
sl@0
    48
	{
sl@0
    49
	if (aInterface==0)
sl@0
    50
		{
sl@0
    51
		TInt interfaceCount=sizeof(KInterfacesUids)/sizeof(KInterfacesUids[0]);
sl@0
    52
		for (TInt i=0;i<interfaceCount;i++)
sl@0
    53
			{
sl@0
    54
			CryptoSpiUtil::RetrieveCharacteristicsL(KInterfacesUids[i].iUid, aCharacteristicsDll);
sl@0
    55
			}
sl@0
    56
		}
sl@0
    57
	else
sl@0
    58
		{
sl@0
    59
		CryptoSpiUtil::RetrieveCharacteristicsL(aInterface, aCharacteristicsDll);
sl@0
    60
		}
sl@0
    61
		
sl@0
    62
	if (aExtended)
sl@0
    63
		{
sl@0
    64
		TInt count=aCharacteristicsDll.Count();
sl@0
    65
		for (TInt i=0;i<count;i++)
sl@0
    66
			{
sl@0
    67
			RLibrary lib;
sl@0
    68
			CryptoSpiUtil::LoadPluginDllLC(lib, aCharacteristicsDll[i]->iDllName);
sl@0
    69
			GetExtendedCharacteristicsFuncL getExtendedCharFuncL=(GetExtendedCharacteristicsFuncL)lib.Lookup(EGetExtendedCharacteristicOrdinal);
sl@0
    70
			if (getExtendedCharFuncL)
sl@0
    71
				{
sl@0
    72
				TUid implementationUid={aCharacteristicsDll[i]->iCharacteristic->iImplementationUid};
sl@0
    73
				getExtendedCharFuncL(implementationUid, aCharacteristicsDll[i]->iExtendedCharacteristic);
sl@0
    74
				}
sl@0
    75
			CleanupStack::PopAndDestroy(&lib);
sl@0
    76
			}
sl@0
    77
		}
sl@0
    78
	}
sl@0
    79
sl@0
    80
sl@0
    81
sl@0
    82
sl@0
    83
sl@0
    84
sl@0
    85
sl@0
    86
sl@0
    87
sl@0
    88
sl@0
    89