@@ -16,11 +16,13 @@ In general, any HBSH construction can be used to wrap any VFS.
1616The default Adiantum construction uses XChaCha12 for its stream cipher,
1717AES for its block cipher, and NH and Poly1305 for hashing.\
1818Additionally, we use [ Argon2id] ( https://pkg.go.dev/golang.org/x/crypto/argon2#hdr-Argon2id )
19- to derive 256-bit keys from plain text.
19+ to derive 256-bit keys from plain text where needed.
20+ File contents are encrypted in 4K blocks, matching the
21+ [ default] ( https://sqlite.org/pgszchng2016.html ) SQLite page size.
2022
2123The VFS encrypts all files _ except_
2224[ super journals] ( https://sqlite.org/tempfiles.html#super_journal_files ) :
23- they _ never_ contain database data, only filenames,
25+ these _ never_ contain database data, only filenames,
2426and padding them to the block size is problematic.
2527Temporary files _ are_ encrypted with ** random** keys,
2628as they _ may_ contain database data.
@@ -30,15 +32,33 @@ keep them in memory:
3032 PRAGMA temp_store = memory;
3133
3234> [ !IMPORTANT]
33- > Adiantum is typically used for disk encryption.
35+ > Adiantum is a cipher composition for disk encryption.
3436> The standard threat model for disk encryption considers an adversary
3537> that can read multiple snapshots of a disk.
36- > The only security property that disk encryption (and this package)
37- > provides is that all information such an adversary can obtain
38- > is whether the data in a sector has (or has not) changed over time.
38+ > The only security property that disk encryption provides
39+ > is that all information such an adversary can obtain
40+ > is whether the data in a sector has or has not changed over time.
41+
42+ The encryption offered by this package is fully deterministic.
43+
44+ This means that an adversary who can get ahold of multiple snapshots
45+ (e.g. backups) of a database file can learn precisely:
46+ which blocks changed, which ones didn't, which got reverted.
47+
48+ This is slightly weaker than other forms of SQLite encryption
49+ that include * some* nondeterminism; with limited nondeterminism,
50+ an adversary can't distinguish between
51+ blocks that actually changed, and blocks that got reverted.
3952
4053> [ !CAUTION]
41- > This package does not claim protect databases against forgery.
42- > Any encryption scheme that allows constant-time block updates
43- > can't prevent individual blocks from being reverted to former versions of themselves,
44- > so block-level authentication is of limited value.
54+ > This package does not claim protect databases against tampering or forgery.
55+
56+ The major practical consequence of the above point is that,
57+ if you're keeping ` "adiantum" ` encrypted backups of your database,
58+ and want to protect against forgery, you should sign your backups,
59+ and verify signatures before restoring them.
60+
61+ This is slightly weaker than other forms of SQLite encryption
62+ that include block-level [ MACs] ( https://en.wikipedia.org/wiki/Message_authentication_code ) .
63+ Block-level MACs can protect against forging individual blocks,
64+ but can't prevent them from being reverted to former versions of themselves.
0 commit comments