Mon Jul 20 20:41:06 2009 UTC ()
make tests compile!


(christos)
diff -r1.1.1.1 -r1.2 src/crypto/external/bsd/openssl/dist/crypto/conf/test.c
diff -r1.2 -r1.3 src/crypto/external/bsd/openssl/dist/crypto/des/destest.c
diff -r1.2 -r1.3 src/crypto/external/bsd/openssl/dist/crypto/lhash/lh_test.c
diff -r1.2 -r1.3 src/crypto/external/bsd/openssl/dist/crypto/md2/md2test.c
diff -r1.2 -r1.3 src/crypto/external/bsd/openssl/dist/crypto/threads/mttest.c
diff -r1.2 -r1.3 src/crypto/external/bsd/openssl/dist/crypto/x509v3/tabtest.c

cvs diff -r1.1.1.1 -r1.2 src/crypto/external/bsd/openssl/dist/crypto/conf/Attic/test.c (expand / switch to unified diff)

--- src/crypto/external/bsd/openssl/dist/crypto/conf/Attic/test.c 2009/07/19 23:03:31 1.1.1.1
+++ src/crypto/external/bsd/openssl/dist/crypto/conf/Attic/test.c 2009/07/20 20:41:05 1.2
@@ -53,44 +53,44 @@ @@ -53,44 +53,44 @@
53 * The licence and distribution terms for any publically available version or 53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be 54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence 55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.] 56 * [including the GNU Public Licence.]
57 */ 57 */
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include <stdlib.h> 60#include <stdlib.h>
61#include <openssl/conf.h> 61#include <openssl/conf.h>
62#include <openssl/err.h> 62#include <openssl/err.h>
63 63
64main() 64main()
65 { 65 {
66 LHASH *conf; 66 LHASH_OF(CONF_VALUE) *conf;
67 long eline; 67 long eline;
68 char *s,*s2; 68 char *s,*s2;
69 69
70#ifdef USE_WIN32 70#ifdef USE_WIN32
71 CONF_set_default_method(CONF_WIN32); 71 CONF_set_default_method(CONF_WIN32);
72#endif 72#endif
73 conf=CONF_load(NULL,"ssleay.cnf",&eline); 73 conf=CONF_load(NULL,"ssleay.cnf",&eline);
74 if (conf == NULL) 74 if (conf == NULL)
75 { 75 {
76 ERR_load_crypto_strings(); 76 ERR_load_crypto_strings();
77 printf("unable to load configuration, line %ld\n",eline); 77 printf("unable to load configuration, line %ld\n",eline);
78 ERR_print_errors_fp(stderr); 78 ERR_print_errors_fp(stderr);
79 exit(1); 79 exit(1);
80 } 80 }
81 lh_stats(conf,stdout); 81 lh_stats((_LHASH *)conf,stdout);
82 lh_node_stats(conf,stdout); 82 lh_node_stats((_LHASH *)conf,stdout);
83 lh_node_usage_stats(conf,stdout); 83 lh_node_usage_stats((_LHASH *)conf,stdout);
84 84
85 s=CONF_get_string(conf,NULL,"init2"); 85 s=CONF_get_string(conf,NULL,"init2");
86 printf("init2=%s\n",(s == NULL)?"NULL":s); 86 printf("init2=%s\n",(s == NULL)?"NULL":s);
87 87
88 s=CONF_get_string(conf,NULL,"cipher1"); 88 s=CONF_get_string(conf,NULL,"cipher1");
89 printf("cipher1=%s\n",(s == NULL)?"NULL":s); 89 printf("cipher1=%s\n",(s == NULL)?"NULL":s);
90 90
91 s=CONF_get_string(conf,"s_client","cipher1"); 91 s=CONF_get_string(conf,"s_client","cipher1");
92 printf("s_client:cipher1=%s\n",(s == NULL)?"NULL":s); 92 printf("s_client:cipher1=%s\n",(s == NULL)?"NULL":s);
93 93
94 printf("---------------------------- DUMP ------------------------\n"); 94 printf("---------------------------- DUMP ------------------------\n");
95 CONF_dump_fp(conf, stdout); 95 CONF_dump_fp(conf, stdout);
96 96

cvs diff -r1.2 -r1.3 src/crypto/external/bsd/openssl/dist/crypto/des/Attic/destest.c (expand / switch to unified diff)

--- src/crypto/external/bsd/openssl/dist/crypto/des/Attic/destest.c 2009/07/19 23:30:39 1.2
+++ src/crypto/external/bsd/openssl/dist/crypto/des/Attic/destest.c 2009/07/20 20:41:05 1.3
@@ -317,27 +317,27 @@ static unsigned char ofb_cipher[24]= @@ -317,27 +317,27 @@ static unsigned char ofb_cipher[24]=
317#if 0 317#if 0
318static DES_LONG cbc_cksum_ret=0xB462FEF7L; 318static DES_LONG cbc_cksum_ret=0xB462FEF7L;
319#else 319#else
320static DES_LONG cbc_cksum_ret=0xF7FE62B4L; 320static DES_LONG cbc_cksum_ret=0xF7FE62B4L;
321#endif 321#endif
322static unsigned char cbc_cksum_data[8]={0x1D,0x26,0x93,0x97,0xf7,0xfe,0x62,0xb4}; 322static unsigned char cbc_cksum_data[8]={0x1D,0x26,0x93,0x97,0xf7,0xfe,0x62,0xb4};
323 323
324static char *pt(unsigned char *p); 324static char *pt(unsigned char *p);
325static int cfb_test(int bits, unsigned char *cfb_cipher); 325static int cfb_test(int bits, unsigned char *cfb_cipher);
326static int cfb64_test(unsigned char *cfb_cipher); 326static int cfb64_test(unsigned char *cfb_cipher);
327static int ede_cfb64_test(unsigned char *cfb_cipher); 327static int ede_cfb64_test(unsigned char *cfb_cipher);
328int main(int argc, char *argv[]) 328int main(int argc, char *argv[])
329 { 329 {
330 int i,j,err=0; 330 int j,err=0;
331 unsigned int i; 331 unsigned int i;
332 DES_cblock in,out,outin,iv3,iv2; 332 DES_cblock in,out,outin,iv3,iv2;
333 DES_key_schedule ks,ks2,ks3; 333 DES_key_schedule ks,ks2,ks3;
334 unsigned char cbc_in[40]; 334 unsigned char cbc_in[40];
335 unsigned char cbc_out[40]; 335 unsigned char cbc_out[40];
336 DES_LONG cs; 336 DES_LONG cs;
337 unsigned char cret[8]; 337 unsigned char cret[8];
338#ifdef _CRAY 338#ifdef _CRAY
339 struct { 339 struct {
340 int a:32; 340 int a:32;
341 int b:32; 341 int b:32;
342 } lqret[2]; 342 } lqret[2];
343#else 343#else
@@ -396,118 +396,118 @@ int main(int argc, char *argv[]) @@ -396,118 +396,118 @@ int main(int argc, char *argv[])
396 printf(" %02x",cbc_in[n]); 396 printf(" %02x",cbc_in[n]);
397 printf("\n"); 397 printf("\n");
398 err=1; 398 err=1;
399 } 399 }
400#endif 400#endif
401 401
402 printf("Doing ecb\n"); 402 printf("Doing ecb\n");
403 for (i=0; i<NUM_TESTS; i++) 403 for (i=0; i<NUM_TESTS; i++)
404 { 404 {
405 DES_set_key_unchecked(&key_data[i],&ks); 405 DES_set_key_unchecked(&key_data[i],&ks);
406 memcpy(in,plain_data[i],8); 406 memcpy(in,plain_data[i],8);
407 memset(out,0,8); 407 memset(out,0,8);
408 memset(outin,0,8); 408 memset(outin,0,8);
409 DES_ecb_encrypt(&in,&out,ks,DES_ENCRYPT); 409 DES_ecb_encrypt(&in,&out,&ks,DES_ENCRYPT);
410 DES_ecb_encrypt(&out,&outin,ks,DES_DECRYPT); 410 DES_ecb_encrypt(&out,&outin,&ks,DES_DECRYPT);
411 411
412 if (memcmp(out,cipher_data[i],8) != 0) 412 if (memcmp(out,cipher_data[i],8) != 0)
413 { 413 {
414 printf("Encryption error %2d\nk=%s p=%s o=%s act=%s\n", 414 printf("Encryption error %2d\nk=%s p=%s o=%s act=%s\n",
415 i+1,pt(key_data[i]),pt(in),pt(cipher_data[i]), 415 i+1,pt(key_data[i]),pt(in),pt(cipher_data[i]),
416 pt(out)); 416 pt(out));
417 err=1; 417 err=1;
418 } 418 }
419 if (memcmp(in,outin,8) != 0) 419 if (memcmp(in,outin,8) != 0)
420 { 420 {
421 printf("Decryption error %2d\nk=%s p=%s o=%s act=%s\n", 421 printf("Decryption error %2d\nk=%s p=%s o=%s act=%s\n",
422 i+1,pt(key_data[i]),pt(out),pt(in),pt(outin)); 422 i+1,pt(key_data[i]),pt(out),pt(in),pt(outin));
423 err=1; 423 err=1;
424 } 424 }
425 } 425 }
426 426
427#ifndef LIBDES_LIT 427#ifndef LIBDES_LIT
428 printf("Doing ede ecb\n"); 428 printf("Doing ede ecb\n");
429 for (i=0; i<(NUM_TESTS-2); i++) 429 for (i=0; i<(NUM_TESTS-2); i++)
430 { 430 {
431 DES_set_key_unchecked(&key_data[i],&ks); 431 DES_set_key_unchecked(&key_data[i],&ks);
432 DES_set_key_unchecked(&key_data[i+1],&ks2); 432 DES_set_key_unchecked(&key_data[i+1],&ks2);
433 DES_set_key_unchecked(&key_data[i+2],&ks3); 433 DES_set_key_unchecked(&key_data[i+2],&ks3);
434 memcpy(in,plain_data[i],8); 434 memcpy(in,plain_data[i],8);
435 memset(out,0,8); 435 memset(out,0,8);
436 memset(outin,0,8); 436 memset(outin,0,8);
437 DES_ecb2_encrypt(&in,&out,ks,ks2,DES_ENCRYPT); 437 DES_ecb2_encrypt(&in,&out,&ks,&ks2,DES_ENCRYPT);
438 DES_ecb2_encrypt(&out,&outin,ks,ks2,DES_DECRYPT); 438 DES_ecb2_encrypt(&out,&outin,&ks,&ks2,DES_DECRYPT);
439 439
440 if (memcmp(out,cipher_ecb2[i],8) != 0) 440 if (memcmp(out,cipher_ecb2[i],8) != 0)
441 { 441 {
442 printf("Encryption error %2d\nk=%s p=%s o=%s act=%s\n", 442 printf("Encryption error %2d\nk=%s p=%s o=%s act=%s\n",
443 i+1,pt(key_data[i]),pt(in),pt(cipher_ecb2[i]), 443 i+1,pt(key_data[i]),pt(in),pt(cipher_ecb2[i]),
444 pt(out)); 444 pt(out));
445 err=1; 445 err=1;
446 } 446 }
447 if (memcmp(in,outin,8) != 0) 447 if (memcmp(in,outin,8) != 0)
448 { 448 {
449 printf("Decryption error %2d\nk=%s p=%s o=%s act=%s\n", 449 printf("Decryption error %2d\nk=%s p=%s o=%s act=%s\n",
450 i+1,pt(key_data[i]),pt(out),pt(in),pt(outin)); 450 i+1,pt(key_data[i]),pt(out),pt(in),pt(outin));
451 err=1; 451 err=1;
452 } 452 }
453 } 453 }
454#endif 454#endif
455 455
456 printf("Doing cbc\n"); 456 printf("Doing cbc\n");
457 if ((j=DES_set_key_checked(&cbc_key,&ks)) != 0) 457 if ((j=DES_set_key_checked(&cbc_key,&ks)) != 0)
458 { 458 {
459 printf("Key error %d\n",j); 459 printf("Key error %d\n",j);
460 err=1; 460 err=1;
461 } 461 }
462 memset(cbc_out,0,40); 462 memset(cbc_out,0,40);
463 memset(cbc_in,0,40); 463 memset(cbc_in,0,40);
464 memcpy(iv3,cbc_iv,sizeof(cbc_iv)); 464 memcpy(iv3,cbc_iv,sizeof(cbc_iv));
465 DES_ncbc_encrypt(cbc_data,cbc_out,strlen((char *)cbc_data)+1,ks, 465 DES_ncbc_encrypt(cbc_data,cbc_out,strlen((char *)cbc_data)+1,&ks,
466 &iv3,DES_ENCRYPT); 466 &iv3,DES_ENCRYPT);
467 if (memcmp(cbc_out,cbc_ok,32) != 0) 467 if (memcmp(cbc_out,cbc_ok,32) != 0)
468 { 468 {
469 printf("cbc_encrypt encrypt error\n"); 469 printf("cbc_encrypt encrypt error\n");
470 err=1; 470 err=1;
471 } 471 }
472 472
473 memcpy(iv3,cbc_iv,sizeof(cbc_iv)); 473 memcpy(iv3,cbc_iv,sizeof(cbc_iv));
474 DES_ncbc_encrypt(cbc_out,cbc_in,strlen((char *)cbc_data)+1,ks, 474 DES_ncbc_encrypt(cbc_out,cbc_in,strlen((char *)cbc_data)+1,&ks,
475 &iv3,DES_DECRYPT); 475 &iv3,DES_DECRYPT);
476 if (memcmp(cbc_in,cbc_data,strlen((char *)cbc_data)) != 0) 476 if (memcmp(cbc_in,cbc_data,strlen((char *)cbc_data)) != 0)
477 { 477 {
478 printf("cbc_encrypt decrypt error\n"); 478 printf("cbc_encrypt decrypt error\n");
479 err=1; 479 err=1;
480 } 480 }
481 481
482#ifndef LIBDES_LIT 482#ifndef LIBDES_LIT
483 printf("Doing desx cbc\n"); 483 printf("Doing desx cbc\n");
484 if ((j=DES_set_key_checked(&cbc_key,&ks)) != 0) 484 if ((j=DES_set_key_checked(&cbc_key,&ks)) != 0)
485 { 485 {
486 printf("Key error %d\n",j); 486 printf("Key error %d\n",j);
487 err=1; 487 err=1;
488 } 488 }
489 memset(cbc_out,0,40); 489 memset(cbc_out,0,40);
490 memset(cbc_in,0,40); 490 memset(cbc_in,0,40);
491 memcpy(iv3,cbc_iv,sizeof(cbc_iv)); 491 memcpy(iv3,cbc_iv,sizeof(cbc_iv));
492 DES_xcbc_encrypt(cbc_data,cbc_out,strlen((char *)cbc_data)+1,ks, 492 DES_xcbc_encrypt(cbc_data,cbc_out,strlen((char *)cbc_data)+1,&ks,
493 &iv3,&cbc2_key,&cbc3_key, DES_ENCRYPT); 493 &iv3,&cbc2_key,&cbc3_key, DES_ENCRYPT);
494 if (memcmp(cbc_out,xcbc_ok,32) != 0) 494 if (memcmp(cbc_out,xcbc_ok,32) != 0)
495 { 495 {
496 printf("DES_xcbc_encrypt encrypt error\n"); 496 printf("DES_xcbc_encrypt encrypt error\n");
497 err=1; 497 err=1;
498 } 498 }
499 memcpy(iv3,cbc_iv,sizeof(cbc_iv)); 499 memcpy(iv3,cbc_iv,sizeof(cbc_iv));
500 DES_xcbc_encrypt(cbc_out,cbc_in,strlen((char *)cbc_data)+1,ks, 500 DES_xcbc_encrypt(cbc_out,cbc_in,strlen((char *)cbc_data)+1,&ks,
501 &iv3,&cbc2_key,&cbc3_key, DES_DECRYPT); 501 &iv3,&cbc2_key,&cbc3_key, DES_DECRYPT);
502 if (memcmp(cbc_in,cbc_data,strlen((char *)cbc_data)+1) != 0) 502 if (memcmp(cbc_in,cbc_data,strlen((char *)cbc_data)+1) != 0)
503 { 503 {
504 printf("DES_xcbc_encrypt decrypt error\n"); 504 printf("DES_xcbc_encrypt decrypt error\n");
505 err=1; 505 err=1;
506 } 506 }
507#endif 507#endif
508 508
509 printf("Doing ede cbc\n"); 509 printf("Doing ede cbc\n");
510 if ((j=DES_set_key_checked(&cbc_key,&ks)) != 0) 510 if ((j=DES_set_key_checked(&cbc_key,&ks)) != 0)
511 { 511 {
512 printf("Key error %d\n",j); 512 printf("Key error %d\n",j);
513 err=1; 513 err=1;
@@ -518,209 +518,209 @@ int main(int argc, char *argv[]) @@ -518,209 +518,209 @@ int main(int argc, char *argv[])
518 err=1; 518 err=1;
519 } 519 }
520 if ((j=DES_set_key_checked(&cbc3_key,&ks3)) != 0) 520 if ((j=DES_set_key_checked(&cbc3_key,&ks3)) != 0)
521 { 521 {
522 printf("Key error %d\n",j); 522 printf("Key error %d\n",j);
523 err=1; 523 err=1;
524 } 524 }
525 memset(cbc_out,0,40); 525 memset(cbc_out,0,40);
526 memset(cbc_in,0,40); 526 memset(cbc_in,0,40);
527 i=strlen((char *)cbc_data)+1; 527 i=strlen((char *)cbc_data)+1;
528 /* i=((i+7)/8)*8; */ 528 /* i=((i+7)/8)*8; */
529 memcpy(iv3,cbc_iv,sizeof(cbc_iv)); 529 memcpy(iv3,cbc_iv,sizeof(cbc_iv));
530 530
531 DES_ede3_cbc_encrypt(cbc_data,cbc_out,16L,ks,ks2,ks3,&iv3, 531 DES_ede3_cbc_encrypt(cbc_data,cbc_out,16L,&ks,&ks2,&ks3,&iv3,
532 DES_ENCRYPT); 532 DES_ENCRYPT);
533 DES_ede3_cbc_encrypt(&(cbc_data[16]),&(cbc_out[16]),i-16,ks,ks2,ks3, 533 DES_ede3_cbc_encrypt(&(cbc_data[16]),&(cbc_out[16]),i-16,&ks,&ks2,&ks3,
534 &iv3,DES_ENCRYPT); 534 &iv3,DES_ENCRYPT);
535 if (memcmp(cbc_out,cbc3_ok, 535 if (memcmp(cbc_out,cbc3_ok,
536 (unsigned int)(strlen((char *)cbc_data)+1+7)/8*8) != 0) 536 (unsigned int)(strlen((char *)cbc_data)+1+7)/8*8) != 0)
537 { 537 {
538 int n; 538 int n;
539 539
540 printf("DES_ede3_cbc_encrypt encrypt error\n"); 540 printf("DES_ede3_cbc_encrypt encrypt error\n");
541 for(n=0 ; n < i ; ++n) 541 for(n=0 ; n < i ; ++n)
542 printf(" %02x",cbc_out[n]); 542 printf(" %02x",cbc_out[n]);
543 printf("\n"); 543 printf("\n");
544 for(n=0 ; n < i ; ++n) 544 for(n=0 ; n < i ; ++n)
545 printf(" %02x",cbc3_ok[n]); 545 printf(" %02x",cbc3_ok[n]);
546 printf("\n"); 546 printf("\n");
547 err=1; 547 err=1;
548 } 548 }
549 549
550 memcpy(iv3,cbc_iv,sizeof(cbc_iv)); 550 memcpy(iv3,cbc_iv,sizeof(cbc_iv));
551 DES_ede3_cbc_encrypt(cbc_out,cbc_in,i,ks,ks2,ks3,&iv3,DES_DECRYPT); 551 DES_ede3_cbc_encrypt(cbc_out,cbc_in,i,&ks,&ks2,&ks3,&iv3,DES_DECRYPT);
552 if (memcmp(cbc_in,cbc_data,strlen((char *)cbc_data)+1) != 0) 552 if (memcmp(cbc_in,cbc_data,strlen((char *)cbc_data)+1) != 0)
553 { 553 {
554 int n; 554 int n;
555 555
556 printf("DES_ede3_cbc_encrypt decrypt error\n"); 556 printf("DES_ede3_cbc_encrypt decrypt error\n");
557 for(n=0 ; n < i ; ++n) 557 for(n=0 ; n < i ; ++n)
558 printf(" %02x",cbc_data[n]); 558 printf(" %02x",cbc_data[n]);
559 printf("\n"); 559 printf("\n");
560 for(n=0 ; n < i ; ++n) 560 for(n=0 ; n < i ; ++n)
561 printf(" %02x",cbc_in[n]); 561 printf(" %02x",cbc_in[n]);
562 printf("\n"); 562 printf("\n");
563 err=1; 563 err=1;
564 } 564 }
565 565
566#ifndef LIBDES_LIT 566#ifndef LIBDES_LIT
567 printf("Doing pcbc\n"); 567 printf("Doing pcbc\n");
568 if ((j=DES_set_key_checked(&cbc_key,&ks)) != 0) 568 if ((j=DES_set_key_checked(&cbc_key,&ks)) != 0)
569 { 569 {
570 printf("Key error %d\n",j); 570 printf("Key error %d\n",j);
571 err=1; 571 err=1;
572 } 572 }
573 memset(cbc_out,0,40); 573 memset(cbc_out,0,40);
574 memset(cbc_in,0,40); 574 memset(cbc_in,0,40);
575 DES_pcbc_encrypt(cbc_data,cbc_out,strlen((char *)cbc_data)+1,ks, 575 DES_pcbc_encrypt(cbc_data,cbc_out,strlen((char *)cbc_data)+1,&ks,
576 &cbc_iv,DES_ENCRYPT); 576 &cbc_iv,DES_ENCRYPT);
577 if (memcmp(cbc_out,pcbc_ok,32) != 0) 577 if (memcmp(cbc_out,pcbc_ok,32) != 0)
578 { 578 {
579 printf("pcbc_encrypt encrypt error\n"); 579 printf("pcbc_encrypt encrypt error\n");
580 err=1; 580 err=1;
581 } 581 }
582 DES_pcbc_encrypt(cbc_out,cbc_in,strlen((char *)cbc_data)+1,ks,&cbc_iv, 582 DES_pcbc_encrypt(cbc_out,cbc_in,strlen((char *)cbc_data)+1,&ks,&cbc_iv,
583 DES_DECRYPT); 583 DES_DECRYPT);
584 if (memcmp(cbc_in,cbc_data,strlen((char *)cbc_data)+1) != 0) 584 if (memcmp(cbc_in,cbc_data,strlen((char *)cbc_data)+1) != 0)
585 { 585 {
586 printf("pcbc_encrypt decrypt error\n"); 586 printf("pcbc_encrypt decrypt error\n");
587 err=1; 587 err=1;
588 } 588 }
589 589
590 printf("Doing "); 590 printf("Doing ");
591 printf("cfb8 "); 591 printf("cfb8 ");
592 err+=cfb_test(8,cfb_cipher8); 592 err+=cfb_test(8,cfb_cipher8);
593 printf("cfb16 "); 593 printf("cfb16 ");
594 err+=cfb_test(16,cfb_cipher16); 594 err+=cfb_test(16,cfb_cipher16);
595 printf("cfb32 "); 595 printf("cfb32 ");
596 err+=cfb_test(32,cfb_cipher32); 596 err+=cfb_test(32,cfb_cipher32);
597 printf("cfb48 "); 597 printf("cfb48 ");
598 err+=cfb_test(48,cfb_cipher48); 598 err+=cfb_test(48,cfb_cipher48);
599 printf("cfb64 "); 599 printf("cfb64 ");
600 err+=cfb_test(64,cfb_cipher64); 600 err+=cfb_test(64,cfb_cipher64);
601 601
602 printf("cfb64() "); 602 printf("cfb64() ");
603 err+=cfb64_test(cfb_cipher64); 603 err+=cfb64_test(cfb_cipher64);
604 604
605 memcpy(cfb_tmp,cfb_iv,sizeof(cfb_iv)); 605 memcpy(cfb_tmp,cfb_iv,sizeof(cfb_iv));
606 for (i=0; i<sizeof(plain); i++) 606 for (i=0; i<sizeof(plain); i++)
607 DES_cfb_encrypt(&(plain[i]),&(cfb_buf1[i]), 607 DES_cfb_encrypt(&(plain[i]),&(cfb_buf1[i]),
608 8,1,ks,&cfb_tmp,DES_ENCRYPT); 608 8,1,&ks,&cfb_tmp,DES_ENCRYPT);
609 if (memcmp(cfb_cipher8,cfb_buf1,sizeof(plain)) != 0) 609 if (memcmp(cfb_cipher8,cfb_buf1,sizeof(plain)) != 0)
610 { 610 {
611 printf("cfb_encrypt small encrypt error\n"); 611 printf("cfb_encrypt small encrypt error\n");
612 err=1; 612 err=1;
613 } 613 }
614 614
615 memcpy(cfb_tmp,cfb_iv,sizeof(cfb_iv)); 615 memcpy(cfb_tmp,cfb_iv,sizeof(cfb_iv));
616 for (i=0; i<sizeof(plain); i++) 616 for (i=0; i<sizeof(plain); i++)
617 DES_cfb_encrypt(&(cfb_buf1[i]),&(cfb_buf2[i]), 617 DES_cfb_encrypt(&(cfb_buf1[i]),&(cfb_buf2[i]),
618 8,1,ks,&cfb_tmp,DES_DECRYPT); 618 8,1,&ks,&cfb_tmp,DES_DECRYPT);
619 if (memcmp(plain,cfb_buf2,sizeof(plain)) != 0) 619 if (memcmp(plain,cfb_buf2,sizeof(plain)) != 0)
620 { 620 {
621 printf("cfb_encrypt small decrypt error\n"); 621 printf("cfb_encrypt small decrypt error\n");
622 err=1; 622 err=1;
623 } 623 }
624 624
625 printf("ede_cfb64() "); 625 printf("ede_cfb64() ");
626 err+=ede_cfb64_test(cfb_cipher64); 626 err+=ede_cfb64_test(cfb_cipher64);
627 627
628 printf("done\n"); 628 printf("done\n");
629 629
630 printf("Doing ofb\n"); 630 printf("Doing ofb\n");
631 DES_set_key_checked(&ofb_key,&ks); 631 DES_set_key_checked(&ofb_key,&ks);
632 memcpy(ofb_tmp,ofb_iv,sizeof(ofb_iv)); 632 memcpy(ofb_tmp,ofb_iv,sizeof(ofb_iv));
633 DES_ofb_encrypt(plain,ofb_buf1,64,sizeof(plain)/8,ks,&ofb_tmp); 633 DES_ofb_encrypt(plain,ofb_buf1,64,sizeof(plain)/8,&ks,&ofb_tmp);
634 if (memcmp(ofb_cipher,ofb_buf1,sizeof(ofb_buf1)) != 0) 634 if (memcmp(ofb_cipher,ofb_buf1,sizeof(ofb_buf1)) != 0)
635 { 635 {
636 printf("ofb_encrypt encrypt error\n"); 636 printf("ofb_encrypt encrypt error\n");
637printf("%02X %02X %02X %02X %02X %02X %02X %02X\n", 637printf("%02X %02X %02X %02X %02X %02X %02X %02X\n",
638ofb_buf1[8+0], ofb_buf1[8+1], ofb_buf1[8+2], ofb_buf1[8+3], 638ofb_buf1[8+0], ofb_buf1[8+1], ofb_buf1[8+2], ofb_buf1[8+3],
639ofb_buf1[8+4], ofb_buf1[8+5], ofb_buf1[8+6], ofb_buf1[8+7]); 639ofb_buf1[8+4], ofb_buf1[8+5], ofb_buf1[8+6], ofb_buf1[8+7]);
640printf("%02X %02X %02X %02X %02X %02X %02X %02X\n", 640printf("%02X %02X %02X %02X %02X %02X %02X %02X\n",
641ofb_buf1[8+0], ofb_cipher[8+1], ofb_cipher[8+2], ofb_cipher[8+3], 641ofb_buf1[8+0], ofb_cipher[8+1], ofb_cipher[8+2], ofb_cipher[8+3],
642ofb_buf1[8+4], ofb_cipher[8+5], ofb_cipher[8+6], ofb_cipher[8+7]); 642ofb_buf1[8+4], ofb_cipher[8+5], ofb_cipher[8+6], ofb_cipher[8+7]);
643 err=1; 643 err=1;
644 } 644 }
645 memcpy(ofb_tmp,ofb_iv,sizeof(ofb_iv)); 645 memcpy(ofb_tmp,ofb_iv,sizeof(ofb_iv));
646 DES_ofb_encrypt(ofb_buf1,ofb_buf2,64,sizeof(ofb_buf1)/8,ks,&ofb_tmp); 646 DES_ofb_encrypt(ofb_buf1,ofb_buf2,64,sizeof(ofb_buf1)/8,&ks,&ofb_tmp);
647 if (memcmp(plain,ofb_buf2,sizeof(ofb_buf2)) != 0) 647 if (memcmp(plain,ofb_buf2,sizeof(ofb_buf2)) != 0)
648 { 648 {
649 printf("ofb_encrypt decrypt error\n"); 649 printf("ofb_encrypt decrypt error\n");
650printf("%02X %02X %02X %02X %02X %02X %02X %02X\n", 650printf("%02X %02X %02X %02X %02X %02X %02X %02X\n",
651ofb_buf2[8+0], ofb_buf2[8+1], ofb_buf2[8+2], ofb_buf2[8+3], 651ofb_buf2[8+0], ofb_buf2[8+1], ofb_buf2[8+2], ofb_buf2[8+3],
652ofb_buf2[8+4], ofb_buf2[8+5], ofb_buf2[8+6], ofb_buf2[8+7]); 652ofb_buf2[8+4], ofb_buf2[8+5], ofb_buf2[8+6], ofb_buf2[8+7]);
653printf("%02X %02X %02X %02X %02X %02X %02X %02X\n", 653printf("%02X %02X %02X %02X %02X %02X %02X %02X\n",
654plain[8+0], plain[8+1], plain[8+2], plain[8+3], 654plain[8+0], plain[8+1], plain[8+2], plain[8+3],
655plain[8+4], plain[8+5], plain[8+6], plain[8+7]); 655plain[8+4], plain[8+5], plain[8+6], plain[8+7]);
656 err=1; 656 err=1;
657 } 657 }
658 658
659 printf("Doing ofb64\n"); 659 printf("Doing ofb64\n");
660 DES_set_key_checked(&ofb_key,&ks); 660 DES_set_key_checked(&ofb_key,&ks);
661 memcpy(ofb_tmp,ofb_iv,sizeof(ofb_iv)); 661 memcpy(ofb_tmp,ofb_iv,sizeof(ofb_iv));
662 memset(ofb_buf1,0,sizeof(ofb_buf1)); 662 memset(ofb_buf1,0,sizeof(ofb_buf1));
663 memset(ofb_buf2,0,sizeof(ofb_buf1)); 663 memset(ofb_buf2,0,sizeof(ofb_buf1));
664 num=0; 664 num=0;
665 for (i=0; i<sizeof(plain); i++) 665 for (i=0; i<sizeof(plain); i++)
666 { 666 {
667 DES_ofb64_encrypt(&(plain[i]),&(ofb_buf1[i]),1,ks,&ofb_tmp, 667 DES_ofb64_encrypt(&(plain[i]),&(ofb_buf1[i]),1,&ks,&ofb_tmp,
668 &num); 668 &num);
669 } 669 }
670 if (memcmp(ofb_cipher,ofb_buf1,sizeof(ofb_buf1)) != 0) 670 if (memcmp(ofb_cipher,ofb_buf1,sizeof(ofb_buf1)) != 0)
671 { 671 {
672 printf("ofb64_encrypt encrypt error\n"); 672 printf("ofb64_encrypt encrypt error\n");
673 err=1; 673 err=1;
674 } 674 }
675 memcpy(ofb_tmp,ofb_iv,sizeof(ofb_iv)); 675 memcpy(ofb_tmp,ofb_iv,sizeof(ofb_iv));
676 num=0; 676 num=0;
677 DES_ofb64_encrypt(ofb_buf1,ofb_buf2,sizeof(ofb_buf1),ks,&ofb_tmp, 677 DES_ofb64_encrypt(ofb_buf1,ofb_buf2,sizeof(ofb_buf1),&ks,&ofb_tmp,
678 &num); 678 &num);
679 if (memcmp(plain,ofb_buf2,sizeof(ofb_buf2)) != 0) 679 if (memcmp(plain,ofb_buf2,sizeof(ofb_buf2)) != 0)
680 { 680 {
681 printf("ofb64_encrypt decrypt error\n"); 681 printf("ofb64_encrypt decrypt error\n");
682 err=1; 682 err=1;
683 } 683 }
684 684
685 printf("Doing ede_ofb64\n"); 685 printf("Doing ede_ofb64\n");
686 DES_set_key_checked(&ofb_key,&ks); 686 DES_set_key_checked(&ofb_key,&ks);
687 memcpy(ofb_tmp,ofb_iv,sizeof(ofb_iv)); 687 memcpy(ofb_tmp,ofb_iv,sizeof(ofb_iv));
688 memset(ofb_buf1,0,sizeof(ofb_buf1)); 688 memset(ofb_buf1,0,sizeof(ofb_buf1));
689 memset(ofb_buf2,0,sizeof(ofb_buf1)); 689 memset(ofb_buf2,0,sizeof(ofb_buf1));
690 num=0; 690 num=0;
691 for (i=0; i<sizeof(plain); i++) 691 for (i=0; i<sizeof(plain); i++)
692 { 692 {
693 DES_ede3_ofb64_encrypt(&(plain[i]),&(ofb_buf1[i]),1,ks,ks, 693 DES_ede3_ofb64_encrypt(&(plain[i]),&(ofb_buf1[i]),1,&ks,&ks,
694 ks,&ofb_tmp,&num); 694 &ks,&ofb_tmp,&num);
695 } 695 }
696 if (memcmp(ofb_cipher,ofb_buf1,sizeof(ofb_buf1)) != 0) 696 if (memcmp(ofb_cipher,ofb_buf1,sizeof(ofb_buf1)) != 0)
697 { 697 {
698 printf("ede_ofb64_encrypt encrypt error\n"); 698 printf("ede_ofb64_encrypt encrypt error\n");
699 err=1; 699 err=1;
700 } 700 }
701 memcpy(ofb_tmp,ofb_iv,sizeof(ofb_iv)); 701 memcpy(ofb_tmp,ofb_iv,sizeof(ofb_iv));
702 num=0; 702 num=0;
703 DES_ede3_ofb64_encrypt(ofb_buf1,ofb_buf2,sizeof(ofb_buf1),ks,ks,ks, 703 DES_ede3_ofb64_encrypt(ofb_buf1,ofb_buf2,sizeof(ofb_buf1),&ks,&ks,&ks,
704 &ofb_tmp,&num); 704 &ofb_tmp,&num);
705 if (memcmp(plain,ofb_buf2,sizeof(ofb_buf2)) != 0) 705 if (memcmp(plain,ofb_buf2,sizeof(ofb_buf2)) != 0)
706 { 706 {
707 printf("ede_ofb64_encrypt decrypt error\n"); 707 printf("ede_ofb64_encrypt decrypt error\n");
708 err=1; 708 err=1;
709 } 709 }
710 710
711 printf("Doing cbc_cksum\n"); 711 printf("Doing cbc_cksum\n");
712 DES_set_key_checked(&cbc_key,&ks); 712 DES_set_key_checked(&cbc_key,&ks);
713 cs=DES_cbc_cksum(cbc_data,&cret,strlen((char *)cbc_data),ks,&cbc_iv); 713 cs=DES_cbc_cksum(cbc_data,&cret,strlen((char *)cbc_data),&ks,&cbc_iv);
714 if (cs != cbc_cksum_ret) 714 if (cs != cbc_cksum_ret)
715 { 715 {
716 printf("bad return value (%08lX), should be %08lX\n", 716 printf("bad return value (%08lX), should be %08lX\n",
717 (unsigned long)cs,(unsigned long)cbc_cksum_ret); 717 (unsigned long)cs,(unsigned long)cbc_cksum_ret);
718 err=1; 718 err=1;
719 } 719 }
720 if (memcmp(cret,cbc_cksum_data,8) != 0) 720 if (memcmp(cret,cbc_cksum_data,8) != 0)
721 { 721 {
722 printf("bad cbc_cksum block returned\n"); 722 printf("bad cbc_cksum block returned\n");
723 err=1; 723 err=1;
724 } 724 }
725 725
726 printf("Doing quad_cksum\n"); 726 printf("Doing quad_cksum\n");
@@ -780,35 +780,35 @@ plain[8+4], plain[8+5], plain[8+6], plai @@ -780,35 +780,35 @@ plain[8+4], plain[8+5], plain[8+6], plai
780 { 780 {
781 printf("quad_cksum error, out[3] %08lx is not %08lx\n", 781 printf("quad_cksum error, out[3] %08lx is not %08lx\n",
782 (unsigned long)lqret[3],0x501c2c26UL); 782 (unsigned long)lqret[3],0x501c2c26UL);
783 err=1; 783 err=1;
784 } 784 }
785#endif 785#endif
786#endif 786#endif
787 787
788 printf("input word alignment test"); 788 printf("input word alignment test");
789 for (i=0; i<4; i++) 789 for (i=0; i<4; i++)
790 { 790 {
791 printf(" %d",i); 791 printf(" %d",i);
792 DES_ncbc_encrypt(&(cbc_out[i]),cbc_in, 792 DES_ncbc_encrypt(&(cbc_out[i]),cbc_in,
793 strlen((char *)cbc_data)+1,ks, 793 strlen((char *)cbc_data)+1,&ks,
794 &cbc_iv,DES_ENCRYPT); 794 &cbc_iv,DES_ENCRYPT);
795 } 795 }
796 printf("\noutput word alignment test"); 796 printf("\noutput word alignment test");
797 for (i=0; i<4; i++) 797 for (i=0; i<4; i++)
798 { 798 {
799 printf(" %d",i); 799 printf(" %d",i);
800 DES_ncbc_encrypt(cbc_out,&(cbc_in[i]), 800 DES_ncbc_encrypt(cbc_out,&(cbc_in[i]),
801 strlen((char *)cbc_data)+1,ks, 801 strlen((char *)cbc_data)+1,&ks,
802 &cbc_iv,DES_ENCRYPT); 802 &cbc_iv,DES_ENCRYPT);
803 } 803 }
804 printf("\n"); 804 printf("\n");
805 printf("fast crypt test "); 805 printf("fast crypt test ");
806 str=crypt("testing","ef"); 806 str=crypt("testing","ef");
807 if (strcmp("efGnQx2725bI2",str) != 0) 807 if (strcmp("efGnQx2725bI2",str) != 0)
808 { 808 {
809 printf("fast crypt error, %s should be efGnQx2725bI2\n",str); 809 printf("fast crypt error, %s should be efGnQx2725bI2\n",str);
810 err=1; 810 err=1;
811 } 811 }
812 str=crypt("bca76;23","yA"); 812 str=crypt("bca76;23","yA");
813 if (strcmp("yA1Rp/1hZXIJk",str) != 0) 813 if (strcmp("yA1Rp/1hZXIJk",str) != 0)
814 { 814 {
@@ -840,107 +840,107 @@ static char *pt(unsigned char *p) @@ -840,107 +840,107 @@ static char *pt(unsigned char *p)
840 ret[16]='\0'; 840 ret[16]='\0';
841 return(ret); 841 return(ret);
842 } 842 }
843 843
844#ifndef LIBDES_LIT 844#ifndef LIBDES_LIT
845 845
846static int cfb_test(int bits, unsigned char *cfb_cipher) 846static int cfb_test(int bits, unsigned char *cfb_cipher)
847 { 847 {
848 DES_key_schedule ks; 848 DES_key_schedule ks;
849 int i,err=0; 849 int i,err=0;
850 850
851 DES_set_key_checked(&cfb_key,&ks); 851 DES_set_key_checked(&cfb_key,&ks);
852 memcpy(cfb_tmp,cfb_iv,sizeof(cfb_iv)); 852 memcpy(cfb_tmp,cfb_iv,sizeof(cfb_iv));
853 DES_cfb_encrypt(plain,cfb_buf1,bits,sizeof(plain),ks,&cfb_tmp, 853 DES_cfb_encrypt(plain,cfb_buf1,bits,sizeof(plain),&ks,&cfb_tmp,
854 DES_ENCRYPT); 854 DES_ENCRYPT);
855 if (memcmp(cfb_cipher,cfb_buf1,sizeof(plain)) != 0) 855 if (memcmp(cfb_cipher,cfb_buf1,sizeof(plain)) != 0)
856 { 856 {
857 err=1; 857 err=1;
858 printf("cfb_encrypt encrypt error\n"); 858 printf("cfb_encrypt encrypt error\n");
859 for (i=0; i<24; i+=8) 859 for (i=0; i<24; i+=8)
860 printf("%s\n",pt(&(cfb_buf1[i]))); 860 printf("%s\n",pt(&(cfb_buf1[i])));
861 } 861 }
862 memcpy(cfb_tmp,cfb_iv,sizeof(cfb_iv)); 862 memcpy(cfb_tmp,cfb_iv,sizeof(cfb_iv));
863 DES_cfb_encrypt(cfb_buf1,cfb_buf2,bits,sizeof(plain),ks,&cfb_tmp, 863 DES_cfb_encrypt(cfb_buf1,cfb_buf2,bits,sizeof(plain),&ks,&cfb_tmp,
864 DES_DECRYPT); 864 DES_DECRYPT);
865 if (memcmp(plain,cfb_buf2,sizeof(plain)) != 0) 865 if (memcmp(plain,cfb_buf2,sizeof(plain)) != 0)
866 { 866 {
867 err=1; 867 err=1;
868 printf("cfb_encrypt decrypt error\n"); 868 printf("cfb_encrypt decrypt error\n");
869 for (i=0; i<24; i+=8) 869 for (i=0; i<24; i+=8)
870 printf("%s\n",pt(&(cfb_buf1[i]))); 870 printf("%s\n",pt(&(cfb_buf1[i])));
871 } 871 }
872 return(err); 872 return(err);
873 } 873 }
874 874
875static int cfb64_test(unsigned char *cfb_cipher) 875static int cfb64_test(unsigned char *cfb_cipher)
876 { 876 {
877 DES_key_schedule ks; 877 DES_key_schedule ks;
878 int err=0,i,n; 878 int err=0,i,n;
879 879
880 DES_set_key_checked(&cfb_key,&ks); 880 DES_set_key_checked(&cfb_key,&ks);
881 memcpy(cfb_tmp,cfb_iv,sizeof(cfb_iv)); 881 memcpy(cfb_tmp,cfb_iv,sizeof(cfb_iv));
882 n=0; 882 n=0;
883 DES_cfb64_encrypt(plain,cfb_buf1,12,ks,&cfb_tmp,&n,DES_ENCRYPT); 883 DES_cfb64_encrypt(plain,cfb_buf1,12,&ks,&cfb_tmp,&n,DES_ENCRYPT);
884 DES_cfb64_encrypt(&(plain[12]),&(cfb_buf1[12]),sizeof(plain)-12,ks, 884 DES_cfb64_encrypt(&(plain[12]),&(cfb_buf1[12]),sizeof(plain)-12,&ks,
885 &cfb_tmp,&n,DES_ENCRYPT); 885 &cfb_tmp,&n,DES_ENCRYPT);
886 if (memcmp(cfb_cipher,cfb_buf1,sizeof(plain)) != 0) 886 if (memcmp(cfb_cipher,cfb_buf1,sizeof(plain)) != 0)
887 { 887 {
888 err=1; 888 err=1;
889 printf("cfb_encrypt encrypt error\n"); 889 printf("cfb_encrypt encrypt error\n");
890 for (i=0; i<24; i+=8) 890 for (i=0; i<24; i+=8)
891 printf("%s\n",pt(&(cfb_buf1[i]))); 891 printf("%s\n",pt(&(cfb_buf1[i])));
892 } 892 }
893 memcpy(cfb_tmp,cfb_iv,sizeof(cfb_iv)); 893 memcpy(cfb_tmp,cfb_iv,sizeof(cfb_iv));
894 n=0; 894 n=0;
895 DES_cfb64_encrypt(cfb_buf1,cfb_buf2,17,ks,&cfb_tmp,&n,DES_DECRYPT); 895 DES_cfb64_encrypt(cfb_buf1,cfb_buf2,17,&ks,&cfb_tmp,&n,DES_DECRYPT);
896 DES_cfb64_encrypt(&(cfb_buf1[17]),&(cfb_buf2[17]), 896 DES_cfb64_encrypt(&(cfb_buf1[17]),&(cfb_buf2[17]),
897 sizeof(plain)-17,ks,&cfb_tmp,&n,DES_DECRYPT); 897 sizeof(plain)-17,&ks,&cfb_tmp,&n,DES_DECRYPT);
898 if (memcmp(plain,cfb_buf2,sizeof(plain)) != 0) 898 if (memcmp(plain,cfb_buf2,sizeof(plain)) != 0)
899 { 899 {
900 err=1; 900 err=1;
901 printf("cfb_encrypt decrypt error\n"); 901 printf("cfb_encrypt decrypt error\n");
902 for (i=0; i<24; i+=8) 902 for (i=0; i<24; i+=8)
903 printf("%s\n",pt(&(cfb_buf2[i]))); 903 printf("%s\n",pt(&(cfb_buf2[i])));
904 } 904 }
905 return(err); 905 return(err);
906 } 906 }
907 907
908static int ede_cfb64_test(unsigned char *cfb_cipher) 908static int ede_cfb64_test(unsigned char *cfb_cipher)
909 { 909 {
910 DES_key_schedule ks; 910 DES_key_schedule ks;
911 int err=0,i,n; 911 int err=0,i,n;
912 912
913 DES_set_key_checked(&cfb_key,&ks); 913 DES_set_key_checked(&cfb_key,&ks);
914 memcpy(cfb_tmp,cfb_iv,sizeof(cfb_iv)); 914 memcpy(cfb_tmp,cfb_iv,sizeof(cfb_iv));
915 n=0; 915 n=0;
916 DES_ede3_cfb64_encrypt(plain,cfb_buf1,12,ks,ks,ks,&cfb_tmp,&n, 916 DES_ede3_cfb64_encrypt(plain,cfb_buf1,12,&ks,&ks,&ks,&cfb_tmp,&n,
917 DES_ENCRYPT); 917 DES_ENCRYPT);
918 DES_ede3_cfb64_encrypt(&(plain[12]),&(cfb_buf1[12]), 918 DES_ede3_cfb64_encrypt(&(plain[12]),&(cfb_buf1[12]),
919 sizeof(plain)-12,ks,ks,ks, 919 sizeof(plain)-12,&ks,&ks,&ks,
920 &cfb_tmp,&n,DES_ENCRYPT); 920 &cfb_tmp,&n,DES_ENCRYPT);
921 if (memcmp(cfb_cipher,cfb_buf1,sizeof(plain)) != 0) 921 if (memcmp(cfb_cipher,cfb_buf1,sizeof(plain)) != 0)
922 { 922 {
923 err=1; 923 err=1;
924 printf("ede_cfb_encrypt encrypt error\n"); 924 printf("ede_cfb_encrypt encrypt error\n");
925 for (i=0; i<24; i+=8) 925 for (i=0; i<24; i+=8)
926 printf("%s\n",pt(&(cfb_buf1[i]))); 926 printf("%s\n",pt(&(cfb_buf1[i])));
927 } 927 }
928 memcpy(cfb_tmp,cfb_iv,sizeof(cfb_iv)); 928 memcpy(cfb_tmp,cfb_iv,sizeof(cfb_iv));
929 n=0; 929 n=0;
930 DES_ede3_cfb64_encrypt(cfb_buf1,cfb_buf2,(long)17,ks,ks,ks, 930 DES_ede3_cfb64_encrypt(cfb_buf1,cfb_buf2,(long)17,&ks,&ks,&ks,
931 &cfb_tmp,&n,DES_DECRYPT); 931 &cfb_tmp,&n,DES_DECRYPT);
932 DES_ede3_cfb64_encrypt(&(cfb_buf1[17]),&(cfb_buf2[17]), 932 DES_ede3_cfb64_encrypt(&(cfb_buf1[17]),&(cfb_buf2[17]),
933 sizeof(plain)-17,ks,ks,ks, 933 sizeof(plain)-17,&ks,&ks,&ks,
934 &cfb_tmp,&n,DES_DECRYPT); 934 &cfb_tmp,&n,DES_DECRYPT);
935 if (memcmp(plain,cfb_buf2,sizeof(plain)) != 0) 935 if (memcmp(plain,cfb_buf2,sizeof(plain)) != 0)
936 { 936 {
937 err=1; 937 err=1;
938 printf("ede_cfb_encrypt decrypt error\n"); 938 printf("ede_cfb_encrypt decrypt error\n");
939 for (i=0; i<24; i+=8) 939 for (i=0; i<24; i+=8)
940 printf("%s\n",pt(&(cfb_buf2[i]))); 940 printf("%s\n",pt(&(cfb_buf2[i])));
941 } 941 }
942 return(err); 942 return(err);
943 } 943 }
944 944
945#endif 945#endif
946#endif 946#endif

cvs diff -r1.2 -r1.3 src/crypto/external/bsd/openssl/dist/crypto/lhash/Attic/lh_test.c (expand / switch to unified diff)

--- src/crypto/external/bsd/openssl/dist/crypto/lhash/Attic/lh_test.c 2009/07/19 23:30:40 1.2
+++ src/crypto/external/bsd/openssl/dist/crypto/lhash/Attic/lh_test.c 2009/07/20 20:41:05 1.3
@@ -53,27 +53,27 @@ @@ -53,27 +53,27 @@
53 * The licence and distribution terms for any publically available version or 53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be 54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence 55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.] 56 * [including the GNU Public Licence.]
57 */ 57 */
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include <stdlib.h> 60#include <stdlib.h>
61#include <string.h> 61#include <string.h>
62#include <openssl/lhash.h> 62#include <openssl/lhash.h>
63 63
64main() 64main()
65 { 65 {
66 LHASH *conf; 66 _LHASH *conf;
67 char buf[256]; 67 char buf[256];
68 int i; 68 int i;
69 69
70 conf=lh_new(lh_strhash,(int (*)(const void *, const void *))strcmp); 70 conf=lh_new(lh_strhash,(int (*)(const void *, const void *))strcmp);
71 for (;;) 71 for (;;)
72 { 72 {
73 char *p; 73 char *p;
74 74
75 buf[0]='\0'; 75 buf[0]='\0';
76 fgets(buf,256,stdin); 76 fgets(buf,256,stdin);
77 if (buf[0] == '\0') break; 77 if (buf[0] == '\0') break;
78 i=strlen(buf); 78 i=strlen(buf);
79 p=OPENSSL_malloc(i+1); 79 p=OPENSSL_malloc(i+1);

cvs diff -r1.2 -r1.3 src/crypto/external/bsd/openssl/dist/crypto/md2/Attic/md2test.c (expand / switch to unified diff)

--- src/crypto/external/bsd/openssl/dist/crypto/md2/Attic/md2test.c 2009/07/19 23:30:40 1.2
+++ src/crypto/external/bsd/openssl/dist/crypto/md2/Attic/md2test.c 2009/07/20 20:41:05 1.3
@@ -127,17 +127,17 @@ int main(int argc, char *argv[]) @@ -127,17 +127,17 @@ int main(int argc, char *argv[])
127#ifdef OPENSSL_SYS_NETWARE 127#ifdef OPENSSL_SYS_NETWARE
128 if (err) printf("ERROR: %d\n", err); 128 if (err) printf("ERROR: %d\n", err);
129#endif 129#endif
130 EXIT(err); 130 EXIT(err);
131 return err; 131 return err;
132 } 132 }
133 133
134static char *pt(unsigned char *md) 134static char *pt(unsigned char *md)
135 { 135 {
136 int i; 136 int i;
137 static char buf[80]; 137 static char buf[80];
138 138
139 for (i=0; i<MD2_DIGEST_LENGTH; i++) 139 for (i=0; i<MD2_DIGEST_LENGTH; i++)
140 snprintf(&(buf[i*2]),, sizeof(buf) - i * 2, "%02x",md[i]); 140 snprintf(&(buf[i*2]), sizeof(buf) - i * 2, "%02x",md[i]);
141 return(buf); 141 return(buf);
142 } 142 }
143#endif 143#endif

cvs diff -r1.2 -r1.3 src/crypto/external/bsd/openssl/dist/crypto/threads/Attic/mttest.c (expand / switch to unified diff)

--- src/crypto/external/bsd/openssl/dist/crypto/threads/Attic/mttest.c 2009/07/19 23:30:42 1.2
+++ src/crypto/external/bsd/openssl/dist/crypto/threads/Attic/mttest.c 2009/07/20 20:41:06 1.3
@@ -338,31 +338,31 @@ end: @@ -338,31 +338,31 @@ end:
338 if (c_ctx != NULL)  338 if (c_ctx != NULL)
339 { 339 {
340 fprintf(stderr,"Client SSL_CTX stats then free it\n"); 340 fprintf(stderr,"Client SSL_CTX stats then free it\n");
341 print_stats(stderr,c_ctx); 341 print_stats(stderr,c_ctx);
342 SSL_CTX_free(c_ctx); 342 SSL_CTX_free(c_ctx);
343 } 343 }
344 if (s_ctx != NULL) 344 if (s_ctx != NULL)
345 { 345 {
346 fprintf(stderr,"Server SSL_CTX stats then free it\n"); 346 fprintf(stderr,"Server SSL_CTX stats then free it\n");
347 print_stats(stderr,s_ctx); 347 print_stats(stderr,s_ctx);
348 if (cache_stats) 348 if (cache_stats)
349 { 349 {
350 fprintf(stderr,"-----\n"); 350 fprintf(stderr,"-----\n");
351 lh_stats(SSL_CTX_sessions(s_ctx),stderr); 351 lh_stats((_LHASH *)SSL_CTX_sessions(s_ctx),stderr);
352 fprintf(stderr,"-----\n"); 352 fprintf(stderr,"-----\n");
353 /* lh_node_stats(SSL_CTX_sessions(s_ctx),stderr); 353 /* lh_node_stats((_LHASH *)SSL_CTX_sessions(s_ctx),stderr);
354 fprintf(stderr,"-----\n"); */ 354 fprintf(stderr,"-----\n"); */
355 lh_node_usage_stats(SSL_CTX_sessions(s_ctx),stderr); 355 lh_node_usage_stats((_LHASH *)SSL_CTX_sessions(s_ctx),stderr);
356 fprintf(stderr,"-----\n"); 356 fprintf(stderr,"-----\n");
357 } 357 }
358 SSL_CTX_free(s_ctx); 358 SSL_CTX_free(s_ctx);
359 fprintf(stderr,"done free\n"); 359 fprintf(stderr,"done free\n");
360 } 360 }
361 exit(ret); 361 exit(ret);
362 return(0); 362 return(0);
363 } 363 }
364 364
365#define W_READ 1 365#define W_READ 1
366#define W_WRITE 2 366#define W_WRITE 2
367#define C_DONE 1 367#define C_DONE 1
368#define S_DONE 2 368#define S_DONE 2

cvs diff -r1.2 -r1.3 src/crypto/external/bsd/openssl/dist/crypto/x509v3/Attic/tabtest.c (expand / switch to unified diff)

--- src/crypto/external/bsd/openssl/dist/crypto/x509v3/Attic/tabtest.c 2009/07/19 23:30:42 1.2
+++ src/crypto/external/bsd/openssl/dist/crypto/x509v3/Attic/tabtest.c 2009/07/20 20:41:06 1.3
@@ -59,27 +59,27 @@ @@ -59,27 +59,27 @@
59/* Simple program to check the ext_dat.h is correct and print out 59/* Simple program to check the ext_dat.h is correct and print out
60 * problems if it is not. 60 * problems if it is not.
61 */ 61 */
62 62
63#include <stdio.h> 63#include <stdio.h>
64 64
65#include <openssl/x509v3.h> 65#include <openssl/x509v3.h>
66 66
67#include "ext_dat.h" 67#include "ext_dat.h"
68 68
69main() 69main()
70{ 70{
71 int i, prev = -1, bad = 0; 71 int i, prev = -1, bad = 0;
72 X509V3_EXT_METHOD **tmp; 72 const X509V3_EXT_METHOD **tmp;
73 i = sizeof(standard_exts) / sizeof(X509V3_EXT_METHOD *); 73 i = sizeof(standard_exts) / sizeof(X509V3_EXT_METHOD *);
74 if(i != STANDARD_EXTENSION_COUNT) 74 if(i != STANDARD_EXTENSION_COUNT)
75 fprintf(stderr, "Extension number invalid expecting %d\n", i); 75 fprintf(stderr, "Extension number invalid expecting %d\n", i);
76 tmp = standard_exts; 76 tmp = standard_exts;
77 for(i = 0; i < STANDARD_EXTENSION_COUNT; i++, tmp++) { 77 for(i = 0; i < STANDARD_EXTENSION_COUNT; i++, tmp++) {
78 if((*tmp)->ext_nid < prev) bad = 1; 78 if((*tmp)->ext_nid < prev) bad = 1;
79 prev = (*tmp)->ext_nid; 79 prev = (*tmp)->ext_nid;
80  80
81 } 81 }
82 if(bad) { 82 if(bad) {
83 tmp = standard_exts; 83 tmp = standard_exts;
84 fprintf(stderr, "Extensions out of order!\n"); 84 fprintf(stderr, "Extensions out of order!\n");
85 for(i = 0; i < STANDARD_EXTENSION_COUNT; i++, tmp++) 85 for(i = 0; i < STANDARD_EXTENSION_COUNT; i++, tmp++)