summaryrefslogtreecommitdiffstats
path: root/openpgp/src/crypto/s2k.rs
AgeCommit message (Collapse)Author
2020-11-12openpgp: Make crypto::Hash::digest fallible.Justus Winter
2020-11-06openpgp: Use non_exhaustive attribute.Nora Widdecke
- Fixes #563 - With an MSRV >= 1.40.0, we can use #[non_exhaustive], as mentioned in #406. - This is also a clippy lint: https://rust-lang.github.io/rust-clippy/master/index.html#manual_non_exhaustive
2020-09-25openpgp: Fix deprecation notices.Nora Widdecke
2020-09-22openpgp: Remove `quickcheck` feature.Wiktor Kwapisiewicz
- Adjust code to test for `cfg(test)` only, - Remove `quickcheck` and `rand` from dependencies so that they stay only in dev-dependencies, - Remove mention of `x-quickcheck` feature from the documentation, - Fixes #545.
2020-08-20openpgp: Add optional parameters to unknown S2K variants.Justus Winter
- This mirrors how we handle other unknown variants. However, since we do not know the length of the parameters for unknown S2K variants, we cannot parse them back. To work around that, the parameter field is optional, and will be `None` when an unknown S2K is parsed. The data is not lost, but stored in the packet containing the S2K object, so that we can serialize it again. - Carefully preserve the invariant that we can parse any packet we can serialize by comparing the serialized form of the packet fragments containing the S2K and any fields the parameters of unknown variants bleed into on parsing. - Unfortunately, this means that S2K on its own no longer roundtrips. Remove that test accordingly.
2020-08-20openpgp: Drop implementation of Copy for S2K.Justus Winter
2020-08-20openpgp: New function S2K::is_supported.Justus Winter
2020-08-13openpgp: Adjust for SymmetricAlgorithm support diff. across backendsIgor Matuszewski
2020-08-11openpgp: Reorder S2K's variants from most to least preferable.Justus Winter
- See #474.
2020-08-11openpgp: Improve S2K's documentation.Justus Winter
- See #474.
2020-08-11openpgp: Make S2K helper methods private.Justus Winter
2020-08-11openpgp: Add a constructor S2K::new_iterated.Justus Winter
- Creating S2K objects is tricky because not every iteration count is representable. Add a constructor that helps with that.
2020-08-11openpgp: Fix S2K::nearest_hash_count.Justus Winter
- Previously, S2K::nearest_hash_count(1025) == 1025, which is not representable. The problem did persist after removing the 1025..=2048 match, therefore there is a problem in the maths. Replace by an less elegant, iterative implementation. Add tests.
2020-08-11openpgp: Improve test.Justus Winter
- Reduce the range of input values to increase the chance of finding errors.
2020-08-11openpgp: Mark S2K as non-exhaustive to allow future extensions.Justus Winter
2020-08-11openpgp: Mark S2K::Simple and S2K::Salted as deprecated.Justus Winter
2020-07-21openpgp: Remove PacketParserResult::is_none.Justus Winter
- There is no variant called `None`, so having this predicate seems wrong. - See #489.
2020-06-08openpgp: Introduce feature flag for quickcheck.Nora Widdecke
- Make quickcheck dependency optional. - Make quickcheck a dev-dependency for tests. - Fix doctests for - cert::ValidCert::user_attributes, - cert::builder::CertBuilder::add_user_attribute, - cert::revoke::UserAttributeRevocationBuilder - cert::revoke::UserAttributeRevocationBuilder::build. Doctests do not use cfg(test), so we cannot use quickcheck in there.
2020-04-16Revert "openpgp: Make PacketParserResult a std::result::Result."Justus Winter
This reverts commit 2e1eec5fe4157a391a13554ff7df3075cfe043cc.
2020-04-09openpgp: Make PacketParserResult a std::result::Result.Justus Winter
- This avoids the partial implementation imitating std::option::Option, replacing it with std::result::Result. - As a benefit, std::result::Result is in the prelude, simplifying a lot of parsing loops.
2020-03-26Remove redundant field names.Wiktor Kwapisiewicz
2020-03-03openpgp: Only impl Serialize for objects that are normally exported.Neal H. Walfield
- Add two new traits: `Marshal` and `MarshalInto`. - Implement them instead of `Serialize` and `SerializeInto`. - Only implement `Serialize` and `SerializeInto` for data structures that are normally exported. - This should prevent users from accidentally serializing a bare signature (`Signature`) when they meant to serialize a signature packet (`Packet`), for instance. - Fixes #368.
2019-12-19openpgp: Prepare to encrypt passwords.Justus Winter
- Remove direct access, provide Password::map instead.
2019-12-03openpgp: Rename openpgp::conversions to openpgp::fmt.Justus Winter
2019-10-27Fix more spelling errors caught by codespellDaniel Kahn Gillmor
Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2019-09-27openpgp: Clean up deprecated range syntaxDaniel Silverstone
The `...` syntax is deprecated in favour of `..=` since 1.26 and is an idiom lint in the 2018 edition. Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2019-07-15Make more variables immutable.Justus Winter
- With the MIR-based borrow-checker being more precise than the AST-based one, we can make more variables immutable.
2019-07-15Prepare for Rust 2018.Justus Winter
- This is the result of running `cargo fix --edition`, with some manual adjustments. - The vast majority of changes merely qualify module paths with 'crate::'. - Two instances of adding an anonymous pattern to a trait's function. - `async` is a keyword in Rust 2018, and hence it needs to be escaped (e.g. in the case of the net::r#async module). - The manual adjustments were needed due to various shortcomings of the analysis employed by `cargo fix`, e.g. unexpanded macros, procedural macros, lalrpop grammars.
2019-07-02openpgp: New function crypto::random.Justus Winter
- Add and use a function that fills a buffer with a thread-local random number generator.
2019-07-02openpgp: Introduce an abstraction for hash contexts.Justus Winter
- See #302.
2019-05-20openpgp: Calibrate S2K's hash bytes count.Justus Winter
- Fix the value to the largest one OpenPGP can represent. On moderate machines, like my Intel(R) Core(TM) i5-2400 CPU @ 3.10GHz, it takes ~354ms to derive a key. - Fixes #192.
2019-05-20openpgp: Rename function, improve documentation.Justus Winter
2019-05-20openpgp: Return the right error, improve documentation.Justus Winter
2019-05-20openpgp: Optimize key derivation.Justus Winter
2019-05-20openpgp: Overwrite password in temporary buffer.Justus Winter
2019-05-20openpgp: Fix special case.Justus Winter
2019-05-20openpgp: Rename field 'iterations' to 'hash_bytes'.Justus Winter
- 'iterations' is really inappropriate, and even needed an explanation in the code.
2019-05-20openpgp: Document the choice of default hash algorithm.Justus Winter
2019-05-14openpgp: Add a filesystem-like framework for test data.Justus Winter
- Fixes #267.
2019-02-18openpgp: New traits SerializeInto and SerializeKeyInto.Justus Winter
- Eventually, we will provide a no_std variant of this crate. - Fixes #185.
2019-02-13openpgp: use nettle 4.0Kai Michaelis
2018-12-14openpgp: Introduce trait Parse.Justus Winter
- Trait Parse introduces a uniform interface to parse packets, messages, keys, and related data structures.
2018-10-23openpgp: Move SessionKey into openpgp::crypto.Justus Winter
2018-10-23openpgp: Move the Password type to openpgp::crypto.Justus Winter
2018-10-23openpgp: Move S2K to openpgp::crypto.Justus Winter