os/security/cryptoplugins/cryptospiplugins/test/dummyecchwplugin/src/pluginentry.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) 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
#include "pluginentry.h"
sl@0
    20
#include "pluginconfig.h"
sl@0
    21
#include "dummyeccimpl.h"
sl@0
    22
#include "dummyeccsignerimpl.h"
sl@0
    23
#include "keys.h"
sl@0
    24
#include <cryptospi/cryptospidef.h>
sl@0
    25
sl@0
    26
using namespace DummyEccHwCrypto;
sl@0
    27
sl@0
    28
EXPORT_C const TCharacteristics** CCryptoPluginEntry::Enumerate(
sl@0
    29
        TUid aInterface, TInt& aNumPlugins)
sl@0
    30
    {
sl@0
    31
    const TCharacteristics** ptr(0);
sl@0
    32
sl@0
    33
    switch (aInterface.iUid)
sl@0
    34
        {
sl@0
    35
        case KAsymmetricCipherInterface:
sl@0
    36
            {
sl@0
    37
            aNumPlugins = sizeof(KAsymmetricCipherCharacteristics)
sl@0
    38
                    / sizeof(TAsymmetricCipherCharacteristics*);
sl@0
    39
            ptr
sl@0
    40
                    = (const TCharacteristics**) &KAsymmetricCipherCharacteristics[0];
sl@0
    41
            }
sl@0
    42
            break;
sl@0
    43
sl@0
    44
        case KSignerInterface:
sl@0
    45
            {
sl@0
    46
            aNumPlugins = sizeof(KSignerCharacteristics)
sl@0
    47
                    / sizeof(TAsymmetricSignatureCharacteristics*);
sl@0
    48
            ptr = (const TCharacteristics**) &KSignerCharacteristics[0];
sl@0
    49
            }
sl@0
    50
            break;
sl@0
    51
sl@0
    52
        default:
sl@0
    53
            aNumPlugins = 0;
sl@0
    54
        }
sl@0
    55
sl@0
    56
    return ptr;
sl@0
    57
    }
sl@0
    58
sl@0
    59
EXPORT_C void CCryptoPluginEntry::GetExtendedCharacteristicsL(
sl@0
    60
        TUid /* aImplementationUid */, CExtendedCharacteristics*& /* aExt */)
sl@0
    61
    {
sl@0
    62
    User::Leave(KErrNotSupported);
sl@0
    63
    }   
sl@0
    64
sl@0
    65
EXPORT_C void CCryptoPluginEntry::CreateAsymmetricCipherL(
sl@0
    66
        MAsymmetricCipher*& aPlugin, TUid aImplementationId,
sl@0
    67
        const CKey& aKey, TUid aCryptoMode, TUid aPaddingMode,
sl@0
    68
        const CCryptoParams* /* aAlgorithmParams */)
sl@0
    69
    {
sl@0
    70
    switch (aImplementationId.iUid)
sl@0
    71
        {
sl@0
    72
        case KCryptoPluginEccCipher:
sl@0
    73
            {
sl@0
    74
            aPlugin = CDummyECCCipherImpl::NewL(aKey, aCryptoMode, aPaddingMode);
sl@0
    75
            }
sl@0
    76
            break;
sl@0
    77
sl@0
    78
        default:
sl@0
    79
            User::Leave(KErrNotFound);
sl@0
    80
        }
sl@0
    81
    }
sl@0
    82
sl@0
    83
EXPORT_C void CCryptoPluginEntry::CreateAsymmetricSignerL(
sl@0
    84
        MSigner*& aPlugin, TUid aImplementationId,
sl@0
    85
        const CKey& aKey, TUid aPaddingMode, const CCryptoParams* /* aAlgorithmParams */)
sl@0
    86
    {
sl@0
    87
    switch (aImplementationId.iUid)
sl@0
    88
        {
sl@0
    89
        case KCryptoPluginEccSigner:
sl@0
    90
            {
sl@0
    91
            aPlugin = CDummyECCSignerImpl::NewL(aKey, aPaddingMode);
sl@0
    92
            }
sl@0
    93
            break;
sl@0
    94
sl@0
    95
        default:
sl@0
    96
            User::Leave(KErrNotFound);
sl@0
    97
        }
sl@0
    98
    }
sl@0
    99
sl@0
   100
EXPORT_C void CCryptoPluginEntry::CreateAsymmetricVerifierL(
sl@0
   101
        MVerifier*& /*aPlugin*/, TUid /*aImplementationId*/,
sl@0
   102
        const CKey& /*aKey*/, TUid /*aPaddingMode*/, const CCryptoParams* /*aAlgorithmParams*/)
sl@0
   103
    {
sl@0
   104
    User::Leave(KErrNotFound);
sl@0
   105
    }
sl@0
   106
sl@0
   107
EXPORT_C void CCryptoPluginEntry::CreateHashL(MHash*& /*aPlugin*/,
sl@0
   108
        TUid /*aImplementationId*/, TUid /*aOperationMode*/,
sl@0
   109
        const CKey* /*aKey*/, const CCryptoParams* /*aAlgorithmParams*/)
sl@0
   110
    {
sl@0
   111
    User::Leave(KErrNotFound);
sl@0
   112
    }
sl@0
   113
sl@0
   114
EXPORT_C void CCryptoPluginEntry::CreateKeyAgreementL(
sl@0
   115
        MKeyAgreement*& /*aPlugin*/, TUid /*aImplementationId*/,
sl@0
   116
        const CKey& /*aPrivateKey*/, const CCryptoParams* /*aAlgorithmParams*/)
sl@0
   117
    {
sl@0
   118
    User::Leave(KErrNotFound);
sl@0
   119
    }
sl@0
   120
sl@0
   121
EXPORT_C void CCryptoPluginEntry::CreateKeyPairGeneratorL(
sl@0
   122
        MKeyPairGenerator*& /*aPlugin*/, TUid /*aImplementationId*/,
sl@0
   123
        const CCryptoParams* /*aAlgorithmParams*/)
sl@0
   124
    {
sl@0
   125
    User::Leave(KErrNotFound);
sl@0
   126
    }
sl@0
   127
sl@0
   128
EXPORT_C void CCryptoPluginEntry::CreateRandomL(MRandom*& /*aPlugin*/,
sl@0
   129
        TUid /*aImplementationId*/, const CCryptoParams* /*aAlgorithmParams*/)
sl@0
   130
    {
sl@0
   131
    User::Leave(KErrNotFound);
sl@0
   132
    }
sl@0
   133
sl@0
   134
EXPORT_C void CCryptoPluginEntry::CreateSymmetricCipherL(
sl@0
   135
        MSymmetricCipher*& /*aPlugin*/, TUid /*aImplementationId*/, const CKey& /*aKey*/,
sl@0
   136
        TUid /*aCryptoMode*/, TUid /*aOperationMode*/, TUid /*aPadding*/,
sl@0
   137
        const CCryptoParams* /*aAlgorithmParams*/)
sl@0
   138
    {
sl@0
   139
    User::Leave(KErrNotSupported);
sl@0
   140
    }
sl@0
   141
// End of file