Making OpenSSLcrypto to use crypto framework

Jonathan Stone <[email protected]>
Newsgroups gmane.os.netbsd.devel.crypto,gmane.os.netbsd.devel.packages
Message-ID <[email protected]>
[I thoguht I'd sent this to tech-crypto last week, but it disappeared;
possibly some Stanford SMTP lossage with the recent Microsoft worm.]

The following patch should make OpenSSL use the crypto framework,
taking advantage of any configured crypto accelerators. It requires
the file /usr/include/crypto/cryptodev.h, which will shortly be
added to the 'comp' set.    At runtime it will need /dev/crypto.

Once that's done, what are our opinions about committing such a patch?
Are there pkgs which should be modified to take account of this ---
Angelos Keromytis suggested that if Apache runs chroot'ed, its chroot
area should have a /dev/crypto created as part of pkg installation (or
at least a note to that effect).

Last, do we have a channel to feed a final patch into the OpenSSL teamn? 


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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.