Expand description
Shared guards for key derivation from untrusted inputs. Guards for Argon2 parameters read from untrusted file headers.
Every code path that derives a key from header-supplied parameters (decryption and listing alike) must validate them here first, so a crafted .shadow file cannot request an enormous allocation or an excessive amount of CPU time.
Constants§
- KDF_
MEMORY_ BUDGET_ KIB - Total Argon2 buffer memory allowed across all concurrent derivations.
- MAX_
KDF_ ITERATIONS - MAX_
KDF_ KEY_ SIZE - MAX_
KDF_ MEMORY_ KIB - Upper bounds for KDF parameters read from untrusted file headers. These prevent a crafted file from causing OOM or excessive CPU use.
- MAX_
KDF_ PARALLELISM
Functions§
- derive_
untrusted_ key - Derives a parsed file’s key from a password, guarding the (untrusted) KDF parameters its header requests.
- validate_
kdf_ request - Validates the KDF parameters a file header requests, against the bounds above. The request is version-agnostic, so every format version passes through the same checks.
- with_
kdf_ memory_ permit - Runs
f(a key derivation) while holding a reservation ofcost_kibagainst the global memory budget, blocking until enough budget is free.