summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/dev/hifn/hifn7751.c1
-rw-r--r--sys/dev/ubsec/ubsec.c1
-rw-r--r--sys/modules/Makefile7
-rw-r--r--sys/modules/crypto/Makefile20
-rw-r--r--sys/opencrypto/crypto.c33
-rw-r--r--sys/opencrypto/cryptodev.c1
6 files changed, 59 insertions, 4 deletions
diff --git a/sys/dev/hifn/hifn7751.c b/sys/dev/hifn/hifn7751.c
index c98b326..1d00872 100644
--- a/sys/dev/hifn/hifn7751.c
+++ b/sys/dev/hifn/hifn7751.c
@@ -108,6 +108,7 @@ static driver_t hifn_driver = {
static devclass_t hifn_devclass;
DRIVER_MODULE(hifn, pci, hifn_driver, hifn_devclass, 0, 0);
+MODULE_DEPEND(hifn, crypto, 1, 1, 1);
static void hifn_reset_board(struct hifn_softc *, int);
static void hifn_reset_puc(struct hifn_softc *);
diff --git a/sys/dev/ubsec/ubsec.c b/sys/dev/ubsec/ubsec.c
index 90df6d3..5071989 100644
--- a/sys/dev/ubsec/ubsec.c
+++ b/sys/dev/ubsec/ubsec.c
@@ -124,6 +124,7 @@ static driver_t ubsec_driver = {
static devclass_t ubsec_devclass;
DRIVER_MODULE(ubsec, pci, ubsec_driver, ubsec_devclass, 0, 0);
+MODULE_DEPEND(ubsec, crypto, 1, 1, 1);
static void ubsec_intr(void *);
static int ubsec_newsession(void *, u_int32_t *, struct cryptoini *);
diff --git a/sys/modules/Makefile b/sys/modules/Makefile
index d3f6f6b..a42eed3 100644
--- a/sys/modules/Makefile
+++ b/sys/modules/Makefile
@@ -1,5 +1,9 @@
# $FreeBSD$
+.if exists(${.CURDIR}/../opencrypto) && !defined(NOCRYPT)
+_crypto= crypto
+_cryptodev= cryptodev
+.endif
.if exists(${.CURDIR}/../crypto) && !defined(NOCRYPT)
_random= random
.endif
@@ -19,7 +23,8 @@ SUBDIR= 3dfx \
ccd \
cd9660 \
coda \
- cryptodev \
+ ${_crypto} \
+ ${_cryptodev} \
cue \
dc \
de \
diff --git a/sys/modules/crypto/Makefile b/sys/modules/crypto/Makefile
new file mode 100644
index 0000000..37541b0
--- /dev/null
+++ b/sys/modules/crypto/Makefile
@@ -0,0 +1,20 @@
+# $FreeBSD$
+
+.PATH: ${.CURDIR}/../../opencrypto
+.PATH: ${.CURDIR}/../../crypto
+.PATH: ${.CURDIR}/../../crypto/blowfish
+.PATH: ${.CURDIR}/../../crypto/des
+.PATH: ${.CURDIR}/../../crypto/sha2
+.PATH: ${.CURDIR}/../../net
+
+KMOD = crypto
+SRCS = crypto.c
+SRCS += criov.c crmbuf.c cryptosoft.c xform.c
+SRCS += cast.c deflate.c rmd160.c rijndael.c skipjack.c
+SRCS += bf_enc.c bf_skey.c
+SRCS += des_ecb.c des_enc.c des_setkey.c
+SRCS += sha1.c sha2.c
+SRCS += zlib.c
+SRCS += opt_param.h
+
+.include <bsd.kmod.mk>
diff --git a/sys/opencrypto/crypto.c b/sys/opencrypto/crypto.c
index 9bd2e84..a4e2f5e 100644
--- a/sys/opencrypto/crypto.c
+++ b/sys/opencrypto/crypto.c
@@ -123,7 +123,34 @@ crypto_init(void)
TAILQ_INIT(&crp_ret_kq);
mtx_init(&crypto_ret_q_mtx, "crypto return queues", NULL, MTX_DEF);
}
-SYSINIT(crypto_init, SI_SUB_DRIVERS, SI_ORDER_FIRST, crypto_init, NULL)
+
+/*
+ * Initialization code, both for static and dynamic loading.
+ */
+static int
+crypto_modevent(module_t mod, int type, void *unused)
+{
+ switch (type) {
+ case MOD_LOAD:
+ crypto_init();
+ if (bootverbose)
+ printf("crypto: <crypto core>\n");
+ return 0;
+ case MOD_UNLOAD:
+ /*XXX disallow if active sessions */
+ /*XXX kill kthreads */
+ return 0;
+ }
+ return EINVAL;
+}
+
+static moduledata_t crypto_mod = {
+ "crypto",
+ crypto_modevent,
+ 0
+};
+MODULE_VERSION(crypto, 1);
+DECLARE_MODULE(crypto, crypto_mod, SI_SUB_PSEUDO, SI_ORDER_SECOND);
/*
* Create a new session.
@@ -910,7 +937,7 @@ static struct kproc_desc crypto_kp = {
crypto_proc,
&cryptoproc
};
-SYSINIT(crypto_proc, SI_SUB_KTHREAD_IDLE, SI_ORDER_ANY,
+SYSINIT(crypto_proc, SI_SUB_KTHREAD_IDLE, SI_ORDER_THIRD,
kproc_start, &crypto_kp)
static struct proc *cryptoretproc;
@@ -972,5 +999,5 @@ static struct kproc_desc crypto_ret_kp = {
crypto_ret_proc,
&cryptoretproc
};
-SYSINIT(crypto_ret_proc, SI_SUB_KTHREAD_IDLE, SI_ORDER_ANY,
+SYSINIT(crypto_ret_proc, SI_SUB_KTHREAD_IDLE, SI_ORDER_THIRD,
kproc_start, &crypto_ret_kp)
diff --git a/sys/opencrypto/cryptodev.c b/sys/opencrypto/cryptodev.c
index 6612cef..4967d16 100644
--- a/sys/opencrypto/cryptodev.c
+++ b/sys/opencrypto/cryptodev.c
@@ -794,3 +794,4 @@ static moduledata_t cryptodev_mod = {
};
MODULE_VERSION(cryptodev, 1);
DECLARE_MODULE(cryptodev, cryptodev_mod, SI_SUB_PSEUDO, SI_ORDER_ANY);
+MODULE_DEPEND(cryptodev, crypto, 1, 1, 1);
OpenPOWER on IntegriCloud