#
6c259f39 |
| 10-Sep-2022 |
rillig <rillig@NetBSD.org> |
fix misspellings of 'available' and nearby typos
|
#
76b7dd34 |
| 22-May-2022 |
riastradh <riastradh@NetBSD.org> |
opencrypto: Prune dead code now that crypto_dispatch never fails.
|
#
893f06d4 |
| 22-May-2022 |
riastradh <riastradh@NetBSD.org> |
opencrypto: crypto_dispatch never fails now. Make it return void.
Same with crypto_kdispatch.
|
#
3bbdee24 |
| 22-May-2022 |
riastradh <riastradh@NetBSD.org> |
opencrypto: Rip out EAGAIN logic when unregistering crypto drivers.
I'm pretty sure this never worked reliably based on code inspection, and it's unlikely to have ever been tested because it only ap
opencrypto: Rip out EAGAIN logic when unregistering crypto drivers.
I'm pretty sure this never worked reliably based on code inspection, and it's unlikely to have ever been tested because it only applies when unregistering a driver -- but we have no crypto drivers for removable devices, so it would only apply if we went out of our way to trigger detach with drvctl.
Instead, just make the operation fail with ENODEV, and remove all the callback logic to resubmit the request on EAGAIN. (Maybe this should be ENXIO, but crypto_kdispatch already does ENODEV.)
show more ...
|
#
33454e6e |
| 22-May-2022 |
riastradh <riastradh@NetBSD.org> |
crypto(4): Nix dead code now that crypto_freesession never fails.
|
#
a1f5e1f2 |
| 22-May-2022 |
riastradh <riastradh@NetBSD.org> |
opencrypto: Make crypto_freesession return void.
No callers use the return value. It is not sensible to allow this to fail.
|
#
410da8f0 |
| 22-May-2022 |
riastradh <riastradh@NetBSD.org> |
crypto(4): crypto_freesession should never fail here.
It can only fail if we pass it an invalid sid, which the logic to maintain the user sessions should not do. So kassert error=0 here.
|
#
979128a4 |
| 22-May-2022 |
riastradh <riastradh@NetBSD.org> |
crypto(4): Refuse crypto operations with nothing in them earlier.
This way we avoid passing 0 to crypto_getreq -- makes it easier to reason about everything downstream.
|
#
3ae8d479 |
| 22-May-2022 |
riastradh <riastradh@NetBSD.org> |
opencrypto: Make crp_callback, krp_callback return void.
Nothing uses the return values inside opencrypto, so let's stop making users return them.
|
#
cb99de1a |
| 22-May-2022 |
riastradh <riastradh@NetBSD.org> |
crypto(4): Fix possible use-after-free in race around detach.
This is extremely unlikely because I don't think we have any drivers for removable crypto decelerators^Waccelerators...but if we were to
crypto(4): Fix possible use-after-free in race around detach.
This is extremely unlikely because I don't think we have any drivers for removable crypto decelerators^Waccelerators...but if we were to sprout one, and someone ran crypto_dispatch concurrently with crypto_unregister, cryptodev_cb/mcb would enter with crp->crp_etype = EAGAIN and with CRYPTO_F_DONE set in crp->crp_flags. In this case, cryptodev_cb/mcb would issue crypto_dispatch but -- since nothing clears CRYPTO_F_DONE -- it would _also_ consider the request done and notify the ioctl thread of that.
With this change, we return early if crypto_dispatch succeeds. No need to consult CRYPTO_F_DONE: if the callback is invoked it's done, and if we try to redispatch it on EAGAIN but crypto_dispatch fails, it's done. (Soon we'll get rid of the possibility of crypto_dispatch failing synchronously, but not just yet.)
XXX This path could really use some testing!
show more ...
|
#
df8ebb18 |
| 21-May-2022 |
riastradh <riastradh@NetBSD.org> |
crypto(4): Fix set-but-unused variable warning.
This deliberately ignores the error code returned by crypto_dispatch, but that error code is fundamentally incoherent and the issue will be mooted by
crypto(4): Fix set-but-unused variable warning.
This deliberately ignores the error code returned by crypto_dispatch, but that error code is fundamentally incoherent and the issue will be mooted by subsequent changes to make it return void and always pass the error through the callback, as well as subsequent changes to rip out the EAGAIN logic anyway.
show more ...
|
#
113b254a |
| 21-May-2022 |
riastradh <riastradh@NetBSD.org> |
crypto(4): Don't signal the condvar for multi-operation completion.
The condvar may be destroyed by the time we got here, and nothing waits on it anyway -- instead the caller is expected to select/p
crypto(4): Don't signal the condvar for multi-operation completion.
The condvar may be destroyed by the time we got here, and nothing waits on it anyway -- instead the caller is expected to select/poll for completion in userland.
The bug was already here, but the recent change to eliminate CRYPTO_F_CBIMM made it happen more often by causing the callback to _always_ be run asynchronously instead of sometimes being run synchronously.
show more ...
|
#
99541d13 |
| 19-May-2022 |
riastradh <riastradh@NetBSD.org> |
opencrypto: Nix CRYPTO_F_USER, CRYPTO_F_CBIMM, CRYPTO_F_CBIFSYNC.
CRYPTO_F_USER is no longer needed. It was introduced in 2008 by darran@ in crypto.c 1.30, cryptodev.c 1.45 in an attempt to avoid d
opencrypto: Nix CRYPTO_F_USER, CRYPTO_F_CBIMM, CRYPTO_F_CBIFSYNC.
CRYPTO_F_USER is no longer needed. It was introduced in 2008 by darran@ in crypto.c 1.30, cryptodev.c 1.45 in an attempt to avoid double-free between the issuing thread and asynchronous callback. But the `fix' didn't work. In 2017, knakahara@ fixed it properly in cryptodev.c 1.87 by distinguishing `the crypto operation has completed' (CRYPTO_F_DONE) from `the callback is done touching the crp object' (CRYPTO_F_DQRETQ, now renamed to CRYPTODEV_F_RET).
CRYPTO_F_CBIMM formerly served to invoke the callback synchronously from the driver's interrupt completion routine, to reduce contention on what was once a single cryptoret thread. Now, there is a per-CPU queue and softint for much cheaper processing, so there is less motivation for this in the first place. So let's remove the complicated logic. This means the callbacks never run in hard interrupt context, which means we don't need to worry about recursion into crypto_dispatch in hard interrupt context.
show more ...
|
#
44ead217 |
| 18-May-2022 |
riastradh <riastradh@NetBSD.org> |
crypto(4): Simplify error test in cryptodev_op.
No functional change intended.
|
#
c4fb4b18 |
| 18-May-2022 |
riastradh <riastradh@NetBSD.org> |
crypto(4): Narrow scope of cryptodev_mtx to cover wait.
No functional change intended -- this only removes an unnecessary lock/unlock cycle in the error case.
|
#
e5e4a95c |
| 18-May-2022 |
riastradh <riastradh@NetBSD.org> |
crypto(4): Nix long-dead code and comments.
|
#
5768c2c4 |
| 18-May-2022 |
riastradh <riastradh@NetBSD.org> |
crypto(4): Use IPL_NONE, not IPL_NET, for /dev/crypto pools.
These are used (pool_get/put) only from thread context, never from interrupt or even soft interrupt context.
|
#
1e4e1466 |
| 17-May-2022 |
riastradh <riastradh@NetBSD.org> |
opencrypto(9): Omit needless casts around callbacks.
Just declare the right types to begin with. No functional change intended.
|
#
97f8debd |
| 31-Mar-2022 |
pgoyette <pgoyette@NetBSD.org> |
For device modules that provide both auto-config and /dev/xxx interfaces, make sure that initialization and destruction follow the proper sequence. This is triggered by the recent changes to the dev
For device modules that provide both auto-config and /dev/xxx interfaces, make sure that initialization and destruction follow the proper sequence. This is triggered by the recent changes to the devsw stuff; per riastradh@ the required call sequence is:
devsw_attach() config_init_component() or config_cf*_attach() ... config_fini_component() or config_cf*_detach() devsw_detach()
While here, add a few missing calls to some of the detach routines.
Testing of these changes has been limited to: 1. compile without build break 2. no related test failures from atf 3. modload/modunload work as well as before.
No functional device testing done, since I don't have any of these devices. Let me know of any damage I might cause here!
XXX Some of the modules affected by this commit are already XXX broken; see kern/56772. This commit does not break any additional modules (as far as I know).
show more ...
|
#
5766dd4a |
| 30-Jun-2020 |
riastradh <riastradh@NetBSD.org> |
Rename enc_xform_rijndael128 -> enc_xform_aes.
Update netipsec dependency.
|
#
328da78d |
| 13-Apr-2020 |
chs <chs@NetBSD.org> |
slightly change and fix the semantics of pool_set*wat(), pool_sethardlimit() and pool_prime() (and their pool_cache_* counterparts):
- the pool_set*wat() APIs are supposed to specify thresholds for
slightly change and fix the semantics of pool_set*wat(), pool_sethardlimit() and pool_prime() (and their pool_cache_* counterparts):
- the pool_set*wat() APIs are supposed to specify thresholds for the count of free items in the pool before pool pages are automatically allocated or freed during pool_get() / pool_put(), whereas pool_sethardlimit() and pool_prime() are supposed to specify minimum and maximum numbers of total items in the pool (both free and allocated). these were somewhat conflated in the existing code, so separate them as they were intended.
- change pool_prime() to take an absolute number of items to preallocate rather than an increment over whatever was done before, and wait for any memory allocations to succeed. since pool_prime() can no longer fail after this, change its return value to void and adjust all callers.
- pool_setlowat() is documented as not immediately attempting to allocate any memory, but it was changed some time ago to immediately try to allocate up to the lowat level, so just fix the manpage to describe the current behaviour.
- add a pool_cache_prime() to complete the API set.
show more ...
|
#
55b16946 |
| 27-Jan-2020 |
pgoyette <pgoyette@NetBSD.org> |
If we get an error from devsw_attach(), don't destroy the error value, since we need to return it to our caller. While we're here, improve the value of the debug message by actually printing the err
If we get an error from devsw_attach(), don't destroy the error value, since we need to return it to our caller. While we're here, improve the value of the debug message by actually printing the error value.
show more ...
|
#
d17a5906 |
| 16-Jan-2020 |
christos <christos@NetBSD.org> |
Initialize the session variable to an impossible session to prevent compiler warnings.
|
#
0055ef44 |
| 29-Nov-2019 |
hikaru <hikaru@NetBSD.org> |
crypto(4): accept CRYPTO_SHA2_384_HMAC and CRYPTO_SHA2_512_HMAC.
|
#
cb94f550 |
| 13-Jun-2019 |
christos <christos@NetBSD.org> |
don't always panic when modunload crypto (int the pool destroy code, because the pools are busy). XXX: this is still racy; we need to prevent creating more sessions while destroying.
|