summaryrefslogtreecommitdiffstats
path: root/openpgp
AgeCommit message (Collapse)Author
2021-12-13openpgp: Ensure rand:0.7 for rust-crypto.Nora Widdecke
- ed25519-dalek requires rand:0.7 types, so make sure they are used, and not the ones form rand:0.8.
2021-12-13ipc, openpgp: Bump quickcheck to 1.0.3.Nora Widdecke
- Adapt to the new API: - Gen is now a struct, not a Trait, and replaces StdThreadGen. - The rand re-export has been removed. As a consequence, we need our own function to generate an arbitrary value from a range.
2021-12-13openpgp: Fix duration_round_up test.Nora Widdecke
- If the round_up clampes the value to u32::MAX, the precision does not apply. - Closes #784.
2021-12-03openpgp: Derive Default.Nora Widdecke
- Replace manual implementations of Default where the derive(Default) is identical. - Suggested by clippy, https://rust-lang.github.io/rust-clippy/master/index.html#derivable_impl
2021-12-03openpgp: Use unused-must-use.Nora Widdecke
2021-12-02openpgp: Use unused-must-use.Nora Widdecke
- Rustc 1.57.0 complains that the returned Protected value is never used. let _ = Protected::from(Sy); Does the trick while keeping the original intention.
2021-11-29openpgp: Remove unnecessary factors.Nora Widdecke
- Clippy lint: clippy::identity_op.
2021-11-29openpgp: Lint clippy::into_iter_on_ref.Nora Widdecke
2021-11-29openpgp: Statics have a 'static lifetime.Nora Widdecke
- Found with clippy::redundant_static_lifetimes.
2021-11-29openpgp: Use next() instead of nth(0).Nora Widdecke
- Found with clippy::iter_nth_zero.
2021-11-29openpgp: Clearly return the Error.Nora Widdecke
- It's clearer to cast the error with .into() insead of ?. - Found by clippy::try_err.
2021-11-29Remove needless borrows.Nora Widdecke
- Found by clippy::needless_borrow.
2021-11-29Allow many single character names.Nora Widdecke
- The RSA parameters have single character names, this is fine. - Clippy lint: clippy::many_single_char_names.
2021-11-29Remove unnecessary conversions.Nora Widdecke
- Found with clippy::useless_conversion.
2021-11-29openpgp: Fix byte grouping.Nora Widdecke
- A non-standard byte-grouping can be quite confusing. - Found with the help of https://rust-lang.github.io/rust-clippy/master/index.html#unusual_byte_groupings
2021-11-29openpgp: Simplify print statement.Nora Widdecke
- Found by clippy::print_literal.
2021-11-29Use std::mem::take instead of std::mem::replace, for clarity.Nora Widdecke
- Replace let bar = std::mem::replace(&foo, Default::Default()); with let bar = std::mem::take(&foo); The new version seems a little clearer. - Found by clippy: https://rust-lang.github.io/rust-clippy/master/index.html#mem_replace_with_default
2021-11-29openpgp, sq: Drop unneeded clone on a Copy value.Nora Widdecke
- Found by clippy::clone_on_copy lint.
2021-11-29Drop unnecessary lifetime annotations.Nora Widdecke
- Continuation of e6a335b93a10620bcb7cbfa32e232949758f0c99.
2021-11-29Prefer vec! macro.Nora Widdecke
- The vec![] macro is more performant and often easier to read than multiple push calls. - Allow push to a Vec straight after creation in tests. Performance is not that great of an issue in tests, and the fix would impact legibility. - Found by clippy::vec_init_then_push.
2021-11-29openpgp: Use functional update syntax.Nora Widdecke
- Instead of creating a default struct and immediately afterwards changing a field, use this type of initialization syntax: Struct { field: value, ..Default::default() }. - Suggested by clippy::field_reassign_with_default.
2021-11-29Remove unnecessary slicing.Nora Widdecke
- Found by clippy::redundant_slicing.
2021-11-29openpgp: Apply clippy::manual_map.Nora Widdecke
- Improve clarity by replacing match Some(0) { Some(x) => Some(x + 1), None => None, }; with Some(0).map(|x| x + 1);
2021-11-29Use range syntax.Nora Widdecke
- Use range syntac instad of manual comparisons. This is arguably better to read. - Found by clippy::manual_range_contains.
2021-11-29Fix Acronym spelling.Nora Widdecke
- In CamelCase, acronyms count as one word. Apply this rule where API and lalrpop are not impacted. - Found by clippy::upper_case_acronyms.
2021-11-29Simplify filter_mapNora Widdecke
- Replace .filter_map(|x| x) with .flatten(), which is easier to read. - Found with clippy: filter_map_identity.
2021-11-29Remove unnecessary borrows.Nora Widdecke
- Fixed with the help of clippy::needless_borrow.
2021-11-29openpgp: Allow *Bundle enum variant names.Nora Widdecke
- It's confusing that the variants of a Component are all Bundles, however there are Components, Bundles and ComponentBundles in the codebase, so the confusion stems from elsewhere. - Found with clippy::enum_variant_names.
2021-11-29openpgp: State MSRV in Cargo.toml.Nora Widdecke
2021-11-29Move MSRV to 1.56.1Nora Widdecke
- Rust 1.56.0 is affected by CVE-2021-42574, which is addressed in 1.56.1.
2021-11-26opnepgp: Fix typo.Nora Widdecke
2021-11-25openpgp: Remove unnecessary references.Nora Widdecke
2021-11-23openpgp: Implement From instead of Into.Nora Widdecke
2021-11-21a missed negation flips the meaning of the documentation for ↵Alexander Kjäll
KeyHandle::is_invalid
2021-11-18openpgp: Hint at WASM support in the README.md.Justus Winter
- Fixes #570.
2021-11-18openpgp: Enable feature wasm-bindgen for rand.Justus Winter
- This is used by the Rust Crypto crates.
2021-11-18openpgp: Enable js feature for getrandom.Justus Winter
2021-11-18openpgp: Use a WASM-friendly SystemTime::now wrapper.Justus Winter
- Fixes #769.
2021-11-16openpgp: Release 1.6.0.openpgp/v1.6.0Justus Winter
2021-11-09openpgp: Fix documentation, add missing KeyFlags::clear_group_key.Justus Winter
2021-11-05openpgp: Implement CRC24 using a precomputed table.Justus Winter
- With this patch, Sequoia's armor encoding and decoding performance roughly matches GnuPG's. - Fixes #772.
2021-11-05openpgp: Move CRC computation to its own module.Justus Winter
2021-11-05openpgp: Change armor encoder to work on larger chunks.Justus Winter
2021-11-05openpgp: Improve performance of symmetric::Encryptor.Justus Winter
- Instead of encrypting and emitting ciphertext block-wise, encrypt all whole blocks at once and emit the resulting ciphertext. This saves invocations of the cipher (which may traverse language boundaries), and reduces the overhead later in the writer stack by writing larger chunks.
2021-11-04openpgp: Use XXH3 to hash packet bodies.Justus Winter
- When we stream packet bodies, we hash their contents so that we can compare them later on, even if we no longer have the data. Previously, we used the fasted hash from the SHA2 family, either SHA256 or SHA512 depending on the architecture. - That, however, turned out to be a major performance problem. When decrypting a non-compressed, binary file on amd64, we spent roughly a third of the time just to compute the hash. - Using the non-cryptographic hash function XXH3, we can greatly improve the performance. On my system, it is 30x as fast as SHA3, and reduces the overhead of computing the body hash considerably: % time ./sq-sha512 decrypt --recipient-key juliet.key.pgp 3g-for-juliet.binary.pgp >/dev/null 2>&1 13.931 total % time ./sq-xxh3 decrypt --recipient-key juliet.key.pgp 3g-for-juliet.binary.pgp >/dev/null 2>&1 9.264 total - See #771.
2021-11-04openpgp: Improve the streaming Decryptor's buffer strategy.Justus Winter
- Previously, for a read of X bytes, we'd request X + buffer_size from the underlying buffered reader, then satisfy the read request, after which we'd request the next X + buffer_size bytes for the next read. This requires the underlying reader to copy buffer_size bytes for each read. In a typical scenario, we'd copy 25 megabytes (the default buffer size) for every 8 kilobytes read (std::io::copy's default buffer size). This incurs a linear cost with a very high factor. - Improve this by requesting 2 * buffer_size, then satisfying the reads from the first half of that buffer, only consuming the first half once we have exhausted the first half. Then, we'd request the next 2 * buffer_size, at which point the underlying buffered reader has to copy the data to a new buffer. - See #771.
2021-11-04openpgp: Improve tracing.Justus Winter
2021-11-04openpgp: Don't try to fill the buffer if we reached the end.Justus Winter
- Previously, when the read exceeded the buffered data, we tried to fill the buffer even if we reached the last chunk. Then, we would allocate a new buffer and copy the data over, only to later realize that we reached the last chunk and the current chunk is exhausted.
2021-11-03openpgp: Try to get back on the happy path.Justus Winter
- If the opportunity arises, i.e. we have a buffer but previous reads exhausted it, we can drop the buffer and serve the requests from the next buffered reader without copying them first.
2021-11-03openpgp: Recycle buffers.Justus Winter
- Previously, we spent a considerable amount of time callocing new buffers.