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 | |
| parent | e28eb32049a4627a449ae60b3eb01b49b34578d5 (diff) | |
opencrypto: crypto_dispatch never fails now. Make it return void.
Same with crypto_kdispatch.
Diffstat (limited to 'sys')
| -rw-r--r-- | sys/netipsec/xform_ah.c | 10 | ||||
| -rw-r--r-- | sys/netipsec/xform_esp.c | 10 | ||||
| -rw-r--r-- | sys/netipsec/xform_ipcomp.c | 10 | ||||
| -rw-r--r-- | sys/opencrypto/crypto.c | 12 | ||||
| -rw-r--r-- | sys/opencrypto/cryptodev.c | 29 | ||||
| -rw-r--r-- | sys/opencrypto/cryptodev.h | 6 |
6 files changed, 35 insertions, 42 deletions
diff --git a/sys/netipsec/xform_ah.c b/sys/netipsec/xform_ah.c index c4aa5a2a823..4991b54645e 100644 --- a/sys/netipsec/xform_ah.c +++ b/sys/netipsec/xform_ah.c @@ -1,4 +1,4 @@ -/* $NetBSD: xform_ah.c,v 1.113 2022/05/22 11:40:03 riastradh Exp $ */ +/* $NetBSD: xform_ah.c,v 1.114 2022/05/22 11:40:29 riastradh Exp $ */ /* $FreeBSD: xform_ah.c,v 1.1.4.1 2003/01/24 05:11:36 sam Exp $ */ /* $OpenBSD: ip_ah.c,v 1.63 2001/06/26 06:18:58 angelos Exp $ */ /* @@ -39,7 +39,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: xform_ah.c,v 1.113 2022/05/22 11:40:03 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: xform_ah.c,v 1.114 2022/05/22 11:40:29 riastradh Exp $"); #if defined(_KERNEL_OPT) #include "opt_inet.h" @@ -691,7 +691,8 @@ ah_input(struct mbuf *m, struct secasvar *sav, int skip, int protoff) crp->crp_ilen, tc->tc_skip, crda->crd_len, crda->crd_skip, crda->crd_inject); - return crypto_dispatch(crp); + crypto_dispatch(crp); + return 0; bad: if (tc != NULL) { @@ -1106,7 +1107,8 @@ ah_output(struct mbuf *m, const struct ipsecrequest *isr, struct secasvar *sav, tc->tc_flags = flags; tc->tc_sav = sav; - return crypto_dispatch(crp); + crypto_dispatch(crp); + return 0; bad_tc: if (__predict_true(pool_used)) diff --git a/sys/netipsec/xform_esp.c b/sys/netipsec/xform_esp.c index 1375d274d6c..f27f5883e04 100644 --- a/sys/netipsec/xform_esp.c +++ b/sys/netipsec/xform_esp.c @@ -1,4 +1,4 @@ -/* $NetBSD: xform_esp.c,v 1.104 2022/05/22 11:40:03 riastradh Exp $ */ +/* $NetBSD: xform_esp.c,v 1.105 2022/05/22 11:40:29 riastradh Exp $ */ /* $FreeBSD: xform_esp.c,v 1.2.2.1 2003/01/24 05:11:36 sam Exp $ */ /* $OpenBSD: ip_esp.c,v 1.69 2001/06/26 06:18:59 angelos Exp $ */ @@ -39,7 +39,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: xform_esp.c,v 1.104 2022/05/22 11:40:03 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: xform_esp.c,v 1.105 2022/05/22 11:40:29 riastradh Exp $"); #if defined(_KERNEL_OPT) #include "opt_inet.h" @@ -472,7 +472,8 @@ esp_input(struct mbuf *m, struct secasvar *sav, int skip, int protoff) crde->crd_klen = _KEYBITS(sav->key_enc); /* XXX Rounds ? */ - return crypto_dispatch(crp); + crypto_dispatch(crp); + return 0; out2: pool_cache_put(esp_tdb_crypto_pool_cache, tc); @@ -924,7 +925,8 @@ esp_output(struct mbuf *m, const struct ipsecrequest *isr, struct secasvar *sav, } } - return crypto_dispatch(crp); + crypto_dispatch(crp); + return 0; bad: if (m) diff --git a/sys/netipsec/xform_ipcomp.c b/sys/netipsec/xform_ipcomp.c index 74caf604b2d..b74e49066f4 100644 --- a/sys/netipsec/xform_ipcomp.c +++ b/sys/netipsec/xform_ipcomp.c @@ -1,4 +1,4 @@ -/* $NetBSD: xform_ipcomp.c,v 1.73 2022/05/22 11:40:03 riastradh Exp $ */ +/* $NetBSD: xform_ipcomp.c,v 1.74 2022/05/22 11:40:29 riastradh Exp $ */ /* $FreeBSD: xform_ipcomp.c,v 1.1.4.1 2003/01/24 05:11:36 sam Exp $ */ /* $OpenBSD: ip_ipcomp.c,v 1.1 2001/07/05 12:08:52 jjbg Exp $ */ @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: xform_ipcomp.c,v 1.73 2022/05/22 11:40:03 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: xform_ipcomp.c,v 1.74 2022/05/22 11:40:29 riastradh Exp $"); /* IP payload compression protocol (IPComp), see RFC 2393 */ #if defined(_KERNEL_OPT) @@ -208,7 +208,8 @@ ipcomp_input(struct mbuf *m, struct secasvar *sav, int skip, int protoff) tc->tc_skip = skip; tc->tc_sav = sav; - return crypto_dispatch(crp); + crypto_dispatch(crp); + return 0; error_tc: pool_cache_put(ipcomp_tdb_crypto_pool_cache, tc); @@ -493,7 +494,8 @@ ipcomp_output(struct mbuf *m, const struct ipsecrequest *isr, crp->crp_opaque = tc; crp->crp_sid = sav->tdb_cryptoid; - return crypto_dispatch(crp); + crypto_dispatch(crp); + return 0; bad: if (m) 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); |
