aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2023-08-28 23:24:42 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2023-08-28 23:24:42 +0000
commit79aeecc89f5c740f2a3b0c30238233d2a6bb7ec7 (patch)
tree22aa6c312ef4283d5e2540a53be1e3969d2aa1d8
parent3e912bdc31a9e5372d3cedf35c6f566871b8ede7 (diff)
downloadsrc-79aeecc89f5c740f2a3b0c30238233d2a6bb7ec7.tar.gz
src-79aeecc89f5c740f2a3b0c30238233d2a6bb7ec7.zip
blake2: Remove dieing flag and rw lock
crypto_unregister_all already disables new sessions and waits for existing sessions to be destroyed before returning. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D41581
-rw-r--r--sys/crypto/blake2/blake2_cryptodev.c22
1 files changed, 0 insertions, 22 deletions
diff --git a/sys/crypto/blake2/blake2_cryptodev.c b/sys/crypto/blake2/blake2_cryptodev.c
index 755ac12c5d78..5c3ec07d7de7 100644
--- a/sys/crypto/blake2/blake2_cryptodev.c
+++ b/sys/crypto/blake2/blake2_cryptodev.c
@@ -29,11 +29,9 @@
#include <sys/bus.h>
#include <sys/kernel.h>
#include <sys/kobj.h>
-#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/module.h>
#include <sys/mutex.h>
-#include <sys/rwlock.h>
#include <sys/smp.h>
#include <blake2.h>
@@ -49,9 +47,7 @@ struct blake2_session {
CTASSERT((size_t)BLAKE2B_KEYBYTES > (size_t)BLAKE2S_KEYBYTES);
struct blake2_softc {
- bool dying;
int32_t cid;
- struct rwlock lock;
};
static int blake2_cipher_setup(struct blake2_session *ses,
@@ -84,7 +80,6 @@ blake2_attach(device_t dev)
struct blake2_softc *sc;
sc = device_get_softc(dev);
- sc->dying = false;
sc->cid = crypto_get_driverid(dev, sizeof(struct blake2_session),
CRYPTOCAP_F_SOFTWARE | CRYPTOCAP_F_SYNC |
@@ -94,8 +89,6 @@ blake2_attach(device_t dev)
return (ENOMEM);
}
- rw_init(&sc->lock, "blake2_lock");
-
return (0);
}
@@ -106,13 +99,8 @@ blake2_detach(device_t dev)
sc = device_get_softc(dev);
- rw_wlock(&sc->lock);
- sc->dying = true;
- rw_wunlock(&sc->lock);
crypto_unregister_all(sc->cid);
- rw_destroy(&sc->lock);
-
return (0);
}
@@ -142,21 +130,11 @@ static int
blake2_newsession(device_t dev, crypto_session_t cses,
const struct crypto_session_params *csp)
{
- struct blake2_softc *sc;
struct blake2_session *ses;
int error;
- sc = device_get_softc(dev);
-
ses = crypto_get_driver_session(cses);
- rw_rlock(&sc->lock);
- if (sc->dying) {
- rw_runlock(&sc->lock);
- return (EINVAL);
- }
- rw_runlock(&sc->lock);
-
error = blake2_cipher_setup(ses, csp);
if (error != 0) {
CRYPTDEB("setup failed");