|
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: Dll entry point functions |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <e32uid.h> |
|
20 |
|
21 #ifndef EKA2 |
|
22 GLDEF_C TInt E32Dll(TDllReason /*aReason*/) |
|
23 // DLL entry point |
|
24 { |
|
25 return(KErrNone); |
|
26 } |
|
27 #endif |
|
28 |
|
29 // EXTERNAL FUNCTION PROTOTYPES |
|
30 extern "C" char* _crypt (const char *, const char *); |
|
31 extern "C" void _setkey (const char *); |
|
32 extern "C" void _encrypt (char [], int); |
|
33 |
|
34 extern "C" |
|
35 { |
|
36 |
|
37 // ----------------------------------------------------------------------------- |
|
38 // function_name: crypt |
|
39 // |
|
40 // Encodes a constant using the first argument to this function as the key to |
|
41 // encoding algorithms (DES or MD5) |
|
42 // |
|
43 // Returns: pointer to the buffer containing the encoded string |
|
44 // ----------------------------------------------------------------------------- |
|
45 // |
|
46 EXPORT_C char *crypt(const char *key, const char *salt) |
|
47 { |
|
48 return _crypt (key, salt); |
|
49 } |
|
50 |
|
51 // ----------------------------------------------------------------------------- |
|
52 // function_name: setkey |
|
53 // |
|
54 // Sets the key to used within the encryption/decryption algorithms |
|
55 // |
|
56 // Returns: void |
|
57 // ----------------------------------------------------------------------------- |
|
58 // |
|
59 EXPORT_C void setkey(const char *key) |
|
60 { |
|
61 _setkey(key); |
|
62 } |
|
63 |
|
64 // ----------------------------------------------------------------------------- |
|
65 // function_name: encrypt |
|
66 // |
|
67 // Encrypts or decrypts the contents of bit vector in place. Type of operation |
|
68 // depends on the edflag argument |
|
69 // |
|
70 // Returns: void |
|
71 // ----------------------------------------------------------------------------- |
|
72 // |
|
73 EXPORT_C void encrypt(char block[], int edflag) |
|
74 { |
|
75 // encrypt() does not change the setting of errno if successful. |
|
76 // However, if errno is non-zero on return, an error has |
|
77 // occurred. |
|
78 _encrypt (block, edflag); |
|
79 } |
|
80 } |