diff options
| author | riastradh <riastradh@NetBSD.org> | 2022-05-22 11:40:29 +0000 |
|---|---|---|
| committer | riastradh <riastradh@NetBSD.org> | 2022-05-22 11:40:29 +0000 |
| commit | 97a48304ff0aba3fc7292ecf0b39685dc75801e7 (patch) | |
| tree | ee6515ee4e02eda41066e01ad7bda15b8d5db5bd /sys/opencrypto | |
| parent | e28eb32049a4627a449ae60b3eb01b49b34578d5 (diff) | |
opencrypto: crypto_dispatch never fails now. Make it return void.
Same with crypto_kdispatch.
Diffstat (limited to 'sys/opencrypto')
| -rw-r--r-- | sys/opencrypto/crypto.c | 12 | ||||
| -rw-r--r-- | sys/opencrypto/cryptodev.c | 29 | ||||
| -rw-r--r-- | sys/opencrypto/cryptodev.h | 6 |
3 files changed, 17 insertions, 30 deletions
diff --git a/sys/opencrypto/crypto.c b/sys/opencrypto/crypto.c index e828589f804..83bab3a6d65 100644 --- a/sys/opencrypto/crypto.c +++ b/sys/opencrypto/crypto.c @@ -1,4 +1,4 @@ -/* $NetBSD: crypto.c,v 1.128 2022/05/22 11:40:15 riastradh Exp $ */ +/* $NetBSD: crypto.c,v 1.129 2022/05/22 11:40:29 riastradh 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 $ */ @@ -53,7 +53,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: crypto.c,v 1.128 2022/05/22 11:40:15 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: crypto.c,v 1.129 2022/05/22 11:40:29 riastradh Exp $"); #include <sys/param.h> #include <sys/reboot.h> @@ -1274,7 +1274,7 @@ crypto_unblock(u_int32_t driverid, int what) * Dispatch a crypto request to a driver or queue * it, to be processed by the kernel thread. */ -int +void crypto_dispatch(struct cryptop *crp) { int result, s; @@ -1318,7 +1318,7 @@ crypto_dispatch(struct cryptop *crp) softint_schedule(crypto_q_si); kpreempt_enable(); } - return 0; + return; } crp_qs = crypto_get_crp_qs(&s); @@ -1371,14 +1371,13 @@ crypto_dispatch(struct cryptop *crp) out: crypto_put_crp_qs(&s); - return 0; } /* * Add an asymmetric crypto request to a queue, * to be processed by the kernel thread. */ -int +void crypto_kdispatch(struct cryptkop *krp) { int result, s; @@ -1433,7 +1432,6 @@ crypto_kdispatch(struct cryptkop *krp) out: crypto_put_crp_qs(&s); - return 0; } /* diff --git a/sys/opencrypto/cryptodev.c b/sys/opencrypto/cryptodev.c index dfc9f581141..d33e17df1d6 100644 --- a/sys/opencrypto/cryptodev.c +++ b/sys/opencrypto/cryptodev.c @@ -1,4 +1,4 @@ -/* $NetBSD: cryptodev.c,v 1.122 2022/05/22 11:40:03 riastradh Exp $ */ +/* $NetBSD: cryptodev.c,v 1.123 2022/05/22 11:40:29 riastradh Exp $ */ /* $FreeBSD: src/sys/opencrypto/cryptodev.c,v 1.4.2.4 2003/06/03 00:09:02 sam Exp $ */ /* $OpenBSD: cryptodev.c,v 1.53 2002/07/10 22:21:30 mickey Exp $ */ @@ -64,7 +64,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: cryptodev.c,v 1.122 2022/05/22 11:40:03 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cryptodev.c,v 1.123 2022/05/22 11:40:29 riastradh Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -648,13 +648,7 @@ cryptodev_op(struct csession *cse, struct crypt_op *cop, struct lwp *l) } cv_init(&crp->crp_cv, "crydev"); - error = crypto_dispatch(crp); - if (error) { - DPRINTF("not waiting, error.\n"); - cv_destroy(&crp->crp_cv); - goto bail; - } - + crypto_dispatch(crp); mutex_enter(&cryptodev_mtx); while (!(crp->crp_devflags & CRYPTODEV_F_RET)) { DPRINTF("cse->sid[%d]: sleeping on cv %p for crp %p\n", @@ -849,10 +843,7 @@ cryptodev_key(struct crypt_kop *kop) goto fail; } - error = crypto_kdispatch(krp); - if (error != 0) { - goto fail; - } + crypto_kdispatch(krp); mutex_enter(&cryptodev_mtx); while (!(krp->krp_devflags & CRYPTODEV_F_RET)) { @@ -1304,7 +1295,8 @@ cryptodev_mop(struct fcrypt *fcr, #ifdef notyet eagain: #endif - cnop[req].status = crypto_dispatch(crp); + crypto_dispatch(crp); + cnop[req].status = 0; mutex_enter(&cryptodev_mtx); /* XXX why mutex? */ switch (cnop[req].status) { @@ -1455,13 +1447,10 @@ cryptodev_mkey(struct fcrypt *fcr, struct crypt_n_kop *kop, int count) krp->krp_reqid = kop[req].crk_reqid; krp->krp_usropaque = kop[req].crk_opaque; - kop[req].crk_status = crypto_kdispatch(krp); - if (kop[req].crk_status != 0) { - goto fail; - } - + crypto_kdispatch(krp); + kop[req].crk_status = 0; fail: - if(kop[req].crk_status) { + if (kop[req].crk_status) { if (krp) { kop[req].crk_status = krp->krp_status; for (i = 0; i < CRK_MAXPARAM; i++) { diff --git a/sys/opencrypto/cryptodev.h b/sys/opencrypto/cryptodev.h index 283c85af1cc..e092b305a9f 100644 --- a/sys/opencrypto/cryptodev.h +++ b/sys/opencrypto/cryptodev.h @@ -1,4 +1,4 @@ -/* $NetBSD: cryptodev.h,v 1.49 2022/05/22 11:40:03 riastradh Exp $ */ +/* $NetBSD: cryptodev.h,v 1.50 2022/05/22 11:40:29 riastradh Exp $ */ /* $FreeBSD: src/sys/opencrypto/cryptodev.h,v 1.2.2.6 2003/07/02 17:04:50 sam Exp $ */ /* $OpenBSD: cryptodev.h,v 1.33 2002/07/17 23:52:39 art Exp $ */ @@ -609,8 +609,8 @@ extern int crypto_kregister(u_int32_t, int, u_int32_t, void *arg); extern int crypto_unregister(u_int32_t driverid, int alg); extern int crypto_unregister_all(u_int32_t driverid); -extern int crypto_dispatch(struct cryptop *crp); -extern int crypto_kdispatch(struct cryptkop *); +extern void crypto_dispatch(struct cryptop *crp); +extern void crypto_kdispatch(struct cryptkop *); #define CRYPTO_SYMQ 0x1 #define CRYPTO_ASYMQ 0x2 extern int crypto_unblock(u_int32_t, int); |
