Subject: Re: Adding opencrypto, crypto acceelerator to GENERIC kernels?
To: Jason Thorpe <thorpej@wasabisystems.com>
From: Jonathan Stone <jonathan@DSG.Stanford.EDU>
List: tech-kern
Date: 11/18/2003 16:07:23
In message <953B91FE-1A14-11D8-B449-000A957650EC@wasabisystems.com>
Jason Thorpe writes:
>I agree -- please add it.

I added stanzas for opencrypto and hardware crypto accelerators to the
i386 GENERIC config. (Besides the PCI devices we have, FreeBSD
supports one more PCI device, and I know of at least one pc-card
accelerator with open-source drivers.)

I'm going to leave it there for a couple of days, in case anyone has
feedback about placement. I'm also re-thinking whether to add an
attribute for the crypto framework, just in case someone wants the
framework (e.g., for fast-ipsec) but explicttly doesnt want
/dev/crypto.

[OpenSSL support]

Below is the patch I posted to tech-crypto in August.  I know Jason
has tried it; last call for feedback before I commit this, too...
Please send me an explicit cc: with any feedback.



Index: crypto/dist/openssl//crypto/engine/eng_all.c
===================================================================
RCS file: /cvsroot/src/crypto/dist/openssl/crypto/engine/eng_all.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 eng_all.c
--- crypto/dist/openssl//crypto/engine/eng_all.c	2003/07/24 08:27:13	1.1.1.1
+++ crypto/dist/openssl//crypto/engine/eng_all.c	2003/08/15 21:09:51
@@ -95,13 +95,13 @@
 #ifndef OPENSSL_NO_HW_4758_CCA
 	ENGINE_load_4758cca();
 #endif
-#if defined(__OpenBSD__) || defined(__FreeBSD__)
+#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__)
 	ENGINE_load_cryptodev();
 #endif
 #endif
 	}
 
-#if defined(__OpenBSD__) || defined(__FreeBSD__)
+#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__)
 void ENGINE_setup_bsd_cryptodev(void) {
 	static int bsd_cryptodev_default_loaded = 0;
 	if (!bsd_cryptodev_default_loaded) {
Index: crypto/dist/openssl//crypto/engine/hw_cryptodev.c
===================================================================
RCS file: /cvsroot/src/crypto/dist/openssl/crypto/engine/hw_cryptodev.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 hw_cryptodev.c
--- crypto/dist/openssl//crypto/engine/hw_cryptodev.c	2003/07/24 08:27:19	1.1.1.1
+++ crypto/dist/openssl//crypto/engine/hw_cryptodev.c	2003/08/15 21:09:52
@@ -33,9 +33,9 @@
 #include <openssl/engine.h>
 #include <openssl/evp.h>
 
-#if (defined(__unix__) || defined(unix)) && !defined(USG)
+#if (defined(__unix__) || defined(unix) || defined(__NetBSD__)) && !defined(USG)
 #include <sys/param.h>
-# if (OpenBSD >= 200112) || ((__FreeBSD_version >= 470101 && __FreeBSD_version < 500000) || __FreeBSD_version >= 500041)
+# if (OpenBSD >= 200112) || ((__FreeBSD_version >= 470101 && __FreeBSD_version < 500000) || __FreeBSD_version >= 500041) || (__NetBSD_Version__ >= 106210000)
 # define HAVE_CRYPTODEV
 # endif
 # if (OpenBSD >= 200110)
Index: crypto/dist/openssl//crypto/evp/c_all.c
===================================================================
RCS file: /cvsroot/src/crypto/dist/openssl/crypto/evp/c_all.c,v
retrieving revision 1.1.1.3
diff -u -r1.1.1.3 c_all.c
--- crypto/dist/openssl//crypto/evp/c_all.c	2003/07/24 08:27:27	1.1.1.3
+++ crypto/dist/openssl//crypto/evp/c_all.c	2003/08/15 21:09:52
@@ -74,7 +74,7 @@
 	OpenSSL_add_all_ciphers();
 	OpenSSL_add_all_digests();
 #ifndef OPENSSL_NO_ENGINE
-# if defined(__OpenBSD__) || defined(__FreeBSD__)
+# if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__)
 	ENGINE_setup_bsd_cryptodev();
 # endif
 #endif