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_
key_ from_ untrusted_ params - Derives a key from KDF parameters read out of an untrusted file header.
- validate_
untrusted_ kdf_ params - Validates KDF parameters taken from an untrusted file header.
- 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.