summaryrefslogtreecommitdiff
path: root/sys/opencrypto
diff options
context:
space:
mode:
authorjonathan <jonathan@NetBSD.org>2003-12-31 16:44:26 +0000
committerjonathan <jonathan@NetBSD.org>2003-12-31 16:44:26 +0000
commit01c51dab616b2fabe8a7485bc2df2eb47390879b (patch)
tree1a53304479957bc54b7e4b96cb0843f0e486f418 /sys/opencrypto
parent7f9bbe325c8974a695a471e37701efb0a1c80c20 (diff)
Split opencrypto configuration into an attribute, usable by inkernel
clients, and a pseudo-device for userspace access. The attribute is named `opencrypto'. The pseudo-device is renamed to "crypto", which has a dependency on "opencrypto". The sys/conf/majors entry and pseudo-device attach entrypoint are updated to match the new pseudo-device name. Fast IPsec (sys/netipsec/files.ipsec) now lists a dependency on the "opencrypto" attribute. Drivers for crypto accelerators (ubsec, hifn775x) also pull in opencrypto, as providers of opencrypto transforms.
Diffstat (limited to 'sys/opencrypto')
-rw-r--r--sys/opencrypto/crypto.c24
-rw-r--r--sys/opencrypto/files.opencrypto23
2 files changed, 32 insertions, 15 deletions
diff --git a/sys/opencrypto/crypto.c b/sys/opencrypto/crypto.c
index 872a7075b88..df1ec9ccf0f 100644
--- a/sys/opencrypto/crypto.c
+++ b/sys/opencrypto/crypto.c
@@ -1,4 +1,4 @@
-/* $NetBSD: crypto.c,v 1.7 2003/11/19 03:24:20 jonathan Exp $ */
+/* $NetBSD: crypto.c,v 1.8 2003/12/31 16:44:26 jonathan Exp $ */
/* $FreeBSD: src/sys/opencrypto/crypto.c,v 1.4.2.5 2003/02/26 00:14:05 sam Exp $ */
/* $OpenBSD: crypto.c,v 1.41 2002/07/17 23:52:38 art Exp $ */
@@ -24,7 +24,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: crypto.c,v 1.7 2003/11/19 03:24:20 jonathan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: crypto.c,v 1.8 2003/12/31 16:44:26 jonathan Exp $");
/* XXX FIXME: should be defopt'ed */
#define CRYPTO_TIMING /* enable cryptop timing stuff */
@@ -99,7 +99,7 @@ struct pool cryptodesc_pool;
int crypto_pool_initialized = 0;
#ifdef __NetBSD__
-void opencryptoattach(int);
+void cryptoattach(int);
static void deferred_crypto_thread(void *arg);
#endif
@@ -117,7 +117,7 @@ int crypto_userasymcrypto = 1; /* userland may do asym crypto reqs */
* crypto_devallowsoft > 0: Allow user requests only for transforms which
* are hardware-accelerated.
*/
-int crypto_devallowsoft = 1; /* only use hardware crypto for asym */
+int crypto_devallowsoft = 0; /* only use hardware crypto for asym */
#ifdef __FreeBSD__
SYSCTL_INT(_kern, OID_AUTO, usercrypto, CTLFLAG_RW,
@@ -1202,18 +1202,22 @@ deferred_crypto_thread(void *arg)
error = kthread_create1((void (*)(void*)) cryptoret, NULL,
&cryptoproc, "cryptoret");
if (error) {
- printf("crypto_init: cannot start cryptoret thread; error %d",
- error);
- crypto_destroy();
+ printf("crypto_init: cannot start cryptoret thread; error %d",
+ error);
+ crypto_destroy();
}
+ /*
+ * XXX in absence of FreeBSD mod_init(), call init hooks here,
+ * now that the thread used by software crypto is up and running.
+ */
+ swcr_init();
}
void
-opencryptoattach(int n)
+cryptoattach(int n)
{
- /* XXX in absence of FreeBSD mod_init(), call init hooks here */
- swcr_init();
+ /* Nothing to do. */
}
#ifdef __FreeBSD__
diff --git a/sys/opencrypto/files.opencrypto b/sys/opencrypto/files.opencrypto
index 387f97bff54..7e2ffcc2837 100644
--- a/sys/opencrypto/files.opencrypto
+++ b/sys/opencrypto/files.opencrypto
@@ -1,14 +1,27 @@
-# $NetBSD: files.opencrypto,v 1.13 2003/11/16 12:07:50 tls Exp $
+# $NetBSD: files.opencrypto,v 1.14 2003/12/31 16:44:26 jonathan Exp $
#
#
-defpseudo opencrypto: blowfish, des, cast128, rijndael, ripemd160, sha2, skipjack
+# Opencrypto framework.
+# Devices that provide crypto transforms via opencrypto, or subsystems
+# that use the opencrypto framework, should list opencrypto as a dependency
+# to pull in the framework.
-file opencrypto/criov.c opencrypto
-file opencrypto/cryptodev.c opencrypto
+define opencrypto: blowfish, des, cast128, rijndael, ripemd160, sha2, skipjack
+
+
+file opencrypto/criov.c opencrypto needs-flag
file opencrypto/cryptosoft.c opencrypto
file opencrypto/xform.c opencrypto
-file opencrypto/crypto.c opencrypto needs-flag
+file opencrypto/crypto.c opencrypto
# wrapper around zlib functions
file opencrypto/deflate.c opencrypto
+
+
+# Pseudo-device for userspace access to opencrypto
+# (and thus crypto hardware accelerators).
+
+defpseudo crypto: opencrypto
+
+file opencrypto/cryptodev.c crypto