crypto.c (1a91ccccc68c27c015b83c12596127169992bd76) crypto.c (f544a528731c3d599bb1d7b5828acd21a1fd543d)
1/* $FreeBSD$ */
2/* $OpenBSD: crypto.c,v 1.38 2002/06/11 11:14:29 beck Exp $ */
3/*
4 * The author of this code is Angelos D. Keromytis (angelos@cis.upenn.edu)
5 *
6 * This code was written by Angelos D. Keromytis in Athens, Greece, in
7 * February 2000. Network Security Technologies Inc. (NSTI) kindly
8 * supported the development of this code.

--- 109 unchanged lines hidden (view full) ---

118 TAILQ_INIT(&crp_q);
119 TAILQ_INIT(&crp_kq);
120 mtx_init(&crypto_q_mtx, "crypto op queues", NULL, MTX_DEF);
121
122 TAILQ_INIT(&crp_ret_q);
123 TAILQ_INIT(&crp_ret_kq);
124 mtx_init(&crypto_ret_q_mtx, "crypto return queues", NULL, MTX_DEF);
125}
1/* $FreeBSD$ */
2/* $OpenBSD: crypto.c,v 1.38 2002/06/11 11:14:29 beck Exp $ */
3/*
4 * The author of this code is Angelos D. Keromytis (angelos@cis.upenn.edu)
5 *
6 * This code was written by Angelos D. Keromytis in Athens, Greece, in
7 * February 2000. Network Security Technologies Inc. (NSTI) kindly
8 * supported the development of this code.

--- 109 unchanged lines hidden (view full) ---

118 TAILQ_INIT(&crp_q);
119 TAILQ_INIT(&crp_kq);
120 mtx_init(&crypto_q_mtx, "crypto op queues", NULL, MTX_DEF);
121
122 TAILQ_INIT(&crp_ret_q);
123 TAILQ_INIT(&crp_ret_kq);
124 mtx_init(&crypto_ret_q_mtx, "crypto return queues", NULL, MTX_DEF);
125}
126SYSINIT(crypto_init, SI_SUB_DRIVERS, SI_ORDER_FIRST, crypto_init, NULL)
127
128/*
126
127/*
128 * Initialization code, both for static and dynamic loading.
129 */
130static int
131crypto_modevent(module_t mod, int type, void *unused)
132{
133 switch (type) {
134 case MOD_LOAD:
135 crypto_init();
136 if (bootverbose)
137 printf("crypto: <crypto core>\n");
138 return 0;
139 case MOD_UNLOAD:
140 /*XXX disallow if active sessions */
141 /*XXX kill kthreads */
142 return 0;
143 }
144 return EINVAL;
145}
146
147static moduledata_t crypto_mod = {
148 "crypto",
149 crypto_modevent,
150 0
151};
152MODULE_VERSION(crypto, 1);
153DECLARE_MODULE(crypto, crypto_mod, SI_SUB_PSEUDO, SI_ORDER_SECOND);
154
155/*
129 * Create a new session.
130 */
131int
132crypto_newsession(u_int64_t *sid, struct cryptoini *cri, int hard)
133{
134 struct cryptoini *cr;
135 u_int32_t hid, lid;
136 int err = EINVAL;

--- 768 unchanged lines hidden (view full) ---

905 }
906 }
907}
908static struct kproc_desc crypto_kp = {
909 "crypto",
910 crypto_proc,
911 &cryptoproc
912};
156 * Create a new session.
157 */
158int
159crypto_newsession(u_int64_t *sid, struct cryptoini *cri, int hard)
160{
161 struct cryptoini *cr;
162 u_int32_t hid, lid;
163 int err = EINVAL;

--- 768 unchanged lines hidden (view full) ---

932 }
933 }
934}
935static struct kproc_desc crypto_kp = {
936 "crypto",
937 crypto_proc,
938 &cryptoproc
939};
913SYSINIT(crypto_proc, SI_SUB_KTHREAD_IDLE, SI_ORDER_ANY,
940SYSINIT(crypto_proc, SI_SUB_KTHREAD_IDLE, SI_ORDER_THIRD,
914 kproc_start, &crypto_kp)
915
916static struct proc *cryptoretproc;
917
918static void
919crypto_ret_shutdown(void *arg, int howto)
920{
921 /* XXX flush queues */

--- 45 unchanged lines hidden (view full) ---

967 }
968 }
969}
970static struct kproc_desc crypto_ret_kp = {
971 "crypto returns",
972 crypto_ret_proc,
973 &cryptoretproc
974};
941 kproc_start, &crypto_kp)
942
943static struct proc *cryptoretproc;
944
945static void
946crypto_ret_shutdown(void *arg, int howto)
947{
948 /* XXX flush queues */

--- 45 unchanged lines hidden (view full) ---

994 }
995 }
996}
997static struct kproc_desc crypto_ret_kp = {
998 "crypto returns",
999 crypto_ret_proc,
1000 &cryptoretproc
1001};
975SYSINIT(crypto_ret_proc, SI_SUB_KTHREAD_IDLE, SI_ORDER_ANY,
1002SYSINIT(crypto_ret_proc, SI_SUB_KTHREAD_IDLE, SI_ORDER_THIRD,
976 kproc_start, &crypto_ret_kp)
1003 kproc_start, &crypto_ret_kp)