-/* $OpenBSD: aesni.c,v 1.50 2021/07/08 09:22:30 bluhm Exp $ */
+/* $OpenBSD: aesni.c,v 1.51 2021/10/13 13:08:58 bluhm Exp $ */
/*-
* Copyright (c) 2003 Jason Wright
* Copyright (c) 2003, 2004 Theo de Raadt
int err = 0;
int i;
- if (crp == NULL || crp->crp_callback == NULL)
- return (EINVAL);
- if (crp->crp_ndesc < 1)
- return (EINVAL);
+ KASSERT(crp->crp_ndesc >= 1);
smr_read_enter();
ses = aesni_get(crp->crp_sid & 0xffffffff);
-/* $OpenBSD: via.c,v 1.34 2021/07/08 09:22:30 bluhm Exp $ */
+/* $OpenBSD: via.c,v 1.35 2021/10/13 13:08:58 bluhm Exp $ */
/* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */
/*-
int sesn, err = 0;
int i;
- if (crp == NULL || crp->crp_callback == NULL)
- return (EINVAL);
- if (crp->crp_ndesc < 1)
- return (EINVAL);
+ KASSERT(crp->crp_ndesc >= 1);
sesn = VIAC3_SESSION(crp->crp_sid);
if (sesn >= sc->sc_nsessions) {
-/* $OpenBSD: cryptox.c,v 1.2 2021/07/08 09:22:30 bluhm Exp $ */
+/* $OpenBSD: cryptox.c,v 1.3 2021/10/13 13:08:58 bluhm Exp $ */
/*
* Copyright (c) 2003 Jason Wright
* Copyright (c) 2003, 2004 Theo de Raadt
int err = 0;
int i;
- if (crp == NULL || crp->crp_callback == NULL)
- return (EINVAL);
- if (crp->crp_ndesc < 1)
- return (EINVAL);
+ KASSERT(crp->crp_ndesc >= 1);
smr_read_enter();
ses = cryptox_get(crp->crp_sid & 0xffffffff);
-/* $OpenBSD: via.c,v 1.47 2021/07/08 09:22:30 bluhm Exp $ */
+/* $OpenBSD: via.c,v 1.48 2021/10/13 13:08:58 bluhm Exp $ */
/* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */
/*-
int sesn, err = 0;
int i;
- if (crp == NULL || crp->crp_callback == NULL)
- return (EINVAL);
- if (crp->crp_ndesc < 1)
- return (EINVAL);
+ KASSERT(crp->crp_ndesc >= 1);
sesn = VIAC3_SESSION(crp->crp_sid);
if (sesn >= sc->sc_nsessions) {
-/* $OpenBSD: glxsb.c,v 1.37 2021/07/08 09:22:30 bluhm Exp $ */
+/* $OpenBSD: glxsb.c,v 1.38 2021/10/13 13:08:58 bluhm Exp $ */
/*
* Copyright (c) 2006 Tom Cosgrove <tom@openbsd.org>
s = splnet();
- if (crp == NULL || crp->crp_callback == NULL) {
- err = EINVAL;
- goto out;
- }
- if (crp->crp_ndesc < 1) {
- err = EINVAL;
- goto out;
- }
+ KASSERT(crp->crp_ndesc >= 1);
sesn = GLXSB_SESSION(crp->crp_sid);
if (sesn >= sc->sc_nsessions) {
-/* $OpenBSD: octcrypto.c,v 1.5 2021/07/08 09:22:30 bluhm Exp $ */
+/* $OpenBSD: octcrypto.c,v 1.6 2021/10/13 13:08:58 bluhm Exp $ */
/*
* Copyright (c) 2018 Visa Hankala
int error = 0;
int i;
- if (crp == NULL || crp->crp_callback == NULL)
- return EINVAL;
-
KASSERT(crp->crp_ndesc >= 1);
smr_read_enter();
-/* $OpenBSD: crypto.c,v 1.85 2021/07/26 21:27:56 bluhm Exp $ */
+/* $OpenBSD: crypto.c,v 1.86 2021/10/13 13:08:58 bluhm Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@cis.upenn.edu)
*
if (crp->crp_flags & CRYPTO_F_NOQUEUE) {
if (lock)
KERNEL_LOCK();
- error = crypto_invoke(crp);
+ crypto_invoke(crp);
if (lock)
KERNEL_UNLOCK();
} else {
/*
* Dispatch a crypto request to the appropriate crypto devices.
*/
-int
+void
crypto_invoke(struct cryptop *crp)
{
u_int64_t nid;
int s, i;
/* Sanity checks. */
- if (crp == NULL || crp->crp_callback == NULL)
- return EINVAL;
+ KASSERT(crp != NULL);
+ KASSERT(crp->crp_callback != NULL);
KERNEL_ASSERT_LOCKED();
s = splvm();
if (crp->crp_ndesc < 1 || crypto_drivers == NULL) {
crp->crp_etype = EINVAL;
- crypto_done(crp);
- splx(s);
- return 0;
+ goto done;
}
hid = (crp->crp_sid >> 32) & 0xffffffff;
}
splx(s);
- return 0;
+ return;
migrate:
/* Migrate session. */
crp->crp_sid = nid;
crp->crp_etype = EAGAIN;
+ done:
crypto_done(crp);
splx(s);
- return 0;
}
/*
-/* $OpenBSD: cryptodev.h,v 1.74 2021/07/26 21:27:56 bluhm Exp $ */
+/* $OpenBSD: cryptodev.h,v 1.75 2021/10/13 13:08:58 bluhm Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@cis.upenn.edu)
int (*)(struct cryptop *));
int crypto_unregister(u_int32_t, int);
int32_t crypto_get_driverid(u_int8_t);
-int crypto_invoke(struct cryptop *);
+void crypto_invoke(struct cryptop *);
void crypto_done(struct cryptop *);
void cuio_copydata(struct uio *, int, int, caddr_t);
-/* $OpenBSD: cryptosoft.c,v 1.88 2021/07/09 15:29:55 bluhm Exp $ */
+/* $OpenBSD: cryptosoft.c,v 1.89 2021/10/13 13:08:58 bluhm Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@cis.upenn.edu)
int type;
int i;
- /* Sanity check */
- if (crp == NULL)
- return EINVAL;
+ KASSERT(crp->crp_ndesc >= 1);
- if (crp->crp_ndesc < 1 || crp->crp_buf == NULL) {
+ if (crp->crp_buf == NULL) {
crp->crp_etype = EINVAL;
goto done;
}
-/* $OpenBSD: hifn7751.c,v 1.180 2020/05/29 04:42:25 deraadt Exp $ */
+/* $OpenBSD: hifn7751.c,v 1.181 2021/10/13 13:08:58 bluhm Exp $ */
/*
* Invertex AEON / Hifn 7751 driver
struct hifn_softc *sc;
struct cryptodesc *crd1, *crd2 = NULL, *maccrd, *enccrd;
- if (crp == NULL || crp->crp_callback == NULL) {
- hifnstats.hst_invalid++;
- return (EINVAL);
- }
-
if (crp->crp_ilen == 0) {
err = EINVAL;
goto errout;
-/* $OpenBSD: safe.c,v 1.45 2021/02/25 02:48:20 dlg Exp $ */
+/* $OpenBSD: safe.c,v 1.46 2021/10/13 13:08:58 bluhm Exp $ */
/*-
* Copyright (c) 2003 Sam Leffler, Errno Consulting
u_int32_t cmd0, cmd1, staterec, iv[4];
s = splnet();
- if (crp == NULL || crp->crp_callback == NULL) {
- safestats.st_invalid++;
- splx(s);
- return (EINVAL);
- }
+
card = SAFE_CARD(crp->crp_sid);
if (card >= safe_cd.cd_ndevs || safe_cd.cd_devs[card] == NULL) {
safestats.st_invalid++;
-/* $OpenBSD: ubsec.c,v 1.167 2021/02/25 02:48:20 dlg Exp $ */
+/* $OpenBSD: ubsec.c,v 1.168 2021/10/13 13:08:58 bluhm Exp $ */
/*
* Copyright (c) 2000 Jason L. Wright (jason@thought.net)
u_int16_t flags = 0;
int ivlen = 0, keylen = 0;
- if (crp == NULL || crp->crp_callback == NULL) {
- ubsecstats.hst_invalid++;
- return (EINVAL);
- }
card = UBSEC_CARD(crp->crp_sid);
if (card >= ubsec_cd.cd_ndevs || ubsec_cd.cd_devs[card] == NULL) {
ubsecstats.hst_invalid++;