summaryrefslogtreecommitdiff
path: root/packages/openssl/openssl-0.9.7m/debian.patch
blob: f5fd51bf3649e0bb7e08f82180c602efa01c41dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
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
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
312
313
314
315
316
317
318
319
320
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
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
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
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
Index: openssl-0.9.7m/tools/c_rehash.in
===================================================================
--- openssl-0.9.7m.orig/tools/c_rehash.in	2002-10-11 22:35:45.000000000 +0200
+++ openssl-0.9.7m/tools/c_rehash.in	2008-04-12 02:37:45.000000000 +0200
@@ -1,4 +1,4 @@
-#!/usr/local/bin/perl
+#!/usr/bin/perl
 
 
 # Perl c_rehash script, scan all files in a directory
Index: openssl-0.9.7m/tools/c_rehash
===================================================================
--- openssl-0.9.7m.orig/tools/c_rehash	2007-02-23 13:52:38.000000000 +0100
+++ openssl-0.9.7m/tools/c_rehash	2008-04-12 02:37:45.000000000 +0200
@@ -6,7 +6,7 @@
 
 my $openssl;
 
-my $dir = "/usr/local/ssl";
+my $dir = "/usr/lib/ssl";
 
 if(defined $ENV{OPENSSL}) {
 	$openssl = $ENV{OPENSSL};
Index: openssl-0.9.7m/crypto/md5/asm/md5-sparcv9.S
===================================================================
--- openssl-0.9.7m.orig/crypto/md5/asm/md5-sparcv9.S	2003-05-30 00:22:34.000000000 +0200
+++ openssl-0.9.7m/crypto/md5/asm/md5-sparcv9.S	2008-04-12 02:37:45.000000000 +0200
@@ -74,14 +74,14 @@
 #define Dval	R8
 
 #if defined(MD5_BLOCK_DATA_ORDER)
-# if defined(OPENSSL_SYSNAME_ULTRASPARC)
+/*# if defined(OPENSSL_SYSNAME_ULTRASPARC)*/
 #  define	LOAD			lda
 #  define	X(i)			[%i1+i*4]%asi
 #  define	md5_block		md5_block_asm_data_order_aligned
 #  define	ASI_PRIMARY_LITTLE	0x88
-# else
+/*# else
 #  error "MD5_BLOCK_DATA_ORDER is supported only on UltraSPARC!"
-# endif
+# endif*/
 #else
 # define	LOAD			ld
 # define	X(i)			[%i1+i*4]
Index: openssl-0.9.7m/crypto/pkcs7/pk7_mime.c
===================================================================
--- openssl-0.9.7m.orig/crypto/pkcs7/pk7_mime.c	2005-05-01 14:47:33.000000000 +0200
+++ openssl-0.9.7m/crypto/pkcs7/pk7_mime.c	2008-04-12 02:37:45.000000000 +0200
@@ -297,9 +297,9 @@
 
 		if(strcmp(hdr->value, "application/x-pkcs7-signature") &&
 			strcmp(hdr->value, "application/pkcs7-signature")) {
-			sk_MIME_HEADER_pop_free(headers, mime_hdr_free);
 			PKCS7err(PKCS7_F_SMIME_READ_PKCS7,PKCS7_R_SIG_INVALID_MIME_TYPE);
 			ERR_add_error_data(2, "type: ", hdr->value);
+			sk_MIME_HEADER_pop_free(headers, mime_hdr_free);
 			sk_BIO_pop_free(parts, BIO_vfree);
 			return NULL;
 		}
Index: openssl-0.9.7m/crypto/dsa/dsa_ossl.c
===================================================================
--- openssl-0.9.7m.orig/crypto/dsa/dsa_ossl.c	2006-09-28 13:53:49.000000000 +0200
+++ openssl-0.9.7m/crypto/dsa/dsa_ossl.c	2008-04-12 02:37:45.000000000 +0200
@@ -286,6 +286,18 @@
 		return -1;
 		}
 
+	if (BN_num_bits(dsa->q) != 160)
+		{
+		DSAerr(DSA_F_DSA_DO_VERIFY,DSA_R_BAD_Q_VALUE);
+		return -1;
+		}
+
+	if (BN_num_bits(dsa->p) > OPENSSL_DSA_MAX_MODULUS_BITS)
+		{
+		DSAerr(DSA_F_DSA_DO_VERIFY,DSA_R_MODULUS_TOO_LARGE);
+		return -1;
+		}
+
 	BN_init(&u1);
 	BN_init(&u2);
 	BN_init(&t1);
Index: openssl-0.9.7m/crypto/dsa/dsa.h
===================================================================
--- openssl-0.9.7m.orig/crypto/dsa/dsa.h	2006-09-28 13:53:49.000000000 +0200
+++ openssl-0.9.7m/crypto/dsa/dsa.h	2008-04-12 02:37:45.000000000 +0200
@@ -83,6 +83,10 @@
 # define OPENSSL_DSA_MAX_MODULUS_BITS	10000
 #endif
 
+#ifndef OPENSSL_DSA_MAX_MODULUS_BITS
+# define OPENSSL_DSA_MAX_MODULUS_BITS	10000
+#endif
+
 #define DSA_FLAG_CACHE_MONT_P	0x01
 #define DSA_FLAG_NO_EXP_CONSTTIME       0x02 /* new with 0.9.7h; the built-in DSA
                                               * implementation now uses constant time
Index: openssl-0.9.7m/crypto/rc4/asm/rc4-x86_64.pl
===================================================================
--- openssl-0.9.7m.orig/crypto/rc4/asm/rc4-x86_64.pl	2005-05-04 18:12:07.000000000 +0200
+++ openssl-0.9.7m/crypto/rc4/asm/rc4-x86_64.pl	2008-04-12 02:37:45.000000000 +0200
@@ -1,4 +1,4 @@
-#!/usr/bin/env perl
+#!/usr/local/bin/perl
 #
 # ====================================================================
 # Written by Andy Polyakov <appro@fy.chalmers.se> for the OpenSSL
Index: openssl-0.9.7m/crypto/asn1/charmap.pl
===================================================================
--- openssl-0.9.7m.orig/crypto/asn1/charmap.pl	2000-07-28 03:58:11.000000000 +0200
+++ openssl-0.9.7m/crypto/asn1/charmap.pl	2008-04-12 02:37:45.000000000 +0200
@@ -1,4 +1,4 @@
-#!/usr/local/bin/perl -w
+#!/usr/local/bin/perl
 
 use strict;
 
Index: openssl-0.9.7m/crypto/sha/asm/sha1-ia64.pl
===================================================================
--- openssl-0.9.7m.orig/crypto/sha/asm/sha1-ia64.pl	2004-12-09 21:55:52.000000000 +0100
+++ openssl-0.9.7m/crypto/sha/asm/sha1-ia64.pl	2008-04-12 02:37:45.000000000 +0200
@@ -1,4 +1,4 @@
-#!/usr/bin/env perl
+#!/usr/local/bin/perl
 #
 # ====================================================================
 # Written by Andy Polyakov <appro@fy.chalmers.se> for the OpenSSL
Index: openssl-0.9.7m/crypto/bn/asm/ppc.pl
===================================================================
--- openssl-0.9.7m.orig/crypto/bn/asm/ppc.pl	2005-07-03 11:24:35.000000000 +0200
+++ openssl-0.9.7m/crypto/bn/asm/ppc.pl	2008-04-12 02:37:45.000000000 +0200
@@ -1,4 +1,4 @@
-#!/usr/bin/env perl
+#!/usr/local/bin/perl
 #
 # Implemented as a Perl wrapper as we want to support several different
 # architectures with single file. We pick up the target based on the
Index: openssl-0.9.7m/crypto/rsa/rsa_eay.c
===================================================================
--- openssl-0.9.7m.orig/crypto/rsa/rsa_eay.c	2006-12-04 21:41:46.000000000 +0100
+++ openssl-0.9.7m/crypto/rsa/rsa_eay.c	2008-04-12 02:37:45.000000000 +0200
@@ -336,6 +336,28 @@
 	int local_blinding = 0;
 	BN_BLINDING *blinding = NULL;
 
+	if (BN_num_bits(rsa->n) > OPENSSL_RSA_MAX_MODULUS_BITS)
+		{
+		RSAerr(RSA_F_RSA_EAY_PUBLIC_ENCRYPT, RSA_R_MODULUS_TOO_LARGE);
+		return -1;
+		}
+
+	if (BN_ucmp(rsa->n, rsa->e) <= 0)
+		{
+		RSAerr(RSA_F_RSA_EAY_PUBLIC_ENCRYPT, RSA_R_BAD_E_VALUE);
+		return -1;
+		}
+
+	/* for large moduli, enforce exponent limit */
+	if (BN_num_bits(rsa->n) > OPENSSL_RSA_SMALL_MODULUS_BITS)
+		{
+		if (BN_num_bits(rsa->e) > OPENSSL_RSA_MAX_PUBEXP_BITS)
+			{
+			RSAerr(RSA_F_RSA_EAY_PUBLIC_ENCRYPT, RSA_R_BAD_E_VALUE);
+			return -1;
+			}
+		}
+	
 	BN_init(&f);
 	BN_init(&ret);
 
@@ -644,6 +666,28 @@
 			}
 		}
 
+	if (BN_num_bits(rsa->n) > OPENSSL_RSA_MAX_MODULUS_BITS)
+		{
+		RSAerr(RSA_F_RSA_EAY_PUBLIC_DECRYPT, RSA_R_MODULUS_TOO_LARGE);
+		return -1;
+		}
+
+	if (BN_ucmp(rsa->n, rsa->e) <= 0)
+		{
+		RSAerr(RSA_F_RSA_EAY_PUBLIC_DECRYPT, RSA_R_BAD_E_VALUE);
+		return -1;
+		}
+
+	/* for large moduli, enforce exponent limit */
+	if (BN_num_bits(rsa->n) > OPENSSL_RSA_SMALL_MODULUS_BITS)
+		{
+		if (BN_num_bits(rsa->e) > OPENSSL_RSA_MAX_PUBEXP_BITS)
+			{
+			RSAerr(RSA_F_RSA_EAY_PUBLIC_DECRYPT, RSA_R_BAD_E_VALUE);
+			return -1;
+			}
+		}
+	
 	BN_init(&f);
 	BN_init(&ret);
 	ctx=BN_CTX_new();
Index: openssl-0.9.7m/crypto/rsa/rsa.h
===================================================================
--- openssl-0.9.7m.orig/crypto/rsa/rsa.h	2006-09-28 13:53:50.000000000 +0200
+++ openssl-0.9.7m/crypto/rsa/rsa.h	2008-04-12 02:37:45.000000000 +0200
@@ -165,6 +165,17 @@
 # define OPENSSL_RSA_MAX_PUBEXP_BITS	64 /* exponent limit enforced for "large" modulus only */
 #endif
 
+#ifndef OPENSSL_RSA_MAX_MODULUS_BITS
+# define OPENSSL_RSA_MAX_MODULUS_BITS	16384
+#endif
+
+#ifndef OPENSSL_RSA_SMALL_MODULUS_BITS
+# define OPENSSL_RSA_SMALL_MODULUS_BITS	3072
+#endif
+#ifndef OPENSSL_RSA_MAX_PUBEXP_BITS
+# define OPENSSL_RSA_MAX_PUBEXP_BITS	64 /* exponent limit enforced for "small" modulus only */
+#endif
+
 #define RSA_3	0x3L
 #define RSA_F4	0x10001L
 
Index: openssl-0.9.7m/crypto/opensslconf.h
===================================================================
--- openssl-0.9.7m.orig/crypto/opensslconf.h	2007-02-23 13:52:32.000000000 +0100
+++ openssl-0.9.7m/crypto/opensslconf.h	2008-04-12 02:37:45.000000000 +0200
@@ -4,17 +4,38 @@
 /* OpenSSL was configured with the following options: */
 #ifndef OPENSSL_DOING_MAKEDEPEND
 
+#ifndef OPENSSL_NO_IDEA
+# define OPENSSL_NO_IDEA
+#endif
+#ifndef OPENSSL_NO_MDC2
+# define OPENSSL_NO_MDC2
+#endif
+#ifndef OPENSSL_NO_RC5
+# define OPENSSL_NO_RC5
+#endif
 #ifndef OPENSSL_NO_KRB5
 # define OPENSSL_NO_KRB5
 #endif
 
 #endif /* OPENSSL_DOING_MAKEDEPEND */
+#ifndef OPENSSL_THREADS
+# define OPENSSL_THREADS
+#endif
 
 /* The OPENSSL_NO_* macros are also defined as NO_* if the application
    asks for it.  This is a transient feature that is provided for those
    who haven't had the time to do the appropriate changes in their
    applications.  */
 #ifdef OPENSSL_ALGORITHM_DEFINES
+# if defined(OPENSSL_NO_IDEA) && !defined(NO_IDEA)
+#  define NO_IDEA
+# endif
+# if defined(OPENSSL_NO_MDC2) && !defined(NO_MDC2)
+#  define NO_MDC2
+# endif
+# if defined(OPENSSL_NO_RC5) && !defined(NO_RC5)
+#  define NO_RC5
+# endif
 # if defined(OPENSSL_NO_KRB5) && !defined(NO_KRB5)
 #  define NO_KRB5
 # endif
@@ -27,7 +48,7 @@
 
 #if !(defined(VMS) || defined(__VMS)) /* VMS uses logical names instead */
 #if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR)
-#define OPENSSLDIR "/usr/local/ssl"
+#define OPENSSLDIR "/usr/lib/ssl"
 #endif
 #endif
 
@@ -79,7 +100,7 @@
 
 #if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H)
 #define CONFIG_HEADER_BN_H
-#undef BN_LLONG
+#define BN_LLONG
 
 /* Should we define BN_DIV2W here? */
 
@@ -98,7 +119,7 @@
 #define CONFIG_HEADER_RC4_LOCL_H
 /* if this is defined data[i] is used instead of *data, this is a %20
  * speedup on x86 */
-#undef RC4_INDEX
+#define RC4_INDEX
 #endif
 
 #if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H)
@@ -112,14 +133,14 @@
 /* the following is tweaked from a config script, that is why it is a
  * protected undef/define */
 #ifndef DES_PTR
-#undef DES_PTR
+#define DES_PTR
 #endif
 
 /* This helps C compiler generate the correct code for multiple functional
  * units.  It reduces register dependancies at the expense of 2 more
  * registers */
 #ifndef DES_RISC1
-#undef DES_RISC1
+#define DES_RISC1
 #endif
 
 #ifndef DES_RISC2
@@ -133,7 +154,7 @@
 /* Unroll the inner loop, this sometimes helps, sometimes hinders.
  * Very mucy CPU dependant */
 #ifndef DES_UNROLL
-#undef DES_UNROLL
+#define DES_UNROLL
 #endif
 
 /* These default values were supplied by
Index: openssl-0.9.7m/ms/fipscheck.pl
===================================================================
--- openssl-0.9.7m.orig/ms/fipscheck.pl	2006-01-28 14:34:27.000000000 +0100
+++ openssl-0.9.7m/ms/fipscheck.pl	2008-04-12 02:37:45.000000000 +0200
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/local/bin/perl
 
 # fipscheck.pl
 # sample perl script to check integrity of critical FIPS files
Index: openssl-0.9.7m/Configure
===================================================================
--- openssl-0.9.7m.orig/Configure	2007-02-22 23:30:49.000000000 +0100
+++ openssl-0.9.7m/Configure	2008-04-12 02:37:45.000000000 +0200
@@ -1,4 +1,4 @@
-:
+#!/usr/local/bin/perl
 eval 'exec perl -S $0 ${1+"$@"}'
     if $running_under_some_shell;
 ##
@@ -390,6 +390,43 @@
 # assembler versions -- currently defunct:
 ##"OpenBSD-alpha","gcc:-DTERMIOS -O3 -fomit-frame-pointer:::(unknown):SIXTY_FOUR_BIT_LONG DES_INT DES_PTR DES_RISC2:${alpha_asm}",
 
+# Debian GNU/* (various architectures)
+"debian-alpha","gcc:-DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_RISC1 DES_UNROLL:${alpha_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"debian-alpha-ev4","gcc:-DTERMIO -O3 -mcpu=ev4 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_RISC1 DES_UNROLL:${alpha_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"debian-alpha-ev5","gcc:-DTERMIO -O3 -mcpu=ev5 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_RISC1 DES_UNROLL:${alpha_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"debian-arm","gcc:-DL_ENDIAN -DTERMIO -O2 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG DES_RISC1::::::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+#"debian-amd64","gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}::::::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"debian-amd64", "gcc:-m64 -DL_ENDIAN -DTERMIO -O3 -Wall -DMD32_REG_T=int::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK RC4_CHAR BF_PTR2 DES_INT DES_UNROLL:asm/x86_64-gcc.o:::::::::dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+#"debian-freebsd-alpha","gcc:-DTERMIOS -O -fomit-frame-pointer::(unknown):::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_PTR DES_RISC2::::::::::dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"debian-kfreebsd-i386","gcc:-DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -m486 -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"debian-hppa","gcc:-DB_ENDIAN -DTERMIO -O2 -Wall::-D_REENTRANT::-ldl:BN_LLONG MD2_CHAR RC4_INDEX::::::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"debian-hurd-i386","gcc:-DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -m486 -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"debian-ia64","gcc:-DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK RC4_CHAR:asm/ia64.o:::::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+#"debian-i386","gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -m486 -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}::::::::::dlfcn:linux-shared:-fPIC",
+"debian-i386","gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}::::::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"debian-i386-i486","gcc:-DL_ENDIAN -DTERMIO -O3 -march=i486 -mcpu=i486 -Wa,--noexecstack -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"debian-i386-i586","gcc:-DL_ENDIAN -DTERMIO -O3 -march=i586 -mcpu=i586 -Wa,--noexecstack -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"debian-i386-i686/cmov","gcc:-DL_ENDIAN -DTERMIO -O3 -march=i686 -mcpu=i686 -Wa,--noexecstack -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"debian-m68k","gcc:-DB_ENDIAN -DTERMIO -O2 -Wall::-D_REENTRANT::-ldl:BN_LLONG MD2_CHAR RC4_INDEX::::::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"debian-mips",   "gcc:-DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG RC2_CHAR RC4_INDEX DES_INT DES_UNROLL DES_RISC2::::::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"debian-mipsel",   "gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG RC2_CHAR RC4_INDEX DES_INT DES_UNROLL DES_RISC2::::::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"debian-netbsd-i386",	"gcc:-DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -m486 -Wall::(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}::::::::::dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"debian-netbsd-m68k",	"gcc:-DB_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -Wall::(unknown):::BN_LLONG MD2_CHAR RC4_INDEX DES_UNROLL::::::::::dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"debian-netbsd-sparc",	"gcc:-DB_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -mv8 -Wall::(unknown):::BN_LLONG MD2_CHAR RC4_INDEX DES_UNROLL::::::::::dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"debian-openbsd-alpha","gcc:-DTERMIOS -O3 -fomit-frame-pointer::(unknown):::SIXTY_FOUR_BIT_LONG DES_INT DES_PTR DES_RISC2::::::::::dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"debian-openbsd-i386",  "gcc:-DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -m486::(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_out_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"debian-openbsd-mips","gcc:-O2 -DL_ENDIAN::(unknown)::BN_LLONG MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC2 DES_PTR BF_PTR:::::::::::dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"debian-powerpc","gcc:-DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG DES_UNROLL DES_RISC2 DES_PTR MD2_CHAR RC4_INDEX::::::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"debian-ppc64","gcc:-m64 -DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_RISC1 DES_UNROLL:asm/linux_ppc64.o:::::::::dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"debian-s390","gcc:-DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG::::::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", 
+"debian-sh3",   "gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG::::::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"debian-sh4",   "gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG::::::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"debian-sh3eb",   "gcc:-DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG::::::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"debian-sh4eb",   "gcc:-DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG::::::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"debian-sparc","gcc:-DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR::::::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"debian-sparc-v8","gcc:-DB_ENDIAN -DTERMIO -O3 -mcpu=v8 -fomit-frame-pointer -Wall -DBN_DIV2W::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:asm/sparcv8.o:::::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"debian-sparc-v9","gcc:-DB_ENDIAN -DTERMIO -O3 -mcpu=v9 -Wa,-Av8plus -fomit-frame-pointer -Wall -DULTRASPARC -DBN_DIV2W::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:asm/sparcv8plus.o:::asm/md5-sparcv8plus.o::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+
 # The intel boxes :-), It would be worth seeing if bsdi-gcc can use the
 # bn86-elf.o file file since it is hand tweaked assembler.
 "linux-elf",	"gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -m486 -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
Index: openssl-0.9.7m/os2/backwardify.pl
===================================================================
--- openssl-0.9.7m.orig/os2/backwardify.pl	2003-11-28 15:51:17.000000000 +0100
+++ openssl-0.9.7m/os2/backwardify.pl	2008-04-12 02:37:45.000000000 +0200
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/local/bin/perl
 use strict;
 
 # Use as $0
Index: openssl-0.9.7m/Makefile.org
===================================================================
--- openssl-0.9.7m.orig/Makefile.org	2007-01-16 20:30:19.000000000 +0100
+++ openssl-0.9.7m/Makefile.org	2008-04-12 02:37:45.000000000 +0200
@@ -57,6 +57,7 @@
 # equal 4.
 # PKCS1_CHECK - pkcs1 tests.
 
+#TOP=$(shell pwd)
 CC= gcc
 #CFLAG= -DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -m486 -Wall -Wuninitialized -DSHA1_ASM -DMD5_ASM -DRMD160_ASM
 CFLAG= -DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O3 -m486 -Wall -DSHA1_ASM -DMD5_ASM -DRMD160_ASM
@@ -195,7 +196,7 @@
 # we might set SHLIB_MARK to '$(SHARED_LIBS)'.
 SHLIB_MARK=
 
-DIRS=   crypto fips-1.0 ssl $(SHLIB_MARK) apps test tools
+DIRS=   crypto fips-1.0 ssl $(SHLIB_MARK) apps doc tools
 SHLIBDIRS= crypto ssl
 
 # dirs in crypto to build
@@ -214,10 +215,10 @@
 
 MAKEFILE= Makefile
 
-MANDIR=$(OPENSSLDIR)/man
+MANDIR=/usr/share/man
 MAN1=1
 MAN3=3
-MANSUFFIX=
+MANSUFFIX=ssl
 SHELL=/bin/sh
 
 TOP=    .
Index: openssl-0.9.7m/util/selftest.pl
===================================================================
--- openssl-0.9.7m.orig/util/selftest.pl	2005-06-20 22:45:44.000000000 +0200
+++ openssl-0.9.7m/util/selftest.pl	2008-04-12 02:37:45.000000000 +0200
@@ -1,4 +1,4 @@
-#!/usr/local/bin/perl -w
+#!/usr/local/bin/perl
 #
 # Run the test suite and generate a report
 #
Index: openssl-0.9.7m/util/extract-names.pl
===================================================================
--- openssl-0.9.7m.orig/util/extract-names.pl	2004-03-25 20:52:36.000000000 +0100
+++ openssl-0.9.7m/util/extract-names.pl	2008-04-12 02:37:45.000000000 +0200
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/local/bin/perl
 
 $/ = "";			# Eat a paragraph at once.
 while(<STDIN>) {
Index: openssl-0.9.7m/util/checkhash.pl
===================================================================
--- openssl-0.9.7m.orig/util/checkhash.pl	2005-05-26 23:29:03.000000000 +0200
+++ openssl-0.9.7m/util/checkhash.pl	2008-04-12 02:37:45.000000000 +0200
@@ -1,4 +1,4 @@
-#!/usr/bin/env perl -w
+#!/usr/local/bin/perl
 
 my $package = caller;
 
Index: openssl-0.9.7m/util/clean-depend.pl
===================================================================
--- openssl-0.9.7m.orig/util/clean-depend.pl	2001-10-10 10:27:28.000000000 +0200
+++ openssl-0.9.7m/util/clean-depend.pl	2008-04-12 02:37:45.000000000 +0200
@@ -1,4 +1,4 @@
-#!/usr/local/bin/perl -w
+#!/usr/local/bin/perl
 # Clean the dependency list in a makefile of standard includes...
 # Written by Ben Laurie <ben@algroup.co.uk> 19 Jan 1999
 
Index: openssl-0.9.7m/util/mkerr.pl
===================================================================
--- openssl-0.9.7m.orig/util/mkerr.pl	2006-11-21 20:19:09.000000000 +0100
+++ openssl-0.9.7m/util/mkerr.pl	2008-04-12 02:37:45.000000000 +0200
@@ -1,4 +1,4 @@
-#!/usr/local/bin/perl -w
+#!/usr/local/bin/perl
 
 my $config = "crypto/err/openssl.ec";
 my $debug = 0;
Index: openssl-0.9.7m/util/mkdef.pl
===================================================================
--- openssl-0.9.7m.orig/util/mkdef.pl	2006-02-05 00:05:40.000000000 +0100
+++ openssl-0.9.7m/util/mkdef.pl	2008-04-12 02:37:45.000000000 +0200
@@ -1,4 +1,4 @@
-#!/usr/local/bin/perl -w
+#!/usr/local/bin/perl
 #
 # generate a .def file
 #
Index: openssl-0.9.7m/util/mkstack.pl
===================================================================
--- openssl-0.9.7m.orig/util/mkstack.pl	2004-10-04 18:27:36.000000000 +0200
+++ openssl-0.9.7m/util/mkstack.pl	2008-04-12 02:37:45.000000000 +0200
@@ -1,4 +1,4 @@
-#!/usr/local/bin/perl -w
+#!/usr/local/bin/perl
 
 # This is a utility that searches out "DECLARE_STACK_OF()"
 # declarations in .h and .c files, and updates/creates/replaces
Index: openssl-0.9.7m/util/pod2man.pl
===================================================================
--- openssl-0.9.7m.orig/util/pod2man.pl	2005-06-18 06:27:11.000000000 +0200
+++ openssl-0.9.7m/util/pod2man.pl	2008-04-12 02:37:45.000000000 +0200
@@ -1,4 +1,4 @@
-: #!/usr/bin/perl-5.005
+#!/usr/local/bin/perl
     eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'
 	if $running_under_some_shell;
 
Index: openssl-0.9.7m/util/fipslink.pl
===================================================================
--- openssl-0.9.7m.orig/util/fipslink.pl	2006-02-06 00:49:06.000000000 +0100
+++ openssl-0.9.7m/util/fipslink.pl	2008-04-12 02:37:45.000000000 +0200
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/local/bin/perl
 
 sub check_env
 	{
Index: openssl-0.9.7m/config
===================================================================
--- openssl-0.9.7m.orig/config	2007-01-16 14:48:16.000000000 +0100
+++ openssl-0.9.7m/config	2008-04-12 02:37:45.000000000 +0200
@@ -179,8 +179,8 @@
 	echo "${MACHINE}-whatever-linux1"; exit 0
 	;;
 
-    GNU*)
-	echo "hurd-x86"; exit 0;
+    GNU:*|GNU/*:*)
+	echo "${MACHINE}-gnuish"; exit 0;
 	;;
 
     LynxOS:*)
Index: openssl-0.9.7m/doc/Makefile
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ openssl-0.9.7m/doc/Makefile	2008-04-12 02:37:45.000000000 +0200
@@ -0,0 +1,40 @@
+VERSION =
+
+#PODS = $(wildcard *.pod)
+#MANS = $(addsuffix .man, $(basename $(PODS)))
+
+MANS = openssl.1 ssl.3 crypto.3
+
+P2M = pod2man --center='OpenSSL Documentation' --release="OpenSSL $(VERSION)"
+
+all: manpages
+
+.PHONY: manpages 
+
+manpages: openssl.1 crypto.3 ssl.3
+
+openssl.1:
+	$(P2M) --section=1 openssl.pod > openssl.1
+
+crypto.3:
+	$(P2M) --section=3 crypto.pod > crypto.3
+
+ssl.3:
+	$(P2M) --section=3 ssl.pod > ssl.3
+
+.PHONY: install
+install:
+	mkdir -p $(INSTALL_PREFIX)$(INSTALLTOP)/share/man/man1
+	mkdir -p $(INSTALL_PREFIX)$(INSTALLTOP)/share/man/man3
+	install -m 644 -p openssl.1 $(INSTALL_PREFIX)$(INSTALLTOP)/share/man/man1
+	install -m 644 -p crypto.3 $(INSTALL_PREFIX)$(INSTALLTOP)/share/man/man3
+	install -m 644 -p ssl.3 $(INSTALL_PREFIX)$(INSTALLTOP)/share/man/man3
+	rm -f $(MANS)
+
+.PHONY: clean
+clean:
+	rm -f $(MANS)
+
+.PHONY: realclean
+realclean:
+	-$(MAKE) clean
Index: openssl-0.9.7m/Makefile
===================================================================
--- openssl-0.9.7m.orig/Makefile	2007-02-23 13:52:32.000000000 +0100
+++ openssl-0.9.7m/Makefile	2008-04-12 02:46:16.000000000 +0200
@@ -11,11 +11,11 @@
 SHLIB_VERSION_HISTORY=
 SHLIB_MAJOR=0
 SHLIB_MINOR=9.7
-SHLIB_EXT=
-PLATFORM=dist
-OPTIONS= no-krb5
-CONFIGURE_ARGS=dist
-SHLIB_TARGET=
+SHLIB_EXT=.so.$(SHLIB_MAJOR).$(SHLIB_MINOR)
+PLATFORM=debian-i386
+OPTIONS=--prefix=/usr --openssldir=/usr/lib/ssl no-idea no-mdc2 no-rc5 zlib-dynamic debug no-krb5
+CONFIGURE_ARGS=--prefix=/usr --openssldir=/usr/lib/ssl no-idea no-mdc2 no-rc5 zlib-dynamic debug debian-i386
+SHLIB_TARGET=linux-shared
 
 # HERE indicates where this Makefile lives.  This can be used to indicate
 # where sub-Makefiles are expected to be.  Currently has very limited usage,
@@ -26,10 +26,10 @@
 # for, say, /usr/ and yet have everything installed to /tmp/somedir/usr/.
 # Normally it is left empty.
 INSTALL_PREFIX=
-INSTALLTOP=/usr/local/ssl
+INSTALLTOP=/usr
 
 # Do not edit this manually. Use Configure --openssldir=DIR do change this!
-OPENSSLDIR=/usr/local/ssl
+OPENSSLDIR=/usr/lib/ssl
 
 # NO_IDEA - Define to build without the IDEA algorithm
 # NO_RC4  - Define to build without the RC4 algorithm
@@ -59,12 +59,12 @@
 # equal 4.
 # PKCS1_CHECK - pkcs1 tests.
 
-CC= cc
+CC= gcc
 #CFLAG= -DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -m486 -Wall -Wuninitialized -DSHA1_ASM -DMD5_ASM -DRMD160_ASM
-CFLAG= -DOPENSSL_NO_KRB5 -O
-DEPFLAG= 
+CFLAG= -DZLIB_SHARED -DZLIB -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -DOPENSSL_NO_KRB5 -DOPENSSL_NO_IDEA -DOPENSSL_NO_MDC2 -DOPENSSL_NO_RC5 -DL_ENDIAN -DTERMIO -O3  -Wall -g
+DEPFLAG= -DOPENSSL_NO_IDEA -DOPENSSL_NO_MDC2 -DOPENSSL_NO_RC5
 PEX_LIBS= 
-EX_LIBS= 
+EX_LIBS= -ldl 
 EXE_EXT= 
 ARFLAGS= 
 AR=ar $(ARFLAGS) r
@@ -72,7 +72,7 @@
 PERL= /usr/bin/perl
 TAR= tar
 TARFLAGS= --no-recursion
-MAKEDEPPROG=makedepend
+MAKEDEPPROG= gcc
 
 # We let the C compiler driver to take care of .s files. This is done in
 # order to be excused from maintaining a separate set of architecture
@@ -197,13 +197,13 @@
 # we might set SHLIB_MARK to '$(SHARED_LIBS)'.
 SHLIB_MARK=
 
-DIRS=   crypto fips-1.0 ssl $(SHLIB_MARK) apps test tools
+DIRS=   crypto fips-1.0 ssl $(SHLIB_MARK) apps doc tools
 SHLIBDIRS= crypto ssl
 
 # dirs in crypto to build
 SDIRS=  objects \
-	md2 md4 md5 sha mdc2 hmac ripemd \
-	des rc2 rc4 rc5 idea bf cast \
+	md2 md4 md5 sha hmac ripemd \
+	des rc2 rc4 bf cast \
 	bn ec rsa dsa dh dso engine aes \
 	buffer bio stack lhash rand err \
 	evp asn1 pem x509 x509v3 conf txt_db pkcs7 pkcs12 comp ocsp ui krb5
@@ -216,10 +216,10 @@
 
 MAKEFILE= Makefile
 
-MANDIR=$(OPENSSLDIR)/man
+MANDIR=/usr/share/man
 MAN1=1
 MAN3=3
-MANSUFFIX=
+MANSUFFIX=ssl
 SHELL=/bin/sh
 
 TOP=    .
@@ -230,7 +230,7 @@
 SHARED_CRYPTO=libcrypto$(SHLIB_EXT)
 SHARED_SSL=libssl$(SHLIB_EXT)
 SHARED_LIBS=
-SHARED_LIBS_LINK_EXTS=
+SHARED_LIBS_LINK_EXTS=.so.$(SHLIB_MAJOR) .so
 SHARED_LDFLAGS=
 
 GENERAL=        Makefile
Index: openssl-0.9.7m/VMS/VMSify-conf.pl
===================================================================
--- openssl-0.9.7m.orig/VMS/VMSify-conf.pl	2004-05-13 23:38:23.000000000 +0200
+++ openssl-0.9.7m/VMS/VMSify-conf.pl	2008-04-12 02:37:45.000000000 +0200
@@ -1,4 +1,4 @@
-#! /usr/bin/perl
+#!/usr/local/bin/perl
 
 use strict;
 use warnings;
Index: openssl-0.9.7m/ssl/ssl_lib.c
===================================================================
--- openssl-0.9.7m.orig/ssl/ssl_lib.c	2006-09-28 13:53:51.000000000 +0200
+++ openssl-0.9.7m/ssl/ssl_lib.c	2008-04-12 02:48:25.000000000 +0200
@@ -1169,7 +1169,6 @@
 char *SSL_get_shared_ciphers(const SSL *s,char *buf,int len)
 	{
 	char *p;
-	const char *cp;
 	STACK_OF(SSL_CIPHER) *sk;
 	SSL_CIPHER *c;
 	int i;
@@ -1182,20 +1181,21 @@
 	sk=s->session->ciphers;
 	for (i=0; i<sk_SSL_CIPHER_num(sk); i++)
 		{
-		/* Decrement for either the ':' or a '\0' */
-		len--;
+ 		int n;
+ 
 		c=sk_SSL_CIPHER_value(sk,i);
-		for (cp=c->name; *cp; )
+ 		n=strlen(c->name);
+ 		if (n+1 > len)
 			{
-			if (len-- <= 0)
-				{
-				*p='\0';
-				return(buf);
-				}
-			else
-				*(p++)= *(cp++);
+ 			if (p != buf)
+ 				--p;
+ 			*p='\0';
+ 			return buf;
 			}
+ 		strcpy(p,c->name);
+ 		p+=n;
 		*(p++)=':';
+ 		len-=n+1;
 		}
 	p[-1]='\0';
 	return(buf);
Index: openssl-0.9.7m/ssl/ssl_algs.c
===================================================================
--- openssl-0.9.7m.orig/ssl/ssl_algs.c	2001-02-20 09:11:58.000000000 +0100
+++ openssl-0.9.7m/ssl/ssl_algs.c	2008-04-12 02:37:45.000000000 +0200
@@ -109,3 +109,8 @@
 	return(1);
 	}
 
+#undef SSLeay_add_ssl_algorithms
+int SSLeay_add_ssl_algorithms(void)
+    {
+         return SSL_library_init();
+    }
Index: openssl-0.9.7m/demos/tunala/configure.in
===================================================================
--- openssl-0.9.7m.orig/demos/tunala/configure.in	2002-01-08 03:58:54.000000000 +0100
+++ openssl-0.9.7m/demos/tunala/configure.in	2008-04-12 02:37:45.000000000 +0200
@@ -1,4 +1,4 @@
-dnl Process this file with autoconf to produce a configure script.
+#!/usr/local/bin/perl
 AC_INIT(tunala.c)
 AM_CONFIG_HEADER(config.h)
 AM_INIT_AUTOMAKE(tunala, 0.0.1-dev)
Index: openssl-0.9.7m/apps/CA.pl
===================================================================
--- openssl-0.9.7m.orig/apps/CA.pl	2007-02-23 13:52:38.000000000 +0100
+++ openssl-0.9.7m/apps/CA.pl	2008-04-12 02:37:45.000000000 +0200
@@ -63,6 +63,7 @@
 foreach (@ARGV) {
 	if ( /^(-\?|-h|-help)$/ ) {
 	    print STDERR "usage: CA -newcert|-newreq|-newreq-nodes|-newca|-sign|-verify\n";
+	    print STDERR "usage: CA -signcert certfile keyfile|-newcert|-newreq|-newca|-sign|-verify\n";
 	    exit 0;
 	} elsif (/^-newcert$/) {
 	    # create a certificate
@@ -159,6 +160,7 @@
 	} else {
 	    print STDERR "Unknown arg $_\n";
 	    print STDERR "usage: CA -newcert|-newreq|-newreq-nodes|-newca|-sign|-verify\n";
+	    print STDERR "usage: CA -signcert certfile keyfile|-newcert|-newreq|-newca|-sign|-verify\n";
 	    exit 1;
 	}
 }
Index: openssl-0.9.7m/apps/CA.pl.in
===================================================================
--- openssl-0.9.7m.orig/apps/CA.pl.in	2005-07-04 23:44:19.000000000 +0200
+++ openssl-0.9.7m/apps/CA.pl.in	2008-04-12 02:37:45.000000000 +0200
@@ -63,6 +63,7 @@
 foreach (@ARGV) {
 	if ( /^(-\?|-h|-help)$/ ) {
 	    print STDERR "usage: CA -newcert|-newreq|-newreq-nodes|-newca|-sign|-verify\n";
+	    print STDERR "usage: CA -signcert certfile keyfile|-newcert|-newreq|-newca|-sign|-verify\n";
 	    exit 0;
 	} elsif (/^-newcert$/) {
 	    # create a certificate
@@ -159,6 +160,7 @@
 	} else {
 	    print STDERR "Unknown arg $_\n";
 	    print STDERR "usage: CA -newcert|-newreq|-newreq-nodes|-newca|-sign|-verify\n";
+	    print STDERR "usage: CA -signcert certfile keyfile|-newcert|-newreq|-newca|-sign|-verify\n";
 	    exit 1;
 	}
 }
Index: openssl-0.9.7m/apps/progs.h
===================================================================
--- openssl-0.9.7m.orig/apps/progs.h	2004-06-19 15:54:59.000000000 +0200
+++ openssl-0.9.7m/apps/progs.h	2008-04-12 02:37:45.000000000 +0200
@@ -35,11 +35,9 @@
 extern int spkac_main(int argc,char *argv[]);
 extern int smime_main(int argc,char *argv[]);
 extern int rand_main(int argc,char *argv[]);
-extern int prime_main(int argc,char *argv[]);
-#ifndef OPENSSL_NO_ENGINE
 extern int engine_main(int argc,char *argv[]);
-#endif
 extern int ocsp_main(int argc,char *argv[]);
+extern int prime_main(int argc,char *argv[]);
 
 #define FUNC_TYPE_GENERAL	1
 #define FUNC_TYPE_MD		2
@@ -95,9 +93,7 @@
 #if !defined(OPENSSL_NO_SOCK) && !(defined(OPENSSL_NO_SSL2) && defined(OPENSSL_NO_SSL3))
 	{FUNC_TYPE_GENERAL,"s_client",s_client_main},
 #endif
-#ifndef OPENSSL_NO_SPEED
 	{FUNC_TYPE_GENERAL,"speed",speed_main},
-#endif
 #if !defined(OPENSSL_NO_SOCK) && !(defined(OPENSSL_NO_SSL2) && defined(OPENSSL_NO_SSL3))
 	{FUNC_TYPE_GENERAL,"s_time",s_time_main},
 #endif
@@ -116,11 +112,9 @@
 	{FUNC_TYPE_GENERAL,"spkac",spkac_main},
 	{FUNC_TYPE_GENERAL,"smime",smime_main},
 	{FUNC_TYPE_GENERAL,"rand",rand_main},
-	{FUNC_TYPE_GENERAL,"prime",prime_main},
-#ifndef OPENSSL_NO_ENGINE
 	{FUNC_TYPE_GENERAL,"engine",engine_main},
-#endif
 	{FUNC_TYPE_GENERAL,"ocsp",ocsp_main},
+	{FUNC_TYPE_GENERAL,"prime",prime_main},
 #ifndef OPENSSL_NO_MD2
 	{FUNC_TYPE_MD,"md2",dgst_main},
 #endif