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