stdlibs/libcrypt/src/wsd_solution.cpp
changeset 0 e4d67989cc36
equal deleted inserted replaced
-1:000000000000 0:e4d67989cc36
       
     1 /*
       
     2 * Copyright (c) 2005-2006 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 "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:  Contains the WSD solution
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #define EMULATOR ((defined(__WINS__) || defined(__WINSCW__)))
       
    21 
       
    22 #if EMULATOR
       
    23 
       
    24 #include <e32std.h>
       
    25 
       
    26 #include "wsd_solution.h"
       
    27 #include "pls.h" // For emulator WSD API 
       
    28 
       
    29 const TUid KLibdlUid3 = {0x10281F2D};
       
    30 
       
    31 LOCAL_C TInt InitializeWsd(TLibcryptWsd *aData)
       
    32 {
       
    33 	unsigned int bits32Initializer[32] = 
       
    34 	{
       
    35 		0x80000000, 0x40000000, 0x20000000, 0x10000000,
       
    36 		0x08000000, 0x04000000, 0x02000000, 0x01000000,
       
    37 		0x00800000, 0x00400000, 0x00200000, 0x00100000,
       
    38 		0x00080000, 0x00040000, 0x00020000, 0x00010000,
       
    39 		0x00008000, 0x00004000, 0x00002000, 0x00001000,
       
    40 		0x00000800, 0x00000400, 0x00000200, 0x00000100,
       
    41 		0x00000080, 0x00000040, 0x00000020, 0x00000010,
       
    42 		0x00000008, 0x00000004, 0x00000002, 0x00000001
       
    43 	};
       
    44 	aData->des_initialised = 0;
       
    45 	
       
    46 	aData->m_sbox = NULL;
       
    47 	aData->psbox = NULL;
       
    48 	
       
    49 	aData->ip_maskl = NULL;
       
    50 	aData->ip_maskr = NULL;
       
    51 	
       
    52 	aData->fp_maskl = NULL;
       
    53 	aData->fp_maskr = NULL;
       
    54 	
       
    55 	aData->key_perm_maskl = NULL;
       
    56 	aData->key_perm_maskr = NULL;
       
    57 	
       
    58 	aData->comp_maskl = NULL;
       
    59 	aData->comp_maskr = NULL;
       
    60 	
       
    61 	aData->old_rawkey0 = 0;
       
    62 	aData->old_rawkey1 = 0;
       
    63 	
       
    64 	for(int i=0 ; i<32 ; ++i)
       
    65 	{
       
    66 		(aData->bits32)[i] = bits32Initializer[i];
       
    67 	}
       
    68 	
       
    69 	// Initialize desKey array
       
    70 	for(int j=0 ; j<64 ; ++j)
       
    71 	{
       
    72 		(aData->desKey)[j] = 0;
       
    73 	}
       
    74 	aData->bSetkeyInvoked = 0;
       
    75 	
       
    76 	return KErrNone;
       
    77 }
       
    78 
       
    79 extern "C" TLibcryptWsd* GetGlobals()
       
    80 {
       
    81 	// Access the PLS of this process
       
    82 	TLibcryptWsd *p = Pls<TLibcryptWsd>(KLibdlUid3,InitializeWsd);
       
    83 	return p;
       
    84 }
       
    85 
       
    86 #endif