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