summaryrefslogtreecommitdiff
path: root/sys/arch/amd64
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2021-10-13 13:08:59 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2021-10-13 13:08:59 +0000
commitd1e024176c87a67967f6f420011d4067fe2a0944 (patch)
tree12fff95b1415486a2c56a399c96ba260a8f96e18 /sys/arch/amd64
parentc91ef0f523c6bacfcf722eb21933240ac641b84d (diff)
The kernel crypto framework sometimes returned an error, sometimes
the callback was called, and sometimes both. So the caller of that API could not release resources correctly. A bunch of errors can or should not happen, replace them with an assert. Remove redundant checks. crypto_invoke() should not return the error, but pass it via callback. Some old hardware drivers keep part of their inconsistency as I cannot test them. OK mpi@
Diffstat (limited to 'sys/arch/amd64')
-rw-r--r--sys/arch/amd64/amd64/aesni.c7
-rw-r--r--sys/arch/amd64/amd64/via.c7
2 files changed, 4 insertions, 10 deletions
diff --git a/sys/arch/amd64/amd64/aesni.c b/sys/arch/amd64/amd64/aesni.c
index d2e0aa14028..12ed40b37a8 100644
--- a/sys/arch/amd64/amd64/aesni.c
+++ b/sys/arch/amd64/amd64/aesni.c
@@ -1,4 +1,4 @@
-/* $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
@@ -639,10 +639,7 @@ aesni_process(struct cryptop *crp)
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);
diff --git a/sys/arch/amd64/amd64/via.c b/sys/arch/amd64/amd64/via.c
index c2b162457d7..d6f04c3a88c 100644
--- a/sys/arch/amd64/amd64/via.c
+++ b/sys/arch/amd64/amd64/via.c
@@ -1,4 +1,4 @@
-/* $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 $ */
/*-
@@ -420,10 +420,7 @@ viac3_crypto_process(struct cryptop *crp)
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) {