add ocf support to openssl, and use it by default if engines are enabled
[openwrt/openwrt.git] / package / openssl / patches / 200-ocf.patch
1 diff -Nur openssl-0.9.8h/Configure openssl-0.9.8h-ocf/Configure
2 --- openssl-0.9.8h/Configure 2008-05-02 01:11:30.000000000 +0200
3 +++ openssl-0.9.8h-ocf/Configure 2008-07-12 04:18:53.000000000 +0200
4 @@ -34,6 +34,8 @@
5 # (Default: KRB5_DIR/include)
6 # --with-krb5-flavor Declare what flavor of Kerberos 5 is used. Currently
7 # supported values are "MIT" and "Heimdal". A value is required.
8 +# --with-cryptodev Force support for cryptodev (ie., ocf-linux)
9 +# --with-cryptodev-digests Force support for cryptodev digests (generally slow)
10 #
11 # --test-sanity Make a number of sanity checks on the data in this file.
12 # This is a debugging tool for OpenSSL developers.
13 @@ -539,6 +541,9 @@
14 ##### Compaq Non-Stop Kernel (Tandem)
15 "tandem-c89","c89:-Ww -D__TANDEM -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1 -D_TANDEM_SOURCE -DB_ENDIAN::(unknown):::THIRTY_TWO_BIT:::",
16
17 +# uClinux
18 +"uClinux-dist","$ENV{'CC'}:\$(CFLAGS)::-D_REENTRANT::\$(LDFLAGS) \$(LDLIBS):BN_LLONG::::::::::::\$(LIBSSL_dlfcn):linux-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):$ENV{'RANLIB'}",
19 +
20 );
21
22 my @MK1MF_Builds=qw(VC-WIN64I VC-WIN64A
23 @@ -588,6 +593,8 @@
24 my $no_asm=0;
25 my $no_dso=0;
26 my $no_gmp=0;
27 +my $have_cryptodev=0;
28 +my $use_cryptodev_digests=0;
29 my @skip=();
30 my $Makefile="Makefile";
31 my $des_locl="crypto/des/des_locl.h";
32 @@ -714,6 +721,14 @@
33 {
34 exit(&test_sanity());
35 }
36 + elsif (/^--with-cryptodev$/)
37 + {
38 + $have_cryptodev = 1;
39 + }
40 + elsif (/^--with-cryptodev-digests$/)
41 + {
42 + $use_cryptodev_digests = 1;
43 + }
44 elsif (/^reconfigure/ || /^reconf/)
45 {
46 if (open(IN,"<$Makefile"))
47 @@ -922,6 +937,7 @@
48 print " OPENSSL_NO_$ALGO";
49
50 if (/^err$/) { $flags .= "-DOPENSSL_NO_ERR "; }
51 + elsif (/^hw$/) { $flags .= "-DOPENSSL_NO_HW "; }
52 elsif (/^asm$/) { $no_asm = 1; }
53 }
54 else
55 @@ -1062,6 +1078,16 @@
56 $withargs{"krb5-dir"} ne "";
57 }
58
59 +# enable the linux cryptodev (ocf-linux) support
60 +if ($have_cryptodev)
61 + {
62 + if ($use_cryptodev_digests)
63 + {
64 + $cflags = "-DUSE_CRYPTODEV_DIGESTS $cflags";
65 + }
66 + $cflags = "-DHAVE_CRYPTODEV $cflags";
67 + }
68 +
69 # The DSO code currently always implements all functions so that no
70 # applications will have to worry about that from a compilation point
71 # of view. However, the "method"s may return zero unless that platform
72 diff -Nur openssl-0.9.8h/INSTALL openssl-0.9.8h-ocf/INSTALL
73 --- openssl-0.9.8h/INSTALL 2008-04-07 08:35:41.000000000 +0200
74 +++ openssl-0.9.8h-ocf/INSTALL 2008-07-12 04:18:53.000000000 +0200
75 @@ -103,6 +103,12 @@
76 define preprocessor symbols, specify additional libraries,
77 library directories or other compiler options.
78
79 + --with-cryptodev Enabled the BSD cryptodev engine even if we are not using
80 + BSD. Useful if you are running ocf-linux or something
81 + similar. Once enabled you can also enable the use of
82 + cryptodev digests, with is usually slower unless you have
83 + large amounts data. Use --with-cryptodev-digests to force
84 + it.
85
86 Installation in Detail
87 ----------------------
88 diff -Nur openssl-0.9.8h/Makefile.org openssl-0.9.8h-ocf/Makefile.org
89 --- openssl-0.9.8h/Makefile.org 2008-04-04 01:03:39.000000000 +0200
90 +++ openssl-0.9.8h-ocf/Makefile.org 2008-07-12 04:18:53.000000000 +0200
91 @@ -367,7 +367,7 @@
92
93 links:
94 @$(PERL) $(TOP)/util/mkdir-p.pl include/openssl
95 - @$(PERL) $(TOP)/util/mklink.pl include/openssl $(EXHEADER)
96 + @$(PERL) $(TOP)/util/mklink.pl include/openssl $(HEADER) $(EXHEADER)
97 @set -e; target=links; $(RECURSIVE_BUILD_CMD)
98
99 gentests:
100 diff -Nur openssl-0.9.8h/Makefile.shared openssl-0.9.8h-ocf/Makefile.shared
101 --- openssl-0.9.8h/Makefile.shared 2007-09-16 16:11:51.000000000 +0200
102 +++ openssl-0.9.8h-ocf/Makefile.shared 2008-07-12 04:18:53.000000000 +0200
103 @@ -6,13 +6,13 @@
104 # properly
105
106 # CC contains the current compiler. This one MUST be defined
107 -CC=cc
108 -CFLAGS=$(CFLAG)
109 +CC?=cc
110 +CFLAGS?=$(CFLAG)
111 # LDFLAGS contains flags to be used when temporary object files (when building
112 # shared libraries) are created, or when an application is linked.
113 # SHARED_LDFLAGS contains flags to be used when the shared library is created.
114 -LDFLAGS=
115 -SHARED_LDFLAGS=
116 +LDFLAGS?=
117 +SHARED_LDFLAGS?=
118
119 # LIBNAME contains just the name of the library, without prefix ("lib"
120 # on Unix, "cyg" for certain forms under Cygwin...) or suffix (.a, .so,
121 diff -Nur openssl-0.9.8h/apps/apps.h openssl-0.9.8h-ocf/apps/apps.h
122 --- openssl-0.9.8h/apps/apps.h 2007-10-12 02:00:10.000000000 +0200
123 +++ openssl-0.9.8h-ocf/apps/apps.h 2008-07-12 04:18:53.000000000 +0200
124 @@ -112,7 +112,7 @@
125 #ifndef HEADER_APPS_H
126 #define HEADER_APPS_H
127
128 -#include "e_os.h"
129 +#include <openssl/e_os.h>
130
131 #include <openssl/bio.h>
132 #include <openssl/x509.h>
133 diff -Nur openssl-0.9.8h/apps/progs.h openssl-0.9.8h-ocf/apps/progs.h
134 --- openssl-0.9.8h/apps/progs.h 2008-04-04 01:03:41.000000000 +0200
135 +++ openssl-0.9.8h-ocf/apps/progs.h 2008-07-12 04:18:53.000000000 +0200
136 @@ -129,7 +129,9 @@
137 #ifndef OPENSSL_NO_ENGINE
138 {FUNC_TYPE_GENERAL,"engine",engine_main},
139 #endif
140 +#ifndef OPENSSL_NO_OCSP
141 {FUNC_TYPE_GENERAL,"ocsp",ocsp_main},
142 +#endif
143 {FUNC_TYPE_GENERAL,"prime",prime_main},
144 #ifndef OPENSSL_NO_MD2
145 {FUNC_TYPE_MD,"md2",dgst_main},
146 diff -Nur openssl-0.9.8h/apps/speed.c openssl-0.9.8h-ocf/apps/speed.c
147 --- openssl-0.9.8h/apps/speed.c 2007-11-15 14:33:47.000000000 +0100
148 +++ openssl-0.9.8h-ocf/apps/speed.c 2008-07-12 04:18:53.000000000 +0200
149 @@ -292,7 +292,7 @@
150 "evp","sha256","sha512",
151 "aes-128 ige","aes-192 ige","aes-256 ige"};
152 static double results[ALGOR_NUM][SIZE_NUM];
153 -static int lengths[SIZE_NUM]={16,64,256,1024,8*1024};
154 +static int lengths[SIZE_NUM]={16,64,256,1024,2*1024,4*1024};
155 static double rsa_results[RSA_NUM][2];
156 static double dsa_results[DSA_NUM][2];
157 #ifndef OPENSSL_NO_ECDSA
158 @@ -328,6 +328,79 @@
159 #define START 0
160 #define STOP 1
161
162 +#ifdef __linux__
163 +/*
164 + * record CPU usage as well
165 + */
166 +
167 +static int do_cpu = 0;
168 +
169 +struct cpu_stat {
170 + unsigned int user;
171 + unsigned int nice;
172 + unsigned int system;
173 + unsigned int idle;
174 + unsigned int total;
175 +};
176 +
177 +static unsigned int cpu_usage[ALGOR_NUM][SIZE_NUM];
178 +static unsigned int rsa_cpu_usage[RSA_NUM][2];
179 +static unsigned int dsa_cpu_usage[DSA_NUM][2];
180 +static struct cpu_stat cpu_start, cpu_finish;
181 +
182 +static void
183 +get_cpu(int s)
184 +{
185 + FILE *fp = NULL;
186 + unsigned char buf[80];
187 + struct cpu_stat *st = s == START ? &cpu_start : &cpu_finish;
188 +
189 + memset(st, 0, sizeof(*st));
190 +
191 + if (fp == NULL)
192 + fp = fopen("/proc/stat", "r");
193 + if (!fp)
194 + return;
195 + if (fseek(fp, 0, SEEK_SET) == -1) {
196 + fclose(fp);
197 + return;
198 + }
199 + fscanf(fp, "%s %d %d %d %d", &buf[0], &st->user, &st->nice,
200 + &st->system, &st->idle);
201 + st->total = st->user + st->nice + st->system + st->idle;
202 + fclose(fp);
203 +}
204 +
205 +static unsigned int
206 +calc_cpu()
207 +{
208 + unsigned int total, res;
209 +
210 + total = cpu_finish.total - cpu_start.total;
211 + if (total <= 0)
212 + return 0;
213 +#if 1 // busy
214 + res = ((cpu_finish.system + cpu_finish.user + cpu_finish.nice) -
215 + (cpu_start.system + cpu_start.user + cpu_start.nice)) *
216 + 100 / total;
217 +#endif
218 +#if 0 // system
219 + res = (cpu_finish.system - cpu_start.system) * 100 / total;
220 +#endif
221 +#if 0 // user
222 + res = (cpu_finish.user - cpu_start.user) * 100 / total;
223 +#endif
224 +#if 0 // nice
225 + res = (cpu_finish.nice - cpu_start.nice) * 100 / total;
226 +#endif
227 +#if 0 // idle
228 + res = (cpu_finish.idle - cpu_start.idle) * 100 / total;
229 +#endif
230 + return(res);
231 +}
232 +
233 +#endif
234 +
235 #if defined(OPENSSL_SYS_NETWARE)
236
237 /* for NetWare the best we can do is use clock() which returns the
238 @@ -358,6 +431,11 @@
239 {
240 double ret;
241
242 +#ifdef __linux__
243 + if (do_cpu)
244 + get_cpu(s);
245 +#endif
246 +
247 #ifdef USE_TOD
248 if(usertime)
249 {
250 @@ -832,6 +910,14 @@
251 j--; /* Otherwise, -elapsed gets confused with
252 an algorithm. */
253 }
254 +#ifdef __linux__
255 + else if ((argc > 0) && (strcmp(*argv,"-cpu") == 0))
256 + {
257 + do_cpu = 1;
258 + j--; /* Otherwise, -cpu gets confused with
259 + an algorithm. */
260 + }
261 +#endif
262 else if ((argc > 0) && (strcmp(*argv,"-evp") == 0))
263 {
264 argc--;
265 @@ -1260,6 +1346,9 @@
266 #ifdef HAVE_FORK
267 BIO_printf(bio_err,"-multi n run n benchmarks in parallel.\n");
268 #endif
269 +#ifdef __linux__
270 + BIO_printf(bio_err,"-cpu calculate cpu utilisation.\n");
271 +#endif
272 goto end;
273 }
274 argc--;
275 @@ -1267,11 +1356,6 @@
276 j++;
277 }
278
279 -#ifdef HAVE_FORK
280 - if(multi && do_multi(multi))
281 - goto show_res;
282 -#endif
283 -
284 if (j == 0)
285 {
286 for (i=0; i<ALGOR_NUM; i++)
287 @@ -1604,6 +1688,11 @@
288 signal(SIGALRM,sig_done);
289 #endif /* SIGALRM */
290
291 +#ifdef HAVE_FORK /* DM */
292 + if(multi && do_multi(multi))
293 + goto show_res;
294 +#endif
295 +
296 #ifndef OPENSSL_NO_MD2
297 if (doit[D_MD2])
298 {
299 @@ -2033,8 +2122,6 @@
300 /* -O3 -fschedule-insns messes up an
301 * optimization here! names[D_EVP]
302 * somehow becomes NULL */
303 - print_message(names[D_EVP],save_count,
304 - lengths[j]);
305
306 EVP_CIPHER_CTX_init(&ctx);
307 if(decrypt)
308 @@ -2043,6 +2130,9 @@
309 EVP_EncryptInit_ex(&ctx,evp_cipher,NULL,key16,iv);
310 EVP_CIPHER_CTX_set_padding(&ctx, 0);
311
312 + print_message(names[D_EVP],save_count,
313 + lengths[j]);
314 +
315 Time_F(START);
316 if(decrypt)
317 for (count=0,run=1; COND(save_count*4*lengths[0]/lengths[j]); count++)
318 @@ -2107,6 +2197,8 @@
319 }
320 }
321 d=Time_F(STOP);
322 + if (do_cpu)
323 + rsa_cpu_usage[j][0] = calc_cpu();
324 BIO_printf(bio_err,mr ? "+R1:%ld:%d:%.2f\n"
325 : "%ld %d bit private RSA's in %.2fs\n",
326 count,rsa_bits[j],d);
327 @@ -2142,6 +2234,8 @@
328 }
329 }
330 d=Time_F(STOP);
331 + if (do_cpu)
332 + rsa_cpu_usage[j][1] = calc_cpu();
333 BIO_printf(bio_err,mr ? "+R2:%ld:%d:%.2f\n"
334 : "%ld %d bit public RSA's in %.2fs\n",
335 count,rsa_bits[j],d);
336 @@ -2201,6 +2295,8 @@
337 }
338 }
339 d=Time_F(STOP);
340 + if (do_cpu)
341 + dsa_cpu_usage[j][0] = calc_cpu();
342 BIO_printf(bio_err,mr ? "+R3:%ld:%d:%.2f\n"
343 : "%ld %d bit DSA signs in %.2fs\n",
344 count,dsa_bits[j],d);
345 @@ -2236,6 +2332,8 @@
346 }
347 }
348 d=Time_F(STOP);
349 + if (do_cpu)
350 + dsa_cpu_usage[j][1] = calc_cpu();
351 BIO_printf(bio_err,mr ? "+R4:%ld:%d:%.2f\n"
352 : "%ld %d bit DSA verify in %.2fs\n",
353 count,dsa_bits[j],d);
354 @@ -2530,14 +2628,23 @@
355 fprintf(stdout,"The 'numbers' are in 1000s of bytes per second processed.\n");
356 fprintf(stdout,"type ");
357 }
358 - for (j=0; j<SIZE_NUM; j++)
359 + for (j=0; j<SIZE_NUM; j++) {
360 fprintf(stdout,mr ? ":%d" : "%7d bytes",lengths[j]);
361 + if (do_cpu && !mr)
362 + fprintf(stdout, " /cpu");
363 + }
364 fprintf(stdout,"\n");
365 }
366
367 for (k=0; k<ALGOR_NUM; k++)
368 {
369 if (!doit[k]) continue;
370 + if (k == D_EVP) {
371 + if (evp_cipher)
372 + names[D_EVP]=OBJ_nid2ln(evp_cipher->nid);
373 + else
374 + names[D_EVP]=OBJ_nid2ln(evp_md->type);
375 + }
376 if(mr)
377 fprintf(stdout,"+F:%d:%s",k,names[k]);
378 else
379 @@ -2548,6 +2655,8 @@
380 fprintf(stdout," %11.2fk",results[k][j]/1e3);
381 else
382 fprintf(stdout,mr ? ":%.2f" : " %11.2f ",results[k][j]);
383 + if (do_cpu)
384 + fprintf(stdout, mr ? "/%d" : "/%%%-3d", cpu_usage[k][j]);
385 }
386 fprintf(stdout,"\n");
387 }
388 @@ -2562,13 +2671,18 @@
389 j=0;
390 }
391 if(mr)
392 - fprintf(stdout,"+F2:%u:%u:%f:%f\n",
393 - k,rsa_bits[k],rsa_results[k][0],
394 - rsa_results[k][1]);
395 - else
396 - fprintf(stdout,"rsa %4u bits %8.6fs %8.6fs %8.1f %8.1f\n",
397 - rsa_bits[k],rsa_results[k][0],rsa_results[k][1],
398 - 1.0/rsa_results[k][0],1.0/rsa_results[k][1]);
399 + fprintf(stdout,"+F2:%u:%u:%f", k,rsa_bits[k],rsa_results[k][0]);
400 + else
401 + fprintf(stdout,"rsa %4u bits %8.6fs",rsa_bits[k],rsa_results[k][0]);
402 + if (do_cpu)
403 + fprintf(stdout, mr ? "/%d": "/%%%-3d", rsa_cpu_usage[k][0]);
404 + fprintf(stdout, mr ? ":%f" : " %8.6fs", rsa_results[k][1]);
405 + if (do_cpu)
406 + fprintf(stdout, mr ? "/%d": "/%%%-3d", rsa_cpu_usage[k][1]);
407 + if(!mr)
408 + fprintf(stdout, " %8.1f %8.1f",
409 + 1.0/rsa_results[k][0],1.0/rsa_results[k][1]);
410 + fprintf(stdout, "\n");
411 }
412 #endif
413 #ifndef OPENSSL_NO_DSA
414 @@ -2582,12 +2696,18 @@
415 j=0;
416 }
417 if(mr)
418 - fprintf(stdout,"+F3:%u:%u:%f:%f\n",
419 - k,dsa_bits[k],dsa_results[k][0],dsa_results[k][1]);
420 + fprintf(stdout,"+F3:%u:%u:%f", k,dsa_bits[k],dsa_results[k][0]);
421 else
422 - fprintf(stdout,"dsa %4u bits %8.6fs %8.6fs %8.1f %8.1f\n",
423 - dsa_bits[k],dsa_results[k][0],dsa_results[k][1],
424 - 1.0/dsa_results[k][0],1.0/dsa_results[k][1]);
425 + fprintf(stdout,"dsa %4u bits %8.6fs",dsa_bits[k],dsa_results[k][0]);
426 + if (do_cpu)
427 + fprintf(stdout, mr ? "/%d": "/%%%-3d", dsa_cpu_usage[k][0]);
428 + fprintf(stdout, mr ? ":%f" : " %8.6fs", dsa_results[k][1]);
429 + if (do_cpu)
430 + fprintf(stdout, mr ? "/%d": "/%%%-3d", dsa_cpu_usage[k][1]);
431 + if(!mr)
432 + fprintf(stdout, " %8.1f %8.1f",
433 + 1.0/dsa_results[k][0],1.0/dsa_results[k][1]);
434 + fprintf(stdout, "\n");
435 }
436 #endif
437 #ifndef OPENSSL_NO_ECDSA
438 @@ -2712,8 +2832,10 @@
439
440 static void print_result(int alg,int run_no,int count,double time_used)
441 {
442 - BIO_printf(bio_err,mr ? "+R:%d:%s:%f\n"
443 - : "%d %s's in %.2fs\n",count,names[alg],time_used);
444 + if (do_cpu)
445 + cpu_usage[alg][run_no] = calc_cpu();
446 + BIO_printf(bio_err,mr ? "+R:%ld:%s:%f\n"
447 + : "%ld %s's in %.2fs\n",count,names[alg],time_used);
448 results[alg][run_no]=((double)count)/time_used*lengths[run_no];
449 }
450
451 @@ -2806,29 +2928,11 @@
452 p=buf+3;
453 alg=atoi(sstrsep(&p,sep));
454 sstrsep(&p,sep);
455 - for(j=0 ; j < SIZE_NUM ; ++j)
456 + for(j=0 ; j < SIZE_NUM ; ++j) {
457 + if (do_cpu && strchr(p, '/'))
458 + cpu_usage[alg][j] = atoi(strchr(p, '/') + 1);
459 results[alg][j]+=atof(sstrsep(&p,sep));
460 }
461 - else if(!strncmp(buf,"+F2:",4))
462 - {
463 - int k;
464 - double d;
465 -
466 - p=buf+4;
467 - k=atoi(sstrsep(&p,sep));
468 - sstrsep(&p,sep);
469 -
470 - d=atof(sstrsep(&p,sep));
471 - if(n)
472 - rsa_results[k][0]=1/(1/rsa_results[k][0]+1/d);
473 - else
474 - rsa_results[k][0]=d;
475 -
476 - d=atof(sstrsep(&p,sep));
477 - if(n)
478 - rsa_results[k][1]=1/(1/rsa_results[k][1]+1/d);
479 - else
480 - rsa_results[k][1]=d;
481 }
482 else if(!strncmp(buf,"+F2:",4))
483 {
484 @@ -2839,12 +2943,18 @@
485 k=atoi(sstrsep(&p,sep));
486 sstrsep(&p,sep);
487
488 + /* before we move the token along */
489 + if (do_cpu && strchr(p, '/'))
490 + rsa_cpu_usage[k][0] = atoi(strchr(p, '/') + 1);
491 d=atof(sstrsep(&p,sep));
492 if(n)
493 rsa_results[k][0]=1/(1/rsa_results[k][0]+1/d);
494 else
495 rsa_results[k][0]=d;
496
497 + /* before we move the token along */
498 + if (do_cpu && strchr(p, '/'))
499 + rsa_cpu_usage[k][1] = atoi(strchr(p, '/') + 1);
500 d=atof(sstrsep(&p,sep));
501 if(n)
502 rsa_results[k][1]=1/(1/rsa_results[k][1]+1/d);
503 @@ -2860,12 +2970,18 @@
504 k=atoi(sstrsep(&p,sep));
505 sstrsep(&p,sep);
506
507 + /* before we move the token along */
508 + if (do_cpu && strchr(p, '/'))
509 + dsa_cpu_usage[k][0] = atoi(strchr(p, '/') + 1);
510 d=atof(sstrsep(&p,sep));
511 if(n)
512 dsa_results[k][0]=1/(1/dsa_results[k][0]+1/d);
513 else
514 dsa_results[k][0]=d;
515
516 + /* before we move the token along */
517 + if (do_cpu && strchr(p, '/'))
518 + dsa_cpu_usage[k][1] = atoi(strchr(p, '/') + 1);
519 d=atof(sstrsep(&p,sep));
520 if(n)
521 dsa_results[k][1]=1/(1/dsa_results[k][1]+1/d);
522 diff -Nur openssl-0.9.8h/config openssl-0.9.8h-ocf/config
523 --- openssl-0.9.8h/config 2007-08-01 13:21:35.000000000 +0200
524 +++ openssl-0.9.8h-ocf/config 2008-07-12 04:18:53.000000000 +0200
525 @@ -48,10 +48,10 @@
526
527 # First get uname entries that we use below
528
529 -MACHINE=`(uname -m) 2>/dev/null` || MACHINE="unknown"
530 -RELEASE=`(uname -r) 2>/dev/null` || RELEASE="unknown"
531 -SYSTEM=`(uname -s) 2>/dev/null` || SYSTEM="unknown"
532 -VERSION=`(uname -v) 2>/dev/null` || VERSION="unknown"
533 +[ "$MACHINE" ] || MACHINE=`(uname -m) 2>/dev/null` || MACHINE="unknown"
534 +[ "$RELEASE" ] || RELEASE=`(uname -r) 2>/dev/null` || RELEASE="unknown"
535 +[ "$SYSTEM" ] || SYSTEM=`(uname -s) 2>/dev/null` || SYSTEM="unknown"
536 +[ "$VERSION" ] || VERSION=`(uname -v) 2>/dev/null` || VERSION="unknown"
537
538
539 # Now test for ISC and SCO, since it is has a braindamaged uname.
540 @@ -270,7 +270,7 @@
541 echo "ppc-apple-darwin${VERSION}"
542 ;;
543 *)
544 - echo "i386-apple-darwin${VERSION}"
545 + echo "${MACHINE}-apple-darwin${VERSION}"
546 ;;
547 esac
548 exit 0
549 @@ -401,9 +401,9 @@
550
551 # figure out if gcc is available and if so we use it otherwise
552 # we fallback to whatever cc does on the system
553 -GCCVER=`(gcc -dumpversion) 2>/dev/null`
554 +CC="${CC:-gcc}"
555 +GCCVER=`(${CC} -dumpversion) 2>/dev/null`
556 if [ "$GCCVER" != "" ]; then
557 - CC=gcc
558 # then strip off whatever prefix egcs prepends the number with...
559 # Hopefully, this will work for any future prefixes as well.
560 GCCVER=`echo $GCCVER | LC_ALL=C sed 's/^[a-zA-Z]*\-//'`
561 @@ -413,7 +413,7 @@
562 # peak single digit before and after first dot, e.g. 2.95.1 gives 29
563 GCCVER=`echo $GCCVER | sed 's/\([0-9]\)\.\([0-9]\).*/\1\2/'`
564 else
565 - CC=cc
566 + CC="${CC:-cc}"
567 fi
568 GCCVER=${GCCVER:-0}
569 if [ "$SYSTEM" = "HP-UX" ];then
570 @@ -482,6 +482,9 @@
571 # script above so we end up with values in vars but that would take
572 # more time that I want to waste at the moment
573 case "$GUESSOS" in
574 + uClinux*)
575 + OUT=uClinux-dist
576 + ;;
577 mips2-sgi-irix)
578 CPU=`(hinv -t cpu) 2>/dev/null | head -1 | sed 's/^CPU:[^R]*R\([0-9]*\).*/\1/'`
579 CPU=${CPU:-0}
580 diff -Nur openssl-0.9.8h/crypto/cryptlib.h openssl-0.9.8h-ocf/crypto/cryptlib.h
581 --- openssl-0.9.8h/crypto/cryptlib.h 2005-05-21 15:19:44.000000000 +0200
582 +++ openssl-0.9.8h-ocf/crypto/cryptlib.h 2008-07-12 04:18:53.000000000 +0200
583 @@ -62,7 +62,7 @@
584 #include <stdlib.h>
585 #include <string.h>
586
587 -#include "e_os.h"
588 +#include <openssl/e_os.h>
589
590 #ifdef OPENSSL_USE_APPLINK
591 #define BIO_FLAGS_UPLINK 0x8000
592 diff -Nur openssl-0.9.8h/crypto/engine/eng_all.c openssl-0.9.8h-ocf/crypto/engine/eng_all.c
593 --- openssl-0.9.8h/crypto/engine/eng_all.c 2007-01-04 23:55:25.000000000 +0100
594 +++ openssl-0.9.8h-ocf/crypto/engine/eng_all.c 2008-07-12 04:18:53.000000000 +0200
595 @@ -104,13 +104,13 @@
596 #endif
597 #endif
598 #ifndef OPENSSL_NO_HW
599 -#if defined(__OpenBSD__) || defined(__FreeBSD__)
600 +#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(HAVE_CRYPTODEV)
601 ENGINE_load_cryptodev();
602 #endif
603 #endif
604 }
605
606 -#if defined(__OpenBSD__) || defined(__FreeBSD__)
607 +#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(HAVE_CRYPTODEV)
608 void ENGINE_setup_bsd_cryptodev(void) {
609 static int bsd_cryptodev_default_loaded = 0;
610 if (!bsd_cryptodev_default_loaded) {
611 diff -Nur openssl-0.9.8h/crypto/engine/eng_cryptodev.c openssl-0.9.8h-ocf/crypto/engine/eng_cryptodev.c
612 --- openssl-0.9.8h/crypto/engine/eng_cryptodev.c 2004-06-15 13:45:42.000000000 +0200
613 +++ openssl-0.9.8h-ocf/crypto/engine/eng_cryptodev.c 2008-07-12 04:18:53.000000000 +0200
614 @@ -68,6 +68,16 @@
615 struct dev_crypto_state {
616 struct session_op d_sess;
617 int d_fd;
618 +
619 +#ifdef USE_CRYPTODEV_DIGESTS
620 + char dummy_mac_key[20];
621 +
622 + unsigned char digest_res[20];
623 + char *mac_data;
624 + int mac_len;
625 +
626 + int copy;
627 +#endif
628 };
629
630 static u_int32_t cryptodev_asymfeat = 0;
631 @@ -75,9 +85,11 @@
632 static int get_asym_dev_crypto(void);
633 static int open_dev_crypto(void);
634 static int get_dev_crypto(void);
635 +#if 0
636 static int cryptodev_max_iv(int cipher);
637 static int cryptodev_key_length_valid(int cipher, int len);
638 static int cipher_nid_to_cryptodev(int nid);
639 +#endif
640 static int get_cryptodev_ciphers(const int **cnids);
641 static int get_cryptodev_digests(const int **cnids);
642 static int cryptodev_usable_ciphers(const int **nids);
643 @@ -100,7 +112,7 @@
644 static int cryptodev_bn_mod_exp(BIGNUM *r, const BIGNUM *a,
645 const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx);
646 static int cryptodev_rsa_nocrt_mod_exp(BIGNUM *r0, const BIGNUM *I,
647 - RSA *rsa);
648 + RSA *rsa, BN_CTX *ctx);
649 static int cryptodev_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa, BN_CTX *ctx);
650 static int cryptodev_dsa_bn_mod_exp(DSA *dsa, BIGNUM *r, BIGNUM *a,
651 const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx);
652 @@ -133,6 +145,7 @@
653 { CRYPTO_DES_CBC, NID_des_cbc, 8, 8, },
654 { CRYPTO_3DES_CBC, NID_des_ede3_cbc, 8, 24, },
655 { CRYPTO_AES_CBC, NID_aes_128_cbc, 16, 16, },
656 + { CRYPTO_AES_CBC, NID_aes_256_cbc, 16, 32, },
657 { CRYPTO_BLF_CBC, NID_bf_cbc, 8, 16, },
658 { CRYPTO_CAST_CBC, NID_cast5_cbc, 8, 16, },
659 { CRYPTO_SKIPJACK_CBC, NID_undef, 0, 0, },
660 @@ -142,14 +155,15 @@
661 static struct {
662 int id;
663 int nid;
664 + int keylen;
665 } digests[] = {
666 - { CRYPTO_SHA1_HMAC, NID_hmacWithSHA1, },
667 - { CRYPTO_RIPEMD160_HMAC, NID_ripemd160, },
668 - { CRYPTO_MD5_KPDK, NID_undef, },
669 - { CRYPTO_SHA1_KPDK, NID_undef, },
670 - { CRYPTO_MD5, NID_md5, },
671 - { CRYPTO_SHA1, NID_undef, },
672 - { 0, NID_undef, },
673 + { CRYPTO_SHA1_HMAC, NID_hmacWithSHA1, 20},
674 + { CRYPTO_RIPEMD160_HMAC, NID_ripemd160, 16/*?*/},
675 + { CRYPTO_MD5_KPDK, NID_undef, 0},
676 + { CRYPTO_SHA1_KPDK, NID_undef, 0},
677 + { CRYPTO_MD5, NID_md5, 16},
678 + { CRYPTO_SHA1, NID_sha1, 20},
679 + { 0, NID_undef, 0},
680 };
681
682 /*
683 @@ -176,10 +190,17 @@
684 static int
685 get_dev_crypto(void)
686 {
687 - int fd, retfd;
688 + static int fd = -1;
689 + int retfd;
690
691 - if ((fd = open_dev_crypto()) == -1)
692 - return (-1);
693 + if (fd == -1) {
694 + if ((fd = open_dev_crypto()) == -1)
695 + return (-1);
696 + if (fcntl(fd, F_SETFD, 1) == -1) {
697 + close(fd);
698 + return (-1);
699 + }
700 + }
701 if (ioctl(fd, CRIOGET, &retfd) == -1)
702 return (-1);
703
704 @@ -202,6 +223,7 @@
705 return fd;
706 }
707
708 +#if 0
709 /*
710 * XXXX this needs to be set for each alg - and determined from
711 * a running card.
712 @@ -245,6 +267,7 @@
713 return (ciphers[i].id);
714 return (0);
715 }
716 +#endif
717
718 /*
719 * Find out what ciphers /dev/crypto will let us have a session for.
720 @@ -264,7 +287,7 @@
721 return (0);
722 }
723 memset(&sess, 0, sizeof(sess));
724 - sess.key = (caddr_t)"123456781234567812345678";
725 + sess.key = (caddr_t)"123456789abcdefghijklmno";
726
727 for (i = 0; ciphers[i].id && count < CRYPTO_ALGORITHM_MAX; i++) {
728 if (ciphers[i].nid == NID_undef)
729 @@ -303,10 +326,12 @@
730 return (0);
731 }
732 memset(&sess, 0, sizeof(sess));
733 + sess.mackey = (caddr_t)"123456789abcdefghijklmno";
734 for (i = 0; digests[i].id && count < CRYPTO_ALGORITHM_MAX; i++) {
735 if (digests[i].nid == NID_undef)
736 continue;
737 sess.mac = digests[i].id;
738 + sess.mackeylen = digests[i].keylen;
739 sess.cipher = 0;
740 if (ioctl(fd, CIOCGSESSION, &sess) != -1 &&
741 ioctl(fd, CIOCFSESSION, &sess.ses) != -1)
742 @@ -351,6 +376,9 @@
743 static int
744 cryptodev_usable_digests(const int **nids)
745 {
746 +#ifdef USE_CRYPTODEV_DIGESTS
747 + return (get_cryptodev_digests(nids));
748 +#else
749 /*
750 * XXXX just disable all digests for now, because it sucks.
751 * we need a better way to decide this - i.e. I may not
752 @@ -365,6 +393,7 @@
753 */
754 *nids = NULL;
755 return (0);
756 +#endif
757 }
758
759 static int
760 @@ -427,16 +456,20 @@
761 {
762 struct dev_crypto_state *state = ctx->cipher_data;
763 struct session_op *sess = &state->d_sess;
764 - int cipher;
765 -
766 - if ((cipher = cipher_nid_to_cryptodev(ctx->cipher->nid)) == NID_undef)
767 - return (0);
768 + int cipher, i;
769
770 - if (ctx->cipher->iv_len > cryptodev_max_iv(cipher))
771 - return (0);
772 + for (i = 0; ciphers[i].id; i++)
773 + if (ctx->cipher->nid == ciphers[i].nid &&
774 + ctx->cipher->iv_len <= ciphers[i].ivmax &&
775 + ctx->key_len == ciphers[i].keylen) {
776 + cipher = ciphers[i].id;
777 + break;
778 + }
779
780 - if (!cryptodev_key_length_valid(cipher, ctx->key_len))
781 + if (!ciphers[i].id) {
782 + state->d_fd = -1;
783 return (0);
784 + }
785
786 memset(sess, 0, sizeof(struct session_op));
787
788 @@ -563,6 +596,19 @@
789 NULL
790 };
791
792 +const EVP_CIPHER cryptodev_aes_256_cbc = {
793 + NID_aes_256_cbc,
794 + 16, 32, 16,
795 + EVP_CIPH_CBC_MODE,
796 + cryptodev_init_key,
797 + cryptodev_cipher,
798 + cryptodev_cleanup,
799 + sizeof(struct dev_crypto_state),
800 + EVP_CIPHER_set_asn1_iv,
801 + EVP_CIPHER_get_asn1_iv,
802 + NULL
803 +};
804 +
805 /*
806 * Registered by the ENGINE when used to find out how to deal with
807 * a particular NID in the ENGINE. this says what we'll do at the
808 @@ -591,6 +637,9 @@
809 case NID_aes_128_cbc:
810 *cipher = &cryptodev_aes_cbc;
811 break;
812 + case NID_aes_256_cbc:
813 + *cipher = &cryptodev_aes_256_cbc;
814 + break;
815 default:
816 *cipher = NULL;
817 break;
818 @@ -598,6 +647,234 @@
819 return (*cipher != NULL);
820 }
821
822 +
823 +#ifdef USE_CRYPTODEV_DIGESTS
824 +
825 +/* convert digest type to cryptodev */
826 +static int
827 +digest_nid_to_cryptodev(int nid)
828 +{
829 + int i;
830 +
831 + for (i = 0; digests[i].id; i++)
832 + if (digests[i].nid == nid)
833 + return (digests[i].id);
834 + return (0);
835 +}
836 +
837 +
838 +static int
839 +digest_key_length(int nid)
840 +{
841 + int i;
842 +
843 + for (i = 0; digests[i].id; i++)
844 + if (digests[i].nid == nid)
845 + return digests[i].keylen;
846 + return (0);
847 +}
848 +
849 +
850 +static int cryptodev_digest_init(EVP_MD_CTX *ctx)
851 +{
852 + struct dev_crypto_state *state = ctx->md_data;
853 + struct session_op *sess = &state->d_sess;
854 + int digest;
855 +
856 + if ((digest = digest_nid_to_cryptodev(ctx->digest->type)) == NID_undef){
857 + printf("cryptodev_digest_init: Can't get digest \n");
858 + return (0);
859 + }
860 +
861 + memset(state, 0, sizeof(struct dev_crypto_state));
862 +
863 + if ((state->d_fd = get_dev_crypto()) < 0) {
864 + printf("cryptodev_digest_init: Can't get Dev \n");
865 + return (0);
866 + }
867 +
868 + sess->mackey = state->dummy_mac_key;
869 + sess->mackeylen = digest_key_length(ctx->digest->type);
870 + sess->mac = digest;
871 +
872 + if (ioctl(state->d_fd, CIOCGSESSION, sess) < 0) {
873 + close(state->d_fd);
874 + state->d_fd = -1;
875 + printf("cryptodev_digest_init: Open session failed\n");
876 + return (0);
877 + }
878 +
879 + return (1);
880 +}
881 +
882 +static int cryptodev_digest_update(EVP_MD_CTX *ctx, const void *data,
883 + size_t count)
884 +{
885 + struct crypt_op cryp;
886 + struct dev_crypto_state *state = ctx->md_data;
887 + struct session_op *sess = &state->d_sess;
888 +
889 + if (!data || state->d_fd < 0) {
890 + printf("cryptodev_digest_update: illegal inputs \n");
891 + return (0);
892 + }
893 +
894 + if (!count) {
895 + return (0);
896 + }
897 +
898 + if (!(ctx->flags & EVP_MD_CTX_FLAG_ONESHOT)) {
899 + /* if application doesn't support one buffer */
900 + state->mac_data = OPENSSL_realloc(state->mac_data, state->mac_len + count);
901 +
902 + if (!state->mac_data) {
903 + printf("cryptodev_digest_update: realloc failed\n");
904 + return (0);
905 + }
906 +
907 + memcpy(state->mac_data + state->mac_len, data, count);
908 + state->mac_len += count;
909 +
910 + return (1);
911 + }
912 +
913 + memset(&cryp, 0, sizeof(cryp));
914 +
915 + cryp.ses = sess->ses;
916 + cryp.flags = 0;
917 + cryp.len = count;
918 + cryp.src = (caddr_t) data;
919 + cryp.dst = NULL;
920 + cryp.mac = state->digest_res;
921 + if (ioctl(state->d_fd, CIOCCRYPT, &cryp) < 0) {
922 + printf("cryptodev_digest_update: digest failed\n");
923 + return (0);
924 + }
925 + return (1);
926 +}
927 +
928 +
929 +static int cryptodev_digest_final(EVP_MD_CTX *ctx, unsigned char *md)
930 +{
931 + struct crypt_op cryp;
932 + struct dev_crypto_state *state = ctx->md_data;
933 + struct session_op *sess = &state->d_sess;
934 +
935 + int ret = 1;
936 +
937 + if (!md || state->d_fd < 0) {
938 + printf("cryptodev_digest_final: illegal input\n");
939 + return(0);
940 + }
941 +
942 + if (! (ctx->flags & EVP_MD_CTX_FLAG_ONESHOT) ) {
943 + /* if application doesn't support one buffer */
944 + memset(&cryp, 0, sizeof(cryp));
945 +
946 + cryp.ses = sess->ses;
947 + cryp.flags = 0;
948 + cryp.len = state->mac_len;
949 + cryp.src = state->mac_data;
950 + cryp.dst = NULL;
951 + cryp.mac = md;
952 +
953 + if (ioctl(state->d_fd, CIOCCRYPT, &cryp) < 0) {
954 + printf("cryptodev_digest_final: digest failed\n");
955 + return (0);
956 + }
957 +
958 + return 1;
959 + }
960 +
961 + memcpy(md, state->digest_res, ctx->digest->md_size);
962 +
963 + return (ret);
964 +}
965 +
966 +
967 +static int cryptodev_digest_cleanup(EVP_MD_CTX *ctx)
968 +{
969 + int ret = 1;
970 + struct dev_crypto_state *state = ctx->md_data;
971 + struct session_op *sess = &state->d_sess;
972 +
973 + if (state->d_fd < 0) {
974 + printf("cryptodev_digest_cleanup: illegal input\n");
975 + return (0);
976 + }
977 +
978 + if (state->mac_data) {
979 + OPENSSL_free(state->mac_data);
980 + state->mac_data = NULL;
981 + state->mac_len = 0;
982 + }
983 +
984 + if (state->copy)
985 + return 1;
986 +
987 + if (ioctl(state->d_fd, CIOCFSESSION, &sess->ses) < 0) {
988 + printf("cryptodev_digest_cleanup: failed to close session\n");
989 + ret = 0;
990 + } else {
991 + ret = 1;
992 + }
993 + close(state->d_fd);
994 + state->d_fd = -1;
995 +
996 + return (ret);
997 +}
998 +
999 +static int cryptodev_digest_copy(EVP_MD_CTX *to,const EVP_MD_CTX *from)
1000 +{
1001 + struct dev_crypto_state *fstate = from->md_data;
1002 + struct dev_crypto_state *dstate = to->md_data;
1003 +
1004 + memcpy(dstate, fstate, sizeof(struct dev_crypto_state));
1005 +
1006 + if (fstate->mac_len != 0) {
1007 + dstate->mac_data = OPENSSL_malloc(fstate->mac_len);
1008 + memcpy(dstate->mac_data, fstate->mac_data, fstate->mac_len);
1009 + }
1010 +
1011 + dstate->copy = 1;
1012 +
1013 + return 1;
1014 +}
1015 +
1016 +
1017 +const EVP_MD cryptodev_sha1 = {
1018 + NID_sha1,
1019 + NID_undef,
1020 + SHA_DIGEST_LENGTH,
1021 + EVP_MD_FLAG_ONESHOT,
1022 + cryptodev_digest_init,
1023 + cryptodev_digest_update,
1024 + cryptodev_digest_final,
1025 + cryptodev_digest_copy,
1026 + cryptodev_digest_cleanup,
1027 + EVP_PKEY_NULL_method,
1028 + SHA_CBLOCK,
1029 + sizeof(struct dev_crypto_state),
1030 +};
1031 +
1032 +const EVP_MD cryptodev_md5 = {
1033 + NID_md5,
1034 + NID_undef,
1035 + 16 /* MD5_DIGEST_LENGTH */,
1036 + EVP_MD_FLAG_ONESHOT,
1037 + cryptodev_digest_init,
1038 + cryptodev_digest_update,
1039 + cryptodev_digest_final,
1040 + cryptodev_digest_copy,
1041 + cryptodev_digest_cleanup,
1042 + EVP_PKEY_NULL_method,
1043 + 64 /* MD5_CBLOCK */,
1044 + sizeof(struct dev_crypto_state),
1045 +};
1046 +
1047 +#endif /* USE_CRYPTODEV_DIGESTS */
1048 +
1049 +
1050 static int
1051 cryptodev_engine_digests(ENGINE *e, const EVP_MD **digest,
1052 const int **nids, int nid)
1053 @@ -606,10 +883,15 @@
1054 return (cryptodev_usable_digests(nids));
1055
1056 switch (nid) {
1057 +#ifdef USE_CRYPTODEV_DIGESTS
1058 case NID_md5:
1059 - *digest = NULL; /* need to make a clean md5 critter */
1060 + *digest = &cryptodev_md5;
1061 break;
1062 + case NID_sha1:
1063 + *digest = &cryptodev_sha1;
1064 + break;
1065 default:
1066 +#endif /* USE_CRYPTODEV_DIGESTS */
1067 *digest = NULL;
1068 break;
1069 }
1070 @@ -625,7 +907,7 @@
1071 bn2crparam(const BIGNUM *a, struct crparam *crp)
1072 {
1073 int i, j, k;
1074 - ssize_t words, bytes, bits;
1075 + ssize_t bytes, bits;
1076 u_char *b;
1077
1078 crp->crp_p = NULL;
1079 @@ -637,6 +919,7 @@
1080 b = malloc(bytes);
1081 if (b == NULL)
1082 return (1);
1083 + memset(b, 0, bytes);
1084
1085 crp->crp_p = b;
1086 crp->crp_nbits = bits;
1087 @@ -681,7 +964,7 @@
1088 {
1089 int i;
1090
1091 - for (i = 0; i <= kop->crk_iparams + kop->crk_oparams; i++) {
1092 + for (i = 0; i < kop->crk_iparams + kop->crk_oparams; i++) {
1093 if (kop->crk_param[i].crp_p)
1094 free(kop->crk_param[i].crp_p);
1095 kop->crk_param[i].crp_p = NULL;
1096 @@ -756,12 +1039,10 @@
1097 }
1098
1099 static int
1100 -cryptodev_rsa_nocrt_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa)
1101 +cryptodev_rsa_nocrt_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa, BN_CTX *ctx)
1102 {
1103 int r;
1104 - BN_CTX *ctx;
1105 -
1106 - ctx = BN_CTX_new();
1107 + ctx = BN_CTX_new(); /* not sure why we reallocate this. DM */
1108 r = cryptodev_bn_mod_exp(r0, I, rsa->d, rsa->n, ctx, NULL);
1109 BN_CTX_free(ctx);
1110 return (r);
1111 diff -Nur openssl-0.9.8h/crypto/engine/eng_table.c openssl-0.9.8h-ocf/crypto/engine/eng_table.c
1112 --- openssl-0.9.8h/crypto/engine/eng_table.c 2008-04-28 23:45:43.000000000 +0200
1113 +++ openssl-0.9.8h-ocf/crypto/engine/eng_table.c 2008-07-12 04:18:53.000000000 +0200
1114 @@ -186,6 +186,8 @@
1115 {
1116 engine_unlocked_finish(e, 0);
1117 pile->funct = NULL;
1118 + /* "touch" this ENGINE_CIPHER */
1119 + pile->uptodate = 0;
1120 }
1121 }
1122 static IMPLEMENT_LHASH_DOALL_ARG_FN(int_unregister_cb,ENGINE_PILE *,ENGINE *)
1123 diff -Nur openssl-0.9.8h/crypto/engine/engine.h openssl-0.9.8h-ocf/crypto/engine/engine.h
1124 --- openssl-0.9.8h/crypto/engine/engine.h 2005-11-06 18:48:59.000000000 +0100
1125 +++ openssl-0.9.8h-ocf/crypto/engine/engine.h 2008-07-12 04:18:53.000000000 +0200
1126 @@ -688,7 +688,7 @@
1127 * values. */
1128 void *ENGINE_get_static_state(void);
1129
1130 -#if defined(__OpenBSD__) || defined(__FreeBSD__)
1131 +#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(HAVE_CRYPTODEV)
1132 void ENGINE_setup_bsd_cryptodev(void);
1133 #endif
1134
1135 diff -Nur openssl-0.9.8h/crypto/evp/c_all.c openssl-0.9.8h-ocf/crypto/evp/c_all.c
1136 --- openssl-0.9.8h/crypto/evp/c_all.c 2004-08-29 18:36:04.000000000 +0200
1137 +++ openssl-0.9.8h-ocf/crypto/evp/c_all.c 2008-07-12 04:18:53.000000000 +0200
1138 @@ -83,7 +83,7 @@
1139 OpenSSL_add_all_ciphers();
1140 OpenSSL_add_all_digests();
1141 #ifndef OPENSSL_NO_ENGINE
1142 -# if defined(__OpenBSD__) || defined(__FreeBSD__)
1143 +# if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(HAVE_CRYPTODEV)
1144 ENGINE_setup_bsd_cryptodev();
1145 # endif
1146 #endif
1147 diff -Nur openssl-0.9.8h/crypto/evp/c_alld.c openssl-0.9.8h-ocf/crypto/evp/c_alld.c
1148 --- openssl-0.9.8h/crypto/evp/c_alld.c 2005-04-30 23:51:40.000000000 +0200
1149 +++ openssl-0.9.8h-ocf/crypto/evp/c_alld.c 2008-07-12 04:18:53.000000000 +0200
1150 @@ -81,7 +81,7 @@
1151 EVP_add_digest(EVP_dss());
1152 #endif
1153 #endif
1154 -#ifndef OPENSSL_NO_SHA
1155 +#if !defined(OPENSSL_NO_SHA) && !defined(OPENSSL_NO_SHA1)
1156 EVP_add_digest(EVP_sha1());
1157 EVP_add_digest_alias(SN_sha1,"ssl3-sha1");
1158 EVP_add_digest_alias(SN_sha1WithRSAEncryption,SN_sha1WithRSA);
1159 diff -Nur openssl-0.9.8h/engines/Makefile openssl-0.9.8h-ocf/engines/Makefile
1160 --- openssl-0.9.8h/engines/Makefile 2006-02-04 02:49:34.000000000 +0100
1161 +++ openssl-0.9.8h-ocf/engines/Makefile 2008-07-12 04:18:53.000000000 +0200
1162 @@ -93,6 +93,7 @@
1163 ( echo installing $$l; \
1164 if [ "$(PLATFORM)" != "Cygwin" ]; then \
1165 case "$(CFLAGS)" in \
1166 + *OPENSSL_NO_HW*) continue;; \
1167 *DSO_DLFCN*) sfx="so";; \
1168 *DSO_DL*) sfx="sl";; \
1169 *) sfx="bad";; \
1170 diff -Nur openssl-0.9.8h/util/domd openssl-0.9.8h-ocf/util/domd
1171 --- openssl-0.9.8h/util/domd 2005-03-30 16:44:50.000000000 +0200
1172 +++ openssl-0.9.8h-ocf/util/domd 2008-07-12 04:18:53.000000000 +0200
1173 @@ -23,13 +23,17 @@
1174 done
1175 sed -e '/^# DO NOT DELETE.*/,$d' < Makefile > Makefile.tmp
1176 echo '# DO NOT DELETE THIS LINE -- make depend depends on it.' >> Makefile.tmp
1177 - ${MAKEDEPEND} -D OPENSSL_DOING_MAKEDEPEND -M $args >> Makefile.tmp
1178 + ${MAKEDEPEND} -D OPENSSL_DOING_MAKEDEPEND -M $args >> Makefile.tmp &&
1179 ${PERL} $TOP/util/clean-depend.pl < Makefile.tmp > Makefile.new
1180 + RC=$?
1181 rm -f Makefile.tmp
1182 else
1183 - ${MAKEDEPEND} -D OPENSSL_DOING_MAKEDEPEND $@
1184 + ${MAKEDEPEND} -D OPENSSL_DOING_MAKEDEPEND $@ && \
1185 ${PERL} $TOP/util/clean-depend.pl < Makefile > Makefile.new
1186 + RC=$?
1187 fi
1188 mv Makefile.new Makefile
1189 # unfake the presence of Kerberos
1190 rm $TOP/krb5.h
1191 +
1192 +exit $RC