Skip to content

Commit

Permalink
Merge pull request #216 from ANSSI-FR/code-maintenance
Browse files Browse the repository at this point in the history
Code maintenance
  • Loading branch information
commial authored Aug 1, 2024
2 parents 951e0aa + 8c0d9ad commit ed4cba4
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
3 changes: 3 additions & 0 deletions mla-fuzz-afl/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ bincode = "~1.3"
serde = { version = "1", features = ["derive"] }
curve25519-parser = { path = "../curve25519-parser" }
mla = { path = "../mla" }

[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(fuzzing)'] }
20 changes: 11 additions & 9 deletions mla/src/layers/compress.rs
Original file line number Diff line number Diff line change
Expand Up @@ -505,23 +505,25 @@ enum CompressionLayerWriterState<W: Write> {
///
/// Compression is made of nested independent compressed block of a fixed
/// uncompressed size
///
/// Pro:
/// * no need to store the compressed size
/// * compression can be streamed (storing the compressed size before the
/// compressed block leads to either seekable stream, which is not an option
/// here, or full-memory compression before actual write, which add limits to
/// the memory footprint)
/// compressed block leads to either seekable stream, which is not an option
/// here, or full-memory compression before actual write, which add limits to
/// the memory footprint)
///
/// Cons:
/// * if the index is lost, a slow decompression with a block size of 1 is
/// needed to found the CompressedBlock boundaries
/// needed to found the CompressedBlock boundaries
pub struct CompressionLayerWriter<'a, W: 'a + InnerWriterTrait> {
state: CompressionLayerWriterState<InnerWriterType<'a, W>>,
// Ordered list of compressed size of block of `UNCOMPRESSED_DATA_SIZE`
// bytes
/// Ordered list of compressed size of block of `UNCOMPRESSED_DATA_SIZE`
/// bytes
//
// Thus, accessing the `n`th byte in the sublayer, is accessing the `n %
// C`th uncompressed byte in the chunk beginning at `sum(compressed_sizes[:n
// / C])`, with `C = UNCOMPRESSED_DATA_SIZE`
/// Thus, accessing the `n`th byte in the sublayer, is accessing the `n %
/// C`th uncompressed byte in the chunk beginning at `sum(compressed_sizes[:n
/// / C])`, with `C = UNCOMPRESSED_DATA_SIZE`
compressed_sizes: Vec<u32>,
// From config
compression_level: u32,
Expand Down
6 changes: 2 additions & 4 deletions mla/src/layers/encrypt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,8 @@ const CHUNK_SIZE: u64 = 128 * 1024;
///
/// AesGcm expect a 96 bits nonce.
/// The nonce build as:
/// {
/// - 8 byte nonce, unique per archive
/// - 4 byte counter, unique per chunk and incremental
/// }
/// 1. 8 byte nonce, unique per archive
/// 2. 4 byte counter, unique per chunk and incremental
///
/// Inspired from the construction in TLS or STREAM from "Online
/// Authenticated-Encryption and its Nonce-Reuse Misuse-Resistance"
Expand Down

0 comments on commit ed4cba4

Please sign in to comment.