Release 1.5.29.
[wine] / dlls / advapi32 / tests / crypt_lmhash.c
1 /*
2  * Unit tests for SystemFunctionXXX (LMHash?)
3  *
4  * Copyright 2004 Hans Leidekker
5  * Copyright 2006 Mike McCormack
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20  */
21
22 #include <stdio.h>
23
24 #include "ntstatus.h"
25 #define WIN32_NO_STATUS
26 #include "wine/test.h"
27 #include "windef.h"
28 #include "winbase.h"
29 #include "winternl.h"
30
31 struct ustring {
32     DWORD Length;
33     DWORD MaximumLength;
34     unsigned char *Buffer;
35 };
36
37 typedef int (WINAPI *descrypt)(unsigned char *, unsigned char *, unsigned char *);
38 static NTSTATUS (WINAPI *pSystemFunction001)(const BYTE *, const BYTE *, LPBYTE);
39 static NTSTATUS (WINAPI *pSystemFunction002)(const BYTE *, const BYTE *, LPBYTE);
40 static NTSTATUS (WINAPI *pSystemFunction003)(const BYTE *, LPBYTE);
41 static NTSTATUS (WINAPI *pSystemFunction004)(const struct ustring *, const struct ustring *, struct ustring *);
42 static NTSTATUS (WINAPI *pSystemFunction005)(const struct ustring *, const struct ustring *, struct ustring *);
43 static VOID (WINAPI *pSystemFunction006)( PCSTR passwd, PSTR lmhash );
44 static NTSTATUS (WINAPI *pSystemFunction008)(const BYTE *, const BYTE *, LPBYTE);
45 static NTSTATUS (WINAPI *pSystemFunction009)(const BYTE *, const BYTE *, LPBYTE);
46 static NTSTATUS (WINAPI *pSystemFunction032)(struct ustring *, const struct ustring *);
47
48 /* encrypt two blocks */
49 static descrypt pSystemFunction012;
50 static descrypt pSystemFunction014;
51 static descrypt pSystemFunction016;
52 static descrypt pSystemFunction018;
53 static descrypt pSystemFunction020;
54 static descrypt pSystemFunction022;
55
56 /* decrypt two blocks */
57 static descrypt pSystemFunction013;
58 static descrypt pSystemFunction015;
59 static descrypt pSystemFunction017;
60 static descrypt pSystemFunction019;
61 static descrypt pSystemFunction021;
62 static descrypt pSystemFunction023;
63
64 /* encrypt two blocks with a 32bit key */
65 static descrypt pSystemFunction024;
66 static descrypt pSystemFunction025;
67
68 /* decrypt two blocks with a 32bit key */
69 static descrypt pSystemFunction026;
70 static descrypt pSystemFunction027;
71
72 typedef int (WINAPI *memcmpfunc)(unsigned char *, unsigned char *);
73 static memcmpfunc pSystemFunction030;
74 static memcmpfunc pSystemFunction031;
75
76 static void test_SystemFunction006(void)
77 {
78     char lmhash[16 + 1];
79
80     char passwd[] = { 's','e','c','r','e','t', 0, 0, 0, 0, 0, 0, 0, 0 };
81     unsigned char expect[] = 
82         { 0x85, 0xf5, 0x28, 0x9f, 0x09, 0xdc, 0xa7, 0xeb,
83           0xaa, 0xd3, 0xb4, 0x35, 0xb5, 0x14, 0x04, 0xee };
84
85     pSystemFunction006( passwd, lmhash );
86
87     ok( !memcmp( lmhash, expect, sizeof(expect) ),
88         "lmhash: %02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x\n",
89         lmhash[0], lmhash[1], lmhash[2], lmhash[3], lmhash[4], lmhash[5],
90         lmhash[6], lmhash[7], lmhash[8], lmhash[9], lmhash[10], lmhash[11],
91         lmhash[12], lmhash[13], lmhash[14], lmhash[15] );
92 }
93
94 static void test_SystemFunction008(void)
95 {
96     /* example data from http://davenport.sourceforge.net/ntlm.html */
97     unsigned char hash[0x40] = {
98         0xff, 0x37, 0x50, 0xbc, 0xc2, 0xb2, 0x24, 0x12,
99         0xc2, 0x26, 0x5b, 0x23, 0x73, 0x4e, 0x0d, 0xac };
100     unsigned char challenge[0x40] = {
101         0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef };
102     unsigned char expected[0x18] = {
103         0xc3, 0x37, 0xcd, 0x5c, 0xbd, 0x44, 0xfc, 0x97,
104         0x82, 0xa6, 0x67, 0xaf, 0x6d, 0x42, 0x7c, 0x6d,
105         0xe6, 0x7c, 0x20, 0xc2, 0xd3, 0xe7, 0x7c, 0x56 };
106     unsigned char output[0x18];
107     NTSTATUS r;
108
109     r = pSystemFunction008(0,0,0);
110     ok( r == STATUS_UNSUCCESSFUL, "wrong error code\n");
111
112     r = pSystemFunction008(challenge,0,0);
113     ok( r == STATUS_UNSUCCESSFUL, "wrong error code\n");
114
115     r = pSystemFunction008(challenge, hash, 0);
116     ok( r == STATUS_UNSUCCESSFUL, "wrong error code\n");
117
118     /* crashes */
119     if (0)
120     {
121         r = pSystemFunction008(challenge, 0, output);
122         ok( r == STATUS_UNSUCCESSFUL, "wrong error code\n");
123     }
124
125     r = pSystemFunction008(0, 0, output);
126     ok( r == STATUS_UNSUCCESSFUL, "wrong error code\n");
127
128     memset(output, 0, sizeof output);
129     r = pSystemFunction008(challenge, hash, output);
130     ok( r == STATUS_SUCCESS, "wrong error code\n");
131
132     ok( !memcmp(output, expected, sizeof expected), "response wrong\n");
133 }
134
135 static void test_SystemFunction001(void)
136 {
137     unsigned char key[8] = { 0xff, 0x37, 0x50, 0xbc, 0xc2, 0xb2, 0x24, 0 };
138     unsigned char data[8] = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef };
139     unsigned char expected[8] = { 0xc3, 0x37, 0xcd, 0x5c, 0xbd, 0x44, 0xfc, 0x97 };
140     unsigned char output[16];
141     NTSTATUS r;
142
143     r = pSystemFunction001(0,0,0);
144     ok( r == STATUS_UNSUCCESSFUL, "wrong error code\n");
145
146     memset(output, 0, sizeof output);
147
148     r = pSystemFunction001(data,key,output);
149     ok( r == STATUS_SUCCESS, "wrong error code\n");
150
151     ok(!memcmp(output, expected, sizeof expected), "response wrong\n");
152 }
153
154 static void test_SystemFunction002(void)
155 {
156     /* reverse of SystemFunction001 */
157     unsigned char key[8] = { 0xff, 0x37, 0x50, 0xbc, 0xc2, 0xb2, 0x24, 0 };
158     unsigned char expected[8] = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef };
159     unsigned char data[8] = { 0xc3, 0x37, 0xcd, 0x5c, 0xbd, 0x44, 0xfc, 0x97 };
160     unsigned char output[8];
161     int r;
162
163     memset(output, 0, sizeof output);
164     r = pSystemFunction002(data, key, output);
165     ok(r == STATUS_SUCCESS, "function failed\n");
166     ok(!memcmp(output, expected, sizeof expected), "response wrong\n");
167 }
168
169 static void test_SystemFunction032(void)
170 {
171     struct ustring key, data;
172     unsigned char szKey[] = { 'f','o','o',0 };
173     unsigned char szData[8] = { 'b','a','r',0 };
174     unsigned char expected[] = {0x28, 0xb9, 0xf8, 0xe1};
175     int r;
176
177     /* crashes:    pSystemFunction032(NULL,NULL); */
178
179     key.Buffer = szKey;
180     key.Length = sizeof szKey;
181     key.MaximumLength = key.Length;
182
183     data.Buffer = szData;
184     data.Length = 4;
185     data.MaximumLength = 8;
186
187     r = pSystemFunction032(&data, &key);
188     ok(r == STATUS_SUCCESS, "function failed\n");
189
190     ok(!memcmp(expected, data.Buffer, data.Length), "wrong result\n");
191 }
192
193 static void test_SystemFunction003(void)
194 {
195     unsigned char output[8], data[8];
196     unsigned char key[7] = { 0xff, 0x37, 0x50, 0xbc, 0xc2, 0xb2, 0x24 };
197     unsigned char exp1[8] = { 0x9d, 0x21, 0xc8, 0x86, 0x6c, 0x21, 0xcf, 0x43 };
198     char exp2[] = "KGS!@#$%";
199     int r;
200
201     r = pSystemFunction003(NULL, NULL);
202     ok(r == STATUS_UNSUCCESSFUL, "function failed\n");
203
204     r = pSystemFunction003(key, NULL);
205     ok(r == STATUS_UNSUCCESSFUL, "function failed\n");
206
207     memset(data, 0, sizeof data);
208     r = pSystemFunction003(key, data);
209     ok(r == STATUS_SUCCESS, "function failed\n");
210     ok( !memcmp(exp1, data, sizeof data), "decrypted message wrong\n");
211
212     memset(output, 0, sizeof output);
213     r = pSystemFunction002(data, key, output);
214     ok(r == STATUS_SUCCESS, "function failed\n");
215
216     ok( !memcmp(exp2, output, sizeof output), "decrypted message wrong\n");
217 }
218
219 static void test_SystemFunction004(void)
220 {
221     unsigned char inbuf[0x100], keybuf[0x100], resbuf[0x100];
222     unsigned char output[8];
223     int r;
224     struct ustring in, key, out;
225
226     /* crash 
227     r = pSystemFunction004(NULL, NULL, NULL);
228     ok(r == STATUS_UNSUCCESSFUL, "function failed\n");
229     */
230
231     memset(inbuf, 0, sizeof inbuf);
232     memset(keybuf, 0, sizeof keybuf);
233     memset(resbuf, 0, sizeof resbuf);
234
235     in.Buffer = NULL;
236     in.Length = in.MaximumLength = 0;
237
238     key.Buffer = NULL;
239     key.Length = key.MaximumLength = 0;
240
241     out.Buffer = NULL;
242     out.Length = out.MaximumLength = 0;
243
244     r = pSystemFunction004(&in, &key, &out);
245     ok(r == STATUS_INVALID_PARAMETER_2, "function failed\n");
246
247     key.Buffer = keybuf;
248     key.Length = 0x100;
249     key.MaximumLength = 0x100;
250
251     r = pSystemFunction004(&in, &key, &out);
252     ok(r == STATUS_BUFFER_TOO_SMALL, "function failed\n");
253
254     in.Buffer = inbuf;
255     in.Length = 0x0c;
256     in.MaximumLength = 0;
257
258     /* add two identical blocks... */
259     inbuf[0] = 1;
260     inbuf[1] = 2;
261     inbuf[2] = 3;
262     inbuf[3] = 4;
263
264     inbuf[8] = 1;
265     inbuf[9] = 2;
266     inbuf[10] = 3;
267     inbuf[11] = 4;
268
269     /* check that the Length field is really obeyed */
270     keybuf[6] = 1;
271
272     key.Buffer = keybuf;
273     key.Length = 6;
274     key.MaximumLength = 0;
275
276     keybuf[1] = 0x33;
277
278     out.Buffer = resbuf;
279     out.Length = 0;
280     out.MaximumLength = 0x40;
281     r = pSystemFunction004(&in, &key, &out);
282     ok(r == STATUS_SUCCESS, "function failed\n");
283
284     keybuf[6] = 0;
285
286     memset(output, 0, sizeof output);
287     r = pSystemFunction002(out.Buffer, key.Buffer, output);
288     ok(r == STATUS_SUCCESS, "function failed\n");
289
290     ok(((unsigned int*)output)[0] == in.Length, "crypted length wrong\n");
291     ok(((unsigned int*)output)[1] == 1, "crypted value wrong\n");
292
293     memset(output, 0, sizeof output);
294     r = pSystemFunction002(out.Buffer+8, key.Buffer, output);
295     ok(r == STATUS_SUCCESS, "function failed\n");
296     ok(!memcmp(output, inbuf, sizeof output), "crypted data wrong\n");
297
298     memset(output, 0, sizeof output);
299     r = pSystemFunction002(out.Buffer+16, key.Buffer, output);
300     ok(r == STATUS_SUCCESS, "function failed\n");
301     ok(!memcmp(output, inbuf, sizeof output), "crypted data wrong\n");
302 }
303
304 static void test_SystemFunction005(void)
305 {
306     char output[0x40], result[0x40];
307     int r;
308     struct ustring in, key, out, res;
309     static char datastr[] = "twinkle twinkle little star";
310     static char keystr[]  = "byolnim";
311
312     in.Buffer = (unsigned char *)datastr;
313     in.Length = strlen(datastr);
314     in.MaximumLength = 0;
315
316     key.Buffer = (unsigned char *)keystr;
317     key.Length = strlen(keystr);
318     key.MaximumLength = 0;
319
320     out.Buffer = (unsigned char *)output;
321     out.Length = out.MaximumLength = sizeof output;
322
323     r = pSystemFunction004(&in, &key, &out);
324     ok(r == STATUS_SUCCESS, "function failed\n");
325
326     memset(result, 0, sizeof result);
327     res.Buffer = (unsigned char *)result;
328     res.Length = 0;
329     res.MaximumLength = sizeof result;
330
331     r = pSystemFunction005(&out, &key, &res);
332     ok(r == STATUS_SUCCESS, "function failed\n");
333
334     r = pSystemFunction005(&out, &key, &res);
335     ok(r == STATUS_SUCCESS, "function failed\n");
336
337     ok(res.Length == in.Length, "Length wrong\n");
338     ok(!memcmp(res.Buffer, in.Buffer, in.Length), "data wrong\n");
339
340     out.Length = 0;
341     out.MaximumLength = 0;
342     r = pSystemFunction005(&out, &key, &res);
343     ok(r == STATUS_SUCCESS ||
344        r == STATUS_INVALID_PARAMETER_1, /* Vista */
345        "Expected STATUS_SUCCESS or STATUS_INVALID_PARAMETER_1, got %08x\n", r);
346
347     ok(res.Length == in.Length, "Length wrong\n");
348     ok(!memcmp(res.Buffer, in.Buffer, in.Length), "data wrong\n");
349
350     res.MaximumLength = 0;
351     r = pSystemFunction005(&out, &key, &res);
352     ok(r == STATUS_BUFFER_TOO_SMALL ||
353        r == STATUS_INVALID_PARAMETER_1, /* Vista */
354        "Expected STATUS_BUFFER_TOO_SMALL or STATUS_INVALID_PARAMETER_1, got %08x\n", r);
355
356     key.Length = 1;
357     r = pSystemFunction005(&out, &key, &res);
358     ok(r == STATUS_UNKNOWN_REVISION ||
359        r == STATUS_INVALID_PARAMETER_1, /* Vista */
360        "Expected STATUS_UNKNOWN_REVISION or STATUS_INVALID_PARAMETER_1, got %08x\n", r);
361
362     key.Length = 0;
363     r = pSystemFunction005(&out, &key, &res);
364     ok(r == STATUS_INVALID_PARAMETER_2, "function failed\n");
365 }
366
367 static void test_SystemFunction009(void)
368 {
369     unsigned char hash[0x10] = {
370         0xff, 0x37, 0x50, 0xbc, 0xc2, 0xb2, 0x24, 0x12,
371         0xc2, 0x26, 0x5b, 0x23, 0x73, 0x4e, 0x0d, 0xac };
372     unsigned char challenge[8] = {
373         0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef };
374     unsigned char expected[0x18] = {
375         0xc3, 0x37, 0xcd, 0x5c, 0xbd, 0x44, 0xfc, 0x97,
376         0x82, 0xa6, 0x67, 0xaf, 0x6d, 0x42, 0x7c, 0x6d,
377         0xe6, 0x7c, 0x20, 0xc2, 0xd3, 0xe7, 0x7c, 0x56 };
378     unsigned char output[0x18];
379     int r;
380
381     memset(output, 0, sizeof output);
382     r = pSystemFunction009(challenge, hash, output);
383     ok( r == STATUS_SUCCESS, "wrong error code\n");
384     ok(!memcmp(output, expected, sizeof expected), "response wrong\n");
385 }
386
387 static unsigned char des_key[] = { 
388     0xff, 0x37, 0x50, 0xbc, 0xc2, 0xb2, 0x24, 
389     0xff, 0x37, 0x50, 0xbc, 0xc2, 0xb2, 0x24, 
390 };
391 static unsigned char des_plaintext[] = { 
392     0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 
393     0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0 
394 };
395 static unsigned char des_ciphertext[] = { 
396     0xc3, 0x37, 0xcd, 0x5c, 0xbd, 0x44, 0xfc, 0x97,
397     0xc3, 0x37, 0xcd, 0x5c, 0xbd, 0x44, 0xfc, 0x97, 0
398 };
399
400 /* test functions that encrypt two DES blocks */
401 static void test_SystemFunction_encrypt(descrypt func, int num)
402 {
403     unsigned char output[0x11];
404     int r;
405
406     if (!func)
407     {
408         win_skip("SystemFunction%03d is not available\n", num);
409         return;
410     }
411
412     r = func(NULL, NULL, NULL);
413     ok( r == STATUS_UNSUCCESSFUL, "wrong error code\n");
414
415     memset(output, 0, sizeof output);
416     r = func(des_plaintext, des_key, output);
417     ok( r == STATUS_SUCCESS, "wrong error code\n");
418     ok( !memcmp(des_ciphertext, output, sizeof des_ciphertext), "ciphertext wrong (%d)\n", num);
419 }
420
421 /* test functions that decrypt two DES blocks */
422 static void test_SystemFunction_decrypt(descrypt func, int num)
423 {
424     unsigned char output[0x11];
425     int r;
426
427     if (!func)
428     {
429         win_skip("SystemFunction%03d is not available\n", num);
430         return;
431     }
432
433     r = func(NULL, NULL, NULL);
434     ok( r == STATUS_UNSUCCESSFUL, "wrong error code\n");
435
436     memset(output, 0, sizeof output);
437
438     r = func(des_ciphertext, des_key, output);
439     ok( r == STATUS_SUCCESS, "wrong error code\n");
440     ok( !memcmp(des_plaintext, output, sizeof des_plaintext), "plaintext wrong (%d)\n", num);
441 }
442
443 static unsigned char des_ciphertext32[] = { 
444     0x69, 0x51, 0x35, 0x69, 0x0d, 0x29, 0x24, 0xad,
445     0x23, 0x6d, 0xfd, 0x43, 0x0d, 0xd3, 0x25, 0x81, 0
446 };
447
448 static void test_SystemFunction_enc32(descrypt func, int num)
449 {
450     unsigned char key[4], output[0x11];
451     int r;
452
453     if (!func)
454     {
455         win_skip("SystemFunction%03d is not available\n", num);
456         return;
457     }
458
459     memset(output, 0, sizeof output);
460
461     /* two keys are generated using 4 bytes, repeated 4 times ... */
462     memcpy(key, "foo", 4);
463
464     r = func(des_plaintext, key, output);
465     ok( r == STATUS_SUCCESS, "wrong error code (%d)\n", num);
466
467     ok( !memcmp( output, des_ciphertext32, sizeof des_ciphertext32), "ciphertext wrong (%d)\n", num);
468 }
469
470 static void test_SystemFunction_dec32(descrypt func, int num)
471 {
472     unsigned char key[4], output[0x11];
473     int r;
474
475     if (!func)
476     {
477         win_skip("SystemFunction%03d is not available\n", num);
478         return;
479     }
480
481     memset(output, 0, sizeof output);
482
483     /* two keys are generated using 4 bytes, repeated 4 times ... */
484     memcpy(key, "foo", 4);
485
486     r = func(des_ciphertext32, key, output);
487     ok( r == STATUS_SUCCESS, "wrong error code (%d)\n", num);
488
489     ok( !memcmp( output, des_plaintext, sizeof des_plaintext), "plaintext wrong (%d)\n", num);
490 }
491
492 static void test_memcmpfunc(memcmpfunc fn)
493 {
494     unsigned char arg1[0x20], arg2[0x20];
495     int r;
496
497     if (!fn)
498     {
499         win_skip("function is not available\n");
500         return;
501     }
502
503     memset(arg1, 0, sizeof arg1);
504     memset(arg2, 0, sizeof arg2);
505     arg1[0x10] = 1;
506
507     r = fn(arg1, arg2);
508     ok( r == 1, "wrong error code\n");
509
510     memset(arg1, 1, sizeof arg1);
511     memset(arg2, 1, sizeof arg2);
512     arg1[0x10] = 0;
513
514     r = fn(arg1, arg2);
515     ok( r == 1, "wrong error code\n");
516
517     memset(arg1, 0, sizeof arg1);
518     memset(arg2, 1, sizeof arg2);
519
520     r = fn(arg1, arg2);
521     ok( r == 0, "wrong error code\n");
522
523     memset(arg1, 1, sizeof arg1);
524     memset(arg2, 0, sizeof arg2);
525
526     r = fn(arg1, arg2);
527     ok( r == 0, "wrong error code\n");
528 }
529
530 START_TEST(crypt_lmhash)
531 {
532     HMODULE module = GetModuleHandleA("advapi32.dll");
533
534     pSystemFunction001 = (void *)GetProcAddress( module, "SystemFunction001" );
535     if (pSystemFunction001)
536         test_SystemFunction001();
537     else
538         win_skip("SystemFunction001 is not available\n");
539
540     pSystemFunction002 = (void *)GetProcAddress( module, "SystemFunction002" );
541     if (pSystemFunction002)
542         test_SystemFunction002();
543     else
544         win_skip("SystemFunction002 is not available\n");
545
546     pSystemFunction003 = (void *)GetProcAddress( module, "SystemFunction003" );
547     if (pSystemFunction003)
548         test_SystemFunction003();
549     else
550         win_skip("SystemFunction002 is not available\n");
551
552     pSystemFunction004 = (void *)GetProcAddress( module, "SystemFunction004" );
553     if (pSystemFunction004)
554         test_SystemFunction004();
555     else
556         win_skip("SystemFunction004 is not available\n");
557
558     pSystemFunction005 = (void *)GetProcAddress( module, "SystemFunction005" );
559     if (pSystemFunction005)
560         test_SystemFunction005();
561     else
562         win_skip("SystemFunction005 is not available\n");
563
564     pSystemFunction006 = (void *)GetProcAddress( module, "SystemFunction006" );
565     if (pSystemFunction006) 
566         test_SystemFunction006();
567     else
568         win_skip("SystemFunction006 is not available\n");
569
570     pSystemFunction008 = (void *)GetProcAddress( module, "SystemFunction008" );
571     if (pSystemFunction008)
572         test_SystemFunction008();
573     else
574         win_skip("SystemFunction008 is not available\n");
575
576     pSystemFunction009 = (void *)GetProcAddress( module, "SystemFunction009" );
577     if (pSystemFunction009)
578         test_SystemFunction009();
579     else
580         win_skip("SystemFunction009 is not available\n");
581
582     pSystemFunction012 = (descrypt) GetProcAddress( module, "SystemFunction012");
583     pSystemFunction013 = (descrypt) GetProcAddress( module, "SystemFunction013");
584     pSystemFunction014 = (descrypt) GetProcAddress( module, "SystemFunction014");
585     pSystemFunction015 = (descrypt) GetProcAddress( module, "SystemFunction015");
586     pSystemFunction016 = (descrypt) GetProcAddress( module, "SystemFunction016");
587     pSystemFunction017 = (descrypt) GetProcAddress( module, "SystemFunction017");
588     pSystemFunction018 = (descrypt) GetProcAddress( module, "SystemFunction018");
589     pSystemFunction019 = (descrypt) GetProcAddress( module, "SystemFunction019");
590     pSystemFunction020 = (descrypt) GetProcAddress( module, "SystemFunction020");
591     pSystemFunction021 = (descrypt) GetProcAddress( module, "SystemFunction021");
592     pSystemFunction022 = (descrypt) GetProcAddress( module, "SystemFunction022");
593     pSystemFunction023 = (descrypt) GetProcAddress( module, "SystemFunction023");
594
595     /* these all encrypt two DES blocks */
596     test_SystemFunction_encrypt(pSystemFunction012, 12);
597     test_SystemFunction_encrypt(pSystemFunction014, 14);
598     test_SystemFunction_encrypt(pSystemFunction016, 16);
599     test_SystemFunction_encrypt(pSystemFunction018, 18);
600     test_SystemFunction_encrypt(pSystemFunction020, 20);
601     test_SystemFunction_encrypt(pSystemFunction022, 22);
602
603     /* these all decrypt two DES blocks */
604     test_SystemFunction_decrypt(pSystemFunction013, 13);
605     test_SystemFunction_decrypt(pSystemFunction015, 15);
606     test_SystemFunction_decrypt(pSystemFunction017, 17);
607     test_SystemFunction_decrypt(pSystemFunction019, 19);
608     test_SystemFunction_decrypt(pSystemFunction021, 21);
609     test_SystemFunction_decrypt(pSystemFunction023, 23);
610
611     pSystemFunction024 = (descrypt) GetProcAddress( module, "SystemFunction024");
612     pSystemFunction025 = (descrypt) GetProcAddress( module, "SystemFunction025");
613     pSystemFunction026 = (descrypt) GetProcAddress( module, "SystemFunction026");
614     pSystemFunction027 = (descrypt) GetProcAddress( module, "SystemFunction027");
615
616     /* these encrypt two DES blocks with a short key */
617     test_SystemFunction_enc32(pSystemFunction024, 24);
618     test_SystemFunction_enc32(pSystemFunction026, 26);
619
620     /* these descrypt two DES blocks with a short key */
621     test_SystemFunction_dec32(pSystemFunction025, 25);
622     test_SystemFunction_dec32(pSystemFunction027, 27);
623
624     pSystemFunction030 = (memcmpfunc) GetProcAddress( module, "SystemFunction030" );
625     pSystemFunction031 = (memcmpfunc) GetProcAddress( module, "SystemFunction031" );
626
627     test_memcmpfunc(pSystemFunction030);
628     test_memcmpfunc(pSystemFunction031);
629
630     pSystemFunction032 = (void *)GetProcAddress( module, "SystemFunction032" );
631     if (pSystemFunction032)
632         test_SystemFunction032();
633     else
634         win_skip("SystemFunction032 is not available\n");
635 }