Module-ize the 'core' crypto stuff. This may still need to be compiled
into the kernel by default (if required), but other modules can now depend() on this. Fix inter-module dependancy. Earlier version OK'ed by: sam
This commit is contained in:
parent
6c84d0b1a5
commit
f544a52873
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=105251
@ -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 *);
|
||||
|
@ -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 *);
|
||||
|
@ -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 \
|
||||
|
20
sys/modules/crypto/Makefile
Normal file
20
sys/modules/crypto/Makefile
Normal file
@ -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>
|
@ -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)
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user