diff options
| author | jonathan <jonathan@NetBSD.org> | 2003-12-31 16:44:26 +0000 |
|---|---|---|
| committer | jonathan <jonathan@NetBSD.org> | 2003-12-31 16:44:26 +0000 |
| commit | 01c51dab616b2fabe8a7485bc2df2eb47390879b (patch) | |
| tree | 1a53304479957bc54b7e4b96cb0843f0e486f418 | |
| parent | 7f9bbe325c8974a695a471e37701efb0a1c80c20 (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.
| -rw-r--r-- | sys/arch/i386/conf/GENERIC | 6 | ||||
| -rw-r--r-- | sys/conf/majors | 4 | ||||
| -rw-r--r-- | sys/dev/pci/files.pci | 6 | ||||
| -rw-r--r-- | sys/netipsec/files.netipsec | 4 | ||||
| -rw-r--r-- | sys/opencrypto/crypto.c | 24 | ||||
| -rw-r--r-- | sys/opencrypto/files.opencrypto | 23 |
6 files changed, 42 insertions, 25 deletions
diff --git a/sys/arch/i386/conf/GENERIC b/sys/arch/i386/conf/GENERIC index f557276006f..482b9301edb 100644 --- a/sys/arch/i386/conf/GENERIC +++ b/sys/arch/i386/conf/GENERIC @@ -1,4 +1,4 @@ -# $NetBSD: GENERIC,v 1.589 2003/12/30 18:09:50 augustss Exp $ +# $NetBSD: GENERIC,v 1.590 2003/12/31 16:44:26 jonathan Exp $ # # GENERIC machine description file # @@ -22,7 +22,7 @@ include "arch/i386/conf/std.i386" options INCLUDE_CONFIG_FILE # embed config file in kernel binary -#ident "GENERIC-$Revision: 1.589 $" +#ident "GENERIC-$Revision: 1.590 $" maxusers 32 # estimated number of users @@ -1115,7 +1115,7 @@ include "arch/i386/conf/GENERIC.local" # Pseudo-Devices -pseudo-device opencrypto # opencrypto framework +pseudo-device crypto # opencrypto framework # disk/mass storage pseudo-devices pseudo-device ccd 4 # concatenated/striped disk devices diff --git a/sys/conf/majors b/sys/conf/majors index 6b7eccca920..1a445670704 100644 --- a/sys/conf/majors +++ b/sys/conf/majors @@ -1,4 +1,4 @@ -# $NetBSD: majors,v 1.5 2003/12/10 11:40:11 hannken Exp $ +# $NetBSD: majors,v 1.6 2003/12/31 16:44:26 jonathan Exp $ # # Device majors for Machine-Independent drivers. # @@ -9,7 +9,7 @@ # # Majors 160-255 are used for the MI drivers. -device-major crypto char 160 opencrypto +device-major crypto char 160 crypto device-major pf char 161 pf device-major vinum char 162 block 162 vinum device-major fss char 163 block 163 fss diff --git a/sys/dev/pci/files.pci b/sys/dev/pci/files.pci index de69448b24e..9afe0921c0e 100644 --- a/sys/dev/pci/files.pci +++ b/sys/dev/pci/files.pci @@ -1,4 +1,4 @@ -# $NetBSD: files.pci,v 1.204 2003/12/14 01:32:02 thorpej Exp $ +# $NetBSD: files.pci,v 1.205 2003/12/31 16:44:26 jonathan Exp $ # # Config file and device description for machine-independent PCI code. # Included by ports that need it. Requires that the SCSI files be @@ -615,12 +615,12 @@ attach amdpm at pci file dev/pci/amdpm.c amdpm # Hi/fn 7751 -device hifn {} +device hifn: opencrypto attach hifn at pci file dev/pci/hifn7751.c hifn # Bluesteelnet 5501/5601, Broadcom 580x/582x security processor -device ubsec: crypto +device ubsec: opencrypto attach ubsec at pci file dev/pci/ubsec.c ubsec diff --git a/sys/netipsec/files.netipsec b/sys/netipsec/files.netipsec index 2720474a3f2..eec474ed60e 100644 --- a/sys/netipsec/files.netipsec +++ b/sys/netipsec/files.netipsec @@ -1,7 +1,7 @@ -# $Id: files.netipsec,v 1.2 2003/09/20 05:14:42 itojun Exp $ +# $Id: files.netipsec,v 1.3 2003/12/31 16:44:26 jonathan Exp $ # # -defflag opt_ipsec.h FAST_IPSEC +defflag opt_ipsec.h FAST_IPSEC: opencrypto file netipsec/ipsec.c fast_ipsec needs-flag file netipsec/ipsec_input.c fast_ipsec 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 |
