fix(carrier): C-03 — decouple manifest re-encryption with dirty tracking and unmount flush
This commit is contained in:
+28
-6
@@ -752,13 +752,24 @@ impl Database {
|
||||
}
|
||||
outer_plaintext_0[32..ct_end_0].copy_from_slice(&inner_ct_0);
|
||||
|
||||
let (outer_ct_0, outer_nonce_0, outer_tag_0) =
|
||||
crate::crypto::encrypt_chunk(dek_0, c_id, 0, &outer_plaintext_0, FORMAT_VERSION, 0)?;
|
||||
let (outer_ct_0, outer_nonce_0, outer_tag_0) = crate::crypto::encrypt_chunk(
|
||||
dek_0,
|
||||
c_id,
|
||||
0,
|
||||
&outer_plaintext_0,
|
||||
FORMAT_VERSION,
|
||||
0,
|
||||
)?;
|
||||
|
||||
conn.execute(
|
||||
"INSERT INTO chunks (node_id, chunk_index, generation, nonce, tag, ciphertext)
|
||||
VALUES (?1, 0, 0, ?2, ?3, ?4)",
|
||||
params![c_id, outer_nonce_0.as_slice(), outer_tag_0.as_slice(), outer_ct_0],
|
||||
params![
|
||||
c_id,
|
||||
outer_nonce_0.as_slice(),
|
||||
outer_tag_0.as_slice(),
|
||||
outer_ct_0
|
||||
],
|
||||
)?;
|
||||
|
||||
// 2. Block 1 schreiben (Redundante Zweitkopie, Gen 0, C-02)
|
||||
@@ -778,13 +789,24 @@ impl Database {
|
||||
}
|
||||
outer_plaintext_1[32..ct_end_1].copy_from_slice(&inner_ct_1);
|
||||
|
||||
let (outer_ct_1, outer_nonce_1, outer_tag_1) =
|
||||
crate::crypto::encrypt_chunk(dek_0, c_id, 1, &outer_plaintext_1, FORMAT_VERSION, 0)?;
|
||||
let (outer_ct_1, outer_nonce_1, outer_tag_1) = crate::crypto::encrypt_chunk(
|
||||
dek_0,
|
||||
c_id,
|
||||
1,
|
||||
&outer_plaintext_1,
|
||||
FORMAT_VERSION,
|
||||
0,
|
||||
)?;
|
||||
|
||||
conn.execute(
|
||||
"INSERT INTO chunks (node_id, chunk_index, generation, nonce, tag, ciphertext)
|
||||
VALUES (?1, 1, 0, ?2, ?3, ?4)",
|
||||
params![c_id, outer_nonce_1.as_slice(), outer_tag_1.as_slice(), outer_ct_1],
|
||||
params![
|
||||
c_id,
|
||||
outer_nonce_1.as_slice(),
|
||||
outer_tag_1.as_slice(),
|
||||
outer_ct_1
|
||||
],
|
||||
)?;
|
||||
|
||||
// Blöcke 2..total_blocks-1 mit DEK_0 vorallokieren (C-02)
|
||||
|
||||
Reference in New Issue
Block a user