crypt_lmhash.c 20.8 KB
Newer Older
1
/*
2
 * Unit tests for SystemFunctionXXX (LMHash?)
3 4
 *
 * Copyright 2004 Hans Leidekker
5
 * Copyright 2006 Mike McCormack
6 7 8 9 10 11 12 13 14 15 16 17 18
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * 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 23
 */

#include <stdio.h>

24 25
#include "ntstatus.h"
#define WIN32_NO_STATUS
26 27 28
#include "wine/test.h"
#include "windef.h"
#include "winbase.h"
29
#include "winternl.h"
30

31 32 33 34 35 36
struct ustring {
    DWORD Length;
    DWORD MaximumLength;
    unsigned char *Buffer;
};

37 38 39
typedef NTSTATUS (WINAPI *fnSystemFunction001)(const BYTE *, const BYTE *, LPBYTE);
typedef NTSTATUS (WINAPI *fnSystemFunction002)(const BYTE *, const BYTE *, LPBYTE);
typedef NTSTATUS (WINAPI *fnSystemFunction003)(const BYTE *, LPBYTE);
40
typedef NTSTATUS (WINAPI *fnSystemFunction004)(const struct ustring *, const struct ustring *, struct ustring *);
41
typedef NTSTATUS (WINAPI *fnSystemFunction005)(const struct ustring *, const struct ustring *, struct ustring *);
42
typedef VOID (WINAPI *fnSystemFunction006)( PCSTR passwd, PSTR lmhash );
43 44
typedef NTSTATUS (WINAPI *fnSystemFunction008)(const BYTE *, const BYTE *, LPBYTE);
typedef NTSTATUS (WINAPI *fnSystemFunction009)(const BYTE *, const BYTE *, LPBYTE);
45
typedef int (WINAPI *descrypt)(unsigned char *, unsigned char *, unsigned char *);
46
typedef NTSTATUS (WINAPI *fnSystemFunction030)(void*, void*);
47
typedef NTSTATUS (WINAPI *fnSystemFunction032)(struct ustring *, struct ustring *);
48

49
fnSystemFunction001 pSystemFunction001;
50
fnSystemFunction002 pSystemFunction002;
51
fnSystemFunction003 pSystemFunction003;
52
fnSystemFunction004 pSystemFunction004;
53
fnSystemFunction004 pSystemFunction005;
54 55
fnSystemFunction006 pSystemFunction006;
fnSystemFunction008 pSystemFunction008;
56
fnSystemFunction008 pSystemFunction009;
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73

/* encrypt two blocks */
descrypt pSystemFunction012;
descrypt pSystemFunction014;
descrypt pSystemFunction016;
descrypt pSystemFunction018;
descrypt pSystemFunction020;
descrypt pSystemFunction022;

/* decrypt two blocks */
descrypt pSystemFunction013;
descrypt pSystemFunction015;
descrypt pSystemFunction017;
descrypt pSystemFunction019;
descrypt pSystemFunction021;
descrypt pSystemFunction023;

74
/* encrypt two blocks with a 32bit key */
75 76
descrypt pSystemFunction024;
descrypt pSystemFunction025;
77 78 79 80 81

/* decrypt two blocks with a 32bit key */
descrypt pSystemFunction026;
descrypt pSystemFunction027;

82 83 84 85
typedef int (WINAPI *memcmpfunc)(unsigned char *, unsigned char *);
memcmpfunc pSystemFunction030;
memcmpfunc pSystemFunction031;

86
fnSystemFunction032 pSystemFunction032;
87

88
static void test_SystemFunction006(void)
89
{
Mike McCormack's avatar
Mike McCormack committed
90
    char lmhash[16 + 1];
91

Mike McCormack's avatar
Mike McCormack committed
92
    char passwd[] = { 's','e','c','r','e','t', 0, 0, 0, 0, 0, 0, 0, 0 };
93 94 95 96 97 98 99 100 101 102 103 104 105
    unsigned char expect[] = 
        { 0x85, 0xf5, 0x28, 0x9f, 0x09, 0xdc, 0xa7, 0xeb,
          0xaa, 0xd3, 0xb4, 0x35, 0xb5, 0x14, 0x04, 0xee };

    pSystemFunction006( passwd, lmhash );

    ok( !memcmp( lmhash, expect, sizeof(expect) ),
        "lmhash: %02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x\n",
        lmhash[0], lmhash[1], lmhash[2], lmhash[3], lmhash[4], lmhash[5],
        lmhash[6], lmhash[7], lmhash[8], lmhash[9], lmhash[10], lmhash[11],
        lmhash[12], lmhash[13], lmhash[14], lmhash[15] );
}

106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146
static void test_SystemFunction008(void)
{
    /* example data from http://davenport.sourceforge.net/ntlm.html */
    unsigned char hash[0x40] = {
        0xff, 0x37, 0x50, 0xbc, 0xc2, 0xb2, 0x24, 0x12,
        0xc2, 0x26, 0x5b, 0x23, 0x73, 0x4e, 0x0d, 0xac };
    unsigned char challenge[0x40] = {
        0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef };
    unsigned char expected[0x18] = {
        0xc3, 0x37, 0xcd, 0x5c, 0xbd, 0x44, 0xfc, 0x97,
        0x82, 0xa6, 0x67, 0xaf, 0x6d, 0x42, 0x7c, 0x6d,
        0xe6, 0x7c, 0x20, 0xc2, 0xd3, 0xe7, 0x7c, 0x56 };
    unsigned char output[0x18];
    NTSTATUS r;

    r = pSystemFunction008(0,0,0);
    ok( r == STATUS_UNSUCCESSFUL, "wrong error code\n");

    r = pSystemFunction008(challenge,0,0);
    ok( r == STATUS_UNSUCCESSFUL, "wrong error code\n");

    r = pSystemFunction008(challenge, hash, 0);
    ok( r == STATUS_UNSUCCESSFUL, "wrong error code\n");

    /* crashes */
    if (0)
    {
        r = pSystemFunction008(challenge, 0, output);
        ok( r == STATUS_UNSUCCESSFUL, "wrong error code\n");
    }

    r = pSystemFunction008(0, 0, output);
    ok( r == STATUS_UNSUCCESSFUL, "wrong error code\n");

    memset(output, 0, sizeof output);
    r = pSystemFunction008(challenge, hash, output);
    ok( r == STATUS_SUCCESS, "wrong error code\n");

    ok( !memcmp(output, expected, sizeof expected), "response wrong\n");
}

147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165
static void test_SystemFunction001(void)
{
    unsigned char key[8] = { 0xff, 0x37, 0x50, 0xbc, 0xc2, 0xb2, 0x24, 0 };
    unsigned char data[8] = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef };
    unsigned char expected[8] = { 0xc3, 0x37, 0xcd, 0x5c, 0xbd, 0x44, 0xfc, 0x97 };
    unsigned char output[16];
    NTSTATUS r;

    r = pSystemFunction001(0,0,0);
    ok( r == STATUS_UNSUCCESSFUL, "wrong error code\n");

    memset(output, 0, sizeof output);

    r = pSystemFunction001(data,key,output);
    ok( r == STATUS_SUCCESS, "wrong error code\n");

    ok(!memcmp(output, expected, sizeof expected), "response wrong\n");
}

166 167 168 169 170 171 172 173 174 175 176 177 178 179 180
static void test_SystemFunction002(void)
{
    /* reverse of SystemFunction001 */
    unsigned char key[8] = { 0xff, 0x37, 0x50, 0xbc, 0xc2, 0xb2, 0x24, 0 };
    unsigned char expected[8] = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef };
    unsigned char data[8] = { 0xc3, 0x37, 0xcd, 0x5c, 0xbd, 0x44, 0xfc, 0x97 };
    unsigned char output[8];
    int r;

    memset(output, 0, sizeof output);
    r = pSystemFunction002(data, key, output);
    ok(r == STATUS_SUCCESS, "function failed\n");
    ok(!memcmp(output, expected, sizeof expected), "response wrong\n");
}

181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201
static void test_SystemFunction032(void)
{
    struct ustring key, data;
    unsigned char szKey[] = { 'f','o','o',0 };
    unsigned char szData[8] = { 'b','a','r',0 };
    unsigned char expected[] = {0x28, 0xb9, 0xf8, 0xe1};
    int r;

    /* crashes:    pSystemFunction032(NULL,NULL); */

    key.Buffer = szKey;
    key.Length = sizeof szKey;
    key.MaximumLength = key.Length;

    data.Buffer = szData;
    data.Length = 4;
    data.MaximumLength = 8;

    r = pSystemFunction032(&data, &key);
    ok(r == STATUS_SUCCESS, "function failed\n");

202
    ok(!memcmp(expected, data.Buffer, data.Length), "wrong result\n");
203 204
}

205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229
static void test_SystemFunction003(void)
{
    unsigned char output[8], data[8];
    unsigned char key[7] = { 0xff, 0x37, 0x50, 0xbc, 0xc2, 0xb2, 0x24 };
    unsigned char exp1[8] = { 0x9d, 0x21, 0xc8, 0x86, 0x6c, 0x21, 0xcf, 0x43 };
    char exp2[] = "KGS!@#$%";
    int r;

    r = pSystemFunction003(NULL, NULL);
    ok(r == STATUS_UNSUCCESSFUL, "function failed\n");

    r = pSystemFunction003(key, NULL);
    ok(r == STATUS_UNSUCCESSFUL, "function failed\n");

    memset(data, 0, sizeof data);
    r = pSystemFunction003(key, data);
    ok(r == STATUS_SUCCESS, "function failed\n");
    ok( !memcmp(exp1, data, sizeof data), "decrypted message wrong\n");

    memset(output, 0, sizeof output);
    r = pSystemFunction002(data, key, output);

    ok( !memcmp(exp2, output, sizeof output), "decrypted message wrong\n");
}

230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311
static void test_SystemFunction004(void)
{
    unsigned char inbuf[0x100], keybuf[0x100], resbuf[0x100];
    unsigned char output[8];
    int r;
    struct ustring in, key, out;

    /* crash 
    r = pSystemFunction004(NULL, NULL, NULL);
    ok(r == STATUS_UNSUCCESSFUL, "function failed\n");
    */

    memset(inbuf, 0, sizeof inbuf);
    memset(keybuf, 0, sizeof keybuf);
    memset(resbuf, 0, sizeof resbuf);

    in.Buffer = NULL;
    in.Length = in.MaximumLength = 0;

    key.Buffer = NULL;
    key.Length = key.MaximumLength = 0;

    out.Buffer = NULL;
    out.Length = out.MaximumLength = 0;

    r = pSystemFunction004(&in, &key, &out);
    ok(r == STATUS_INVALID_PARAMETER_2, "function failed\n");

    key.Buffer = keybuf;
    key.Length = 0x100;
    key.MaximumLength = 0x100;

    r = pSystemFunction004(&in, &key, (struct ustring *)&out);
    ok(r == STATUS_BUFFER_TOO_SMALL, "function failed\n");

    in.Buffer = inbuf;
    in.Length = 0x0c;
    in.MaximumLength = 0;

    /* add two identical blocks... */
    inbuf[0] = 1;
    inbuf[1] = 2;
    inbuf[2] = 3;
    inbuf[3] = 4;

    inbuf[8] = 1;
    inbuf[9] = 2;
    inbuf[10] = 3;
    inbuf[11] = 4;

    /* check that the Length field is really obeyed */
    keybuf[6] = 1;

    key.Buffer = keybuf;
    key.Length = 6;
    key.MaximumLength = 0;

    keybuf[1] = 0x33;

    out.Buffer = resbuf;
    out.Length = 0;
    out.MaximumLength = 0x40;
    r = pSystemFunction004(&in, &key, &out);
    ok(r == STATUS_SUCCESS, "function failed\n");

    keybuf[6] = 0;

    memset(output, 0, sizeof output);
    r = pSystemFunction002(out.Buffer, key.Buffer, output);

    ok(((unsigned int*)output)[0] == in.Length, "crypted length wrong\n");
    ok(((unsigned int*)output)[1] == 1, "crypted value wrong\n");

    memset(output, 0, sizeof output);
    r = pSystemFunction002(out.Buffer+8, key.Buffer, output);
    ok(!memcmp(output, inbuf, sizeof output), "crypted data wrong\n");

    memset(output, 0, sizeof output);
    r = pSystemFunction002(out.Buffer+16, key.Buffer, output);
    ok(!memcmp(output, inbuf, sizeof output), "crypted data wrong\n");
}

312 313 314 315 316
static void test_SystemFunction005(void)
{
    char output[0x40], result[0x40];
    int r;
    struct ustring in, key, out, res;
317 318
    static char datastr[] = "twinkle twinkle little star";
    static char keystr[]  = "byolnim";
319

320
    in.Buffer = (unsigned char *)datastr;
321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350
    in.Length = strlen(datastr);
    in.MaximumLength = 0;

    key.Buffer = (unsigned char *)keystr;
    key.Length = strlen(keystr);
    key.MaximumLength = 0;

    out.Buffer = (unsigned char *)output;
    out.Length = out.MaximumLength = sizeof output;

    r = pSystemFunction004(&in, &key, &out);
    ok(r == STATUS_SUCCESS, "function failed\n");

    memset(result, 0, sizeof result);
    res.Buffer = (unsigned char *)result;
    res.Length = 0;
    res.MaximumLength = sizeof result;

    r = pSystemFunction005(&out, &key, &res);
    ok(r == STATUS_SUCCESS, "function failed\n");

    r = pSystemFunction005(&out, &key, &res);
    ok(r == STATUS_SUCCESS, "function failed\n");

    ok(res.Length == in.Length, "Length wrong\n");
    ok(!memcmp(res.Buffer, in.Buffer, in.Length), "data wrong\n");

    out.Length = 0;
    out.MaximumLength = 0;
    r = pSystemFunction005(&out, &key, &res);
351 352 353
    ok(r == STATUS_SUCCESS ||
       r == STATUS_INVALID_PARAMETER_1, /* Vista */
       "Expected STATUS_SUCCESS or STATUS_INVALID_PARAMETER_1, got %08x\n", r);
354 355 356 357 358 359

    ok(res.Length == in.Length, "Length wrong\n");
    ok(!memcmp(res.Buffer, in.Buffer, in.Length), "data wrong\n");

    res.MaximumLength = 0;
    r = pSystemFunction005(&out, &key, &res);
360 361 362
    ok(r == STATUS_BUFFER_TOO_SMALL ||
       r == STATUS_INVALID_PARAMETER_1, /* Vista */
       "Expected STATUS_BUFFER_TOO_SMALL or STATUS_INVALID_PARAMETER_1, got %08x\n", r);
363 364 365

    key.Length = 1;
    r = pSystemFunction005(&out, &key, &res);
366 367 368
    ok(r == STATUS_UNKNOWN_REVISION ||
       r == STATUS_INVALID_PARAMETER_1, /* Vista */
       "Expected STATUS_UNKNOWN_REVISION or STATUS_INVALID_PARAMETER_1, got %08x\n", r);
369 370 371 372 373 374

    key.Length = 0;
    r = pSystemFunction005(&out, &key, &res);
    ok(r == STATUS_INVALID_PARAMETER_2, "function failed\n");
}

375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394
static void test_SystemFunction009(void)
{
    unsigned char hash[0x10] = {
        0xff, 0x37, 0x50, 0xbc, 0xc2, 0xb2, 0x24, 0x12,
        0xc2, 0x26, 0x5b, 0x23, 0x73, 0x4e, 0x0d, 0xac };
    unsigned char challenge[8] = {
        0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef };
    unsigned char expected[0x18] = {
        0xc3, 0x37, 0xcd, 0x5c, 0xbd, 0x44, 0xfc, 0x97,
        0x82, 0xa6, 0x67, 0xaf, 0x6d, 0x42, 0x7c, 0x6d,
        0xe6, 0x7c, 0x20, 0xc2, 0xd3, 0xe7, 0x7c, 0x56 };
    unsigned char output[0x18];
    int r;

    memset(output, 0, sizeof output);
    r = pSystemFunction009(challenge, hash, output);
    ok( r == STATUS_SUCCESS, "wrong error code\n");
    ok(!memcmp(output, expected, sizeof expected), "response wrong\n");
}

395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414
static unsigned char des_key[] = { 
    0xff, 0x37, 0x50, 0xbc, 0xc2, 0xb2, 0x24, 
    0xff, 0x37, 0x50, 0xbc, 0xc2, 0xb2, 0x24, 
};
static unsigned char des_plaintext[] = { 
    0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 
    0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0 
};
static unsigned char des_ciphertext[] = { 
    0xc3, 0x37, 0xcd, 0x5c, 0xbd, 0x44, 0xfc, 0x97,
    0xc3, 0x37, 0xcd, 0x5c, 0xbd, 0x44, 0xfc, 0x97, 0
};

/* test functions that encrypt two DES blocks */
static void test_SystemFunction_encrypt(descrypt func, int num)
{
    unsigned char output[0x11];
    int r;

    if (!func)
415 416
    {
        skip("SystemFunction%03d is not available\n", num);
417
        return;
418
    }
419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435

    r = func(NULL, NULL, NULL);
    ok( r == STATUS_UNSUCCESSFUL, "wrong error code\n");

    memset(output, 0, sizeof output);
    r = func(des_plaintext, des_key, output);
    ok( r == STATUS_SUCCESS, "wrong error code\n");
    ok( !memcmp(des_ciphertext, output, sizeof des_ciphertext), "ciphertext wrong (%d)\n", num);
}

/* test functions that decrypt two DES blocks */
static void test_SystemFunction_decrypt(descrypt func, int num)
{
    unsigned char output[0x11];
    int r;

    if (!func)
436 437
    {
        skip("SystemFunction%03d is not available\n", num);
438
        return;
439
    }
440 441 442 443 444 445 446 447 448 449 450

    r = func(NULL, NULL, NULL);
    ok( r == STATUS_UNSUCCESSFUL, "wrong error code\n");

    memset(output, 0, sizeof output);

    r = func(des_ciphertext, des_key, output);
    ok( r == STATUS_SUCCESS, "wrong error code\n");
    ok( !memcmp(des_plaintext, output, sizeof des_plaintext), "plaintext wrong (%d)\n", num);
}

451 452 453 454 455 456
static unsigned char des_ciphertext32[] = { 
    0x69, 0x51, 0x35, 0x69, 0x0d, 0x29, 0x24, 0xad,
    0x23, 0x6d, 0xfd, 0x43, 0x0d, 0xd3, 0x25, 0x81, 0
};

static void test_SystemFunction_enc32(descrypt func, int num)
457
{
458
    unsigned char key[4], output[0x11];
459 460
    int r;

461
    if (!func)
462 463
    {
        skip("SystemFunction%03d is not available\n", num);
464
        return;
465
    }
466

467 468 469 470 471
    memset(output, 0, sizeof output);

    /* two keys are generated using 4 bytes, repeated 4 times ... */
    memcpy(key, "foo", 4);

472 473
    r = func(des_plaintext, key, output);
    ok( r == STATUS_SUCCESS, "wrong error code (%d)\n", num);
474

475
    ok( !memcmp( output, des_ciphertext32, sizeof des_ciphertext32), "ciphertext wrong (%d)\n", num);
476 477
}

478
static void test_SystemFunction_dec32(descrypt func, int num)
479
{
480
    unsigned char key[4], output[0x11];
481 482
    int r;

483
    if (!func)
484 485
    {
        skip("SystemFunction%03d is not available\n", num);
486
        return;
487
    }
488

489 490 491 492 493
    memset(output, 0, sizeof output);

    /* two keys are generated using 4 bytes, repeated 4 times ... */
    memcpy(key, "foo", 4);

494 495
    r = func(des_ciphertext32, key, output);
    ok( r == STATUS_SUCCESS, "wrong error code (%d)\n", num);
496

497
    ok( !memcmp( output, des_plaintext, sizeof des_plaintext), "plaintext wrong (%d)\n", num);
498 499
}

500
static void test_memcmpfunc(memcmpfunc fn)
501 502 503 504
{
    unsigned char arg1[0x20], arg2[0x20];
    int r;

505
    if (!fn)
506 507
    {
        skip("function is not available\n");
508
        return;
509
    }
510

511 512 513 514 515
    if (0)
    {
        /* crashes */
        r = fn(NULL, NULL);
    }
516 517 518 519 520

    memset(arg1, 0, sizeof arg1);
    memset(arg2, 0, sizeof arg2);
    arg1[0x10] = 1;

521
    r = fn(arg1, arg2);
522 523 524 525 526 527
    ok( r == 1, "wrong error code\n");

    memset(arg1, 1, sizeof arg1);
    memset(arg2, 1, sizeof arg2);
    arg1[0x10] = 0;

528
    r = fn(arg1, arg2);
529 530 531 532 533
    ok( r == 1, "wrong error code\n");

    memset(arg1, 0, sizeof arg1);
    memset(arg2, 1, sizeof arg2);

534
    r = fn(arg1, arg2);
535 536 537 538 539
    ok( r == 0, "wrong error code\n");

    memset(arg1, 1, sizeof arg1);
    memset(arg2, 0, sizeof arg2);

540
    r = fn(arg1, arg2);
541 542 543
    ok( r == 0, "wrong error code\n");
}

544 545
START_TEST(crypt_lmhash)
{
546
    HMODULE module = GetModuleHandleA("advapi32.dll");
547

548 549 550
    pSystemFunction001 = (fnSystemFunction001)GetProcAddress( module, "SystemFunction001" );
    if (pSystemFunction001)
        test_SystemFunction001();
551 552
    else
        skip("SystemFunction001 is not available\n");
553 554 555 556

    pSystemFunction002 = (fnSystemFunction002)GetProcAddress( module, "SystemFunction002" );
    if (pSystemFunction002)
        test_SystemFunction002();
557 558
    else
        skip("SystemFunction002 is not available\n");
559 560 561 562

    pSystemFunction003 = (fnSystemFunction003)GetProcAddress( module, "SystemFunction003" );
    if (pSystemFunction003)
        test_SystemFunction003();
563 564
    else
        skip("SystemFunction002 is not available\n");
565

566 567 568
    pSystemFunction004 = (fnSystemFunction004)GetProcAddress( module, "SystemFunction004" );
    if (pSystemFunction004)
        test_SystemFunction004();
569 570
    else
        skip("SystemFunction004 is not available\n");
571

572 573 574
    pSystemFunction005 = (fnSystemFunction005)GetProcAddress( module, "SystemFunction005" );
    if (pSystemFunction005)
        test_SystemFunction005();
575 576
    else
        skip("SystemFunction005 is not available\n");
577

578 579 580
    pSystemFunction006 = (fnSystemFunction006)GetProcAddress( module, "SystemFunction006" );
    if (pSystemFunction006) 
        test_SystemFunction006();
581 582
    else
        skip("SystemFunction006 is not available\n");
583

584 585 586
    pSystemFunction008 = (fnSystemFunction008)GetProcAddress( module, "SystemFunction008" );
    if (pSystemFunction008)
        test_SystemFunction008();
587 588
    else
        skip("SystemFunction008 is not available\n");
589

590 591 592
    pSystemFunction009 = (fnSystemFunction009)GetProcAddress( module, "SystemFunction009" );
    if (pSystemFunction009)
        test_SystemFunction009();
593 594
    else
        skip("SystemFunction009 is not available\n");
595

596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624
    pSystemFunction012 = (descrypt) GetProcAddress( module, "SystemFunction012");
    pSystemFunction013 = (descrypt) GetProcAddress( module, "SystemFunction013");
    pSystemFunction014 = (descrypt) GetProcAddress( module, "SystemFunction014");
    pSystemFunction015 = (descrypt) GetProcAddress( module, "SystemFunction015");
    pSystemFunction016 = (descrypt) GetProcAddress( module, "SystemFunction016");
    pSystemFunction017 = (descrypt) GetProcAddress( module, "SystemFunction017");
    pSystemFunction018 = (descrypt) GetProcAddress( module, "SystemFunction018");
    pSystemFunction019 = (descrypt) GetProcAddress( module, "SystemFunction019");
    pSystemFunction020 = (descrypt) GetProcAddress( module, "SystemFunction020");
    pSystemFunction021 = (descrypt) GetProcAddress( module, "SystemFunction021");
    pSystemFunction022 = (descrypt) GetProcAddress( module, "SystemFunction022");
    pSystemFunction023 = (descrypt) GetProcAddress( module, "SystemFunction023");

    /* these all encrypt two DES blocks */
    test_SystemFunction_encrypt(pSystemFunction012, 12);
    test_SystemFunction_encrypt(pSystemFunction014, 14);
    test_SystemFunction_encrypt(pSystemFunction016, 16);
    test_SystemFunction_encrypt(pSystemFunction018, 18);
    test_SystemFunction_encrypt(pSystemFunction020, 20);
    test_SystemFunction_encrypt(pSystemFunction022, 22);

    /* these all decrypt two DES blocks */
    test_SystemFunction_decrypt(pSystemFunction013, 13);
    test_SystemFunction_decrypt(pSystemFunction015, 15);
    test_SystemFunction_decrypt(pSystemFunction017, 17);
    test_SystemFunction_decrypt(pSystemFunction019, 19);
    test_SystemFunction_decrypt(pSystemFunction021, 21);
    test_SystemFunction_decrypt(pSystemFunction023, 23);

625 626
    pSystemFunction024 = (descrypt) GetProcAddress( module, "SystemFunction024");
    pSystemFunction025 = (descrypt) GetProcAddress( module, "SystemFunction025");
627 628 629 630 631 632
    pSystemFunction026 = (descrypt) GetProcAddress( module, "SystemFunction026");
    pSystemFunction027 = (descrypt) GetProcAddress( module, "SystemFunction027");

    /* these encrypt two DES blocks with a short key */
    test_SystemFunction_enc32(pSystemFunction024, 24);
    test_SystemFunction_enc32(pSystemFunction026, 26);
633

634 635 636
    /* these descrypt two DES blocks with a short key */
    test_SystemFunction_dec32(pSystemFunction025, 25);
    test_SystemFunction_dec32(pSystemFunction027, 27);
637

638 639 640 641 642
    pSystemFunction030 = (memcmpfunc) GetProcAddress( module, "SystemFunction030" );
    pSystemFunction031 = (memcmpfunc) GetProcAddress( module, "SystemFunction031" );

    test_memcmpfunc(pSystemFunction030);
    test_memcmpfunc(pSystemFunction031);
643 644 645 646

    pSystemFunction032 = (fnSystemFunction032)GetProcAddress( module, "SystemFunction032" );
    if (pSystemFunction032)
        test_SystemFunction032();
647 648
    else
        skip("SystemFunction032 is not available\n");
649
}