1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-07 17:17:44 +03:00
systemd-stable/src/cryptenroll
Lennart Poettering 319a4f4bc4 alloc-util: simplify GREEDY_REALLOC() logic by relying on malloc_usable_size()
We recently started making more use of malloc_usable_size() and rely on
it (see the string_erase() story). Given that we don't really support
sytems where malloc_usable_size() cannot be trusted beyond statistics
anyway, let's go fully in and rework GREEDY_REALLOC() on top of it:
instead of passing around and maintaining the currenly allocated size
everywhere, let's just derive it automatically from
malloc_usable_size().

I am mostly after this for the simplicity this brings. It also brings
minor efficiency improvements I guess, but things become so much nicer
to look at if we can avoid these allocation size variables everywhere.

Note that the malloc_usable_size() man page says relying on it wasn't
"good programming practice", but I think it does this for reasons that
don't apply here: the greedy realloc logic specifically doesn't rely on
the returned extra size, beyond the fact that it is equal or larger than
what was requested.

(This commit was supposed to be a quick patch btw, but apparently we use
the greedy realloc stuff quite a bit across the codebase, so this ends
up touching *a*lot* of code.)
2021-05-19 16:42:37 +02:00
..
cryptenroll-fido2.c FIDO2: ask and record whether user verification was used to lock the volume 2021-05-07 21:36:27 +01:00
cryptenroll-fido2.h FIDO2: support pin-less LUKS enroll/unlock 2021-05-07 21:36:27 +01:00
cryptenroll-list.c alloc-util: simplify GREEDY_REALLOC() logic by relying on malloc_usable_size() 2021-05-19 16:42:37 +02:00
cryptenroll-list.h cryptenroll: support listing and wiping tokens 2020-12-17 20:01:52 +01:00
cryptenroll-password.c ask-password: when querying for a password, try to read from credential store first 2021-03-26 12:21:56 +01:00
cryptenroll-password.h cryptenroll: add new "systemd-cryptenroll" tool for enrolling FIDO2+PKCS#11 security tokens 2020-12-17 20:00:51 +01:00
cryptenroll-pkcs11.c cryptenroll: add new "systemd-cryptenroll" tool for enrolling FIDO2+PKCS#11 security tokens 2020-12-17 20:00:51 +01:00
cryptenroll-pkcs11.h cryptenroll: add new "systemd-cryptenroll" tool for enrolling FIDO2+PKCS#11 security tokens 2020-12-17 20:00:51 +01:00
cryptenroll-recovery.c cryptenroll: add new "systemd-cryptenroll" tool for enrolling FIDO2+PKCS#11 security tokens 2020-12-17 20:00:51 +01:00
cryptenroll-recovery.h cryptenroll: add new "systemd-cryptenroll" tool for enrolling FIDO2+PKCS#11 security tokens 2020-12-17 20:00:51 +01:00
cryptenroll-tpm2.c tree-wide: use UINT64_MAX or friends 2021-03-05 07:10:13 +09:00
cryptenroll-tpm2.h cryptenroll: add support for TPM2 enrolling 2020-12-17 20:01:31 +01:00
cryptenroll-wipe.c cryptsetup: use crypt_token_max if available 2021-01-05 12:16:07 +00:00
cryptenroll-wipe.h cryptenroll: support listing and wiping tokens 2020-12-17 20:01:52 +01:00
cryptenroll.c FIDO2: ask and record whether user verification was used to lock the volume 2021-05-07 21:36:27 +01:00
cryptenroll.h tree-wide: use -EINVAL for enum invalid values 2021-02-10 14:46:59 +01:00
meson.build meson: move source file list for systemd-cryptenroll 2021-01-19 07:06:32 +09:00