summaryrefslogtreecommitdiffstats
path: root/openpgp/src/crypto/aead.rs
AgeCommit message (Collapse)Author
2023-03-02openpgp: Combine ciphertext and tag in Aead::decrypt_verify.Justus Winter
- It is easier (and cheaper) to tear apart in backends that need ciphertext and tag to be separate than to combine it for backends that expect the tag to be appended to the ciphertext. - The caller doesn't have to do anything, because in OpenPGP on the wire the tag is already appended to the ciphertext. The one exception is our current implementation of SKESKv5, but in our upcoming SKESKv6 implementation, we store the tag appended to the ciphertext, so it will be easy to use this interface there.
2023-02-28openpgp: Further simplify AEAD abstraction.Justus Winter
- Hand in the additional authenticated data when constructing the context.
2023-02-27openpgp: Rework the AEAD abstraction.Justus Winter
- Combine `encrypt` and `tag` to `encrypt_seal` similarly to we previously combined `decrypt_verify`. This better matches AEAD constructions, and the original interface was mostly informed by Nettle's relatively low-level interface.
2022-12-21openpgp: Check for supported AEAD ciphersuite in tests.Wiktor Kwapisiewicz
- Previously the AEAD roundtrip test checked supported symmetric ciphers and AEAD algorithms separately but only certain combinations of them are valid in some libraries. - See: https://openpgp-wg.gitlab.io/rfc4880bis/#name-preferred-aead-ciphersuites
2022-12-21openpgp: Make AEAD interface functions fallible.Wiktor Kwapisiewicz
- Some backends may want to propagate their internal errors to the caller. - Modify all functions to return Results and their clients to either propagate the error or handle it.
2022-12-21openpgp: Change `decrypt` into `decrypt_verify`.Wiktor Kwapisiewicz
- Some backends want to verify the AEAD block by themselves and need the tag to be passed in. - Change two step `decrypt` + `digest` into a one step `decrypt_verify`. - Old backends are modified to work like they did previously by utilizing decryption and the digest operation. - New backends can implement `decrypt_verify` using their respective cryptographic primitives.
2022-05-12openpgp: Deprecate `iv_size` in favor of `nonce_size`.Wiktor Kwapisiewicz
- See #812.
2022-05-12openpgp: Rename `iv_size` to `nonce_size` leaving `iv_size`.Wiktor Kwapisiewicz
- Rename `iv_size` to `nonce_size`. - Introduce `iv_size` that forwards to `nonce_size` for compatibility reasons. - Change all calls to `iv_size` to `nonce_size`.
2022-03-11openpgp: Delay creating the AEAD context until it is needed.Justus Winter
- We don't always actually need it, so it is nice to defer creating it until we do.
2022-02-14openpgp: Refactor AEAD encryption and decryption.Justus Winter
- Introduce a trait that schedules nonce and additional authenticated data for each AEAD chunk. - Factoring that out allows us to support different schemes, and decouple memory encryption from the OpenPGP schedules.
2022-01-20openpgp: Avoid unsafe, undefined behavior.Justus Winter
- Now that the chunk size is capped, just initialize the scratch vector.
2022-01-10openpgp: Remove redundant cipher op parameter.Justus Winter
- The decryptor only decrypts, the encryptor only encrypts. No need to have that parameter (in fact, having the parameter presents the opportunity to get it wrong, see the previous commit).
2022-01-10openpgp: Fix typo.Justus Winter
- This only went unnoticed because we only hash and write the digest, and don't invoke the encrypt method (which would have panic'ed). No functional change.
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-03openpgp: Avoid wrapping the reader again.Justus Winter
2021-10-05openpgp: Add a RustCrypto backend.Nikhil Benesch
- This adds a cryptographic backend based on the RustCrypto crates. The backend is marked as experimental, as the RustCrypto crates' authors state that they have not been audited and may not perform computations in constant time. Nevertheless, it may be useful in certain environments, e.g. WebAssembly. - The backend implements RSA, EdDSA and ECDH over Curve25519, IDEA, 3DES, CAST5, Blowfish, AES, Twofish, EAX, MD5, SHA1, RipeMD160, and the SHA2 family. - Notably missing are DSA, ElGamal, and ECDSA and ECDH over the NIST curves. - See #333.
2021-09-28openpgp: Add comment, also test OCB.Justus Winter
2021-09-15openpgp: Avoid creating unused borrows.Justus Winter
2021-09-08openpgp: Constrain AEAD chunk sizes.Justus Winter
- Make sure that chunk sizes are between 64B and 4MiB. - Fixes a DoS resulting from unconstrained, attacker-controlled heap allocations. - Fixes #738.
2021-04-09Lint: Do not .clone a Copy type.Nora Widdecke
- https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy
2021-04-09Lint: Use is_empty().Nora Widdecke
- https://rust-lang.github.io/rust-clippy/master/index.html#len_zero - https://rust-lang.github.io/rust-clippy/master/index.html#comparison_to_empty
2021-04-09Lint: Remove redundant returns.Nora Widdecke
- https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
2020-12-10openpgp: Add remaining assert_send_and_sync! calls.Azul
- See #615.
2020-12-10buffered-reader: Require Cookies to be Send and Sync.Azul
- This way the entire `BufferedReader<C>` will be `Send` and `Sync`. - Modify all other crates accordingly. - See #615.
2020-12-08openpgp: Tweak the assert_send_and_sync macro.Justus Winter
- Declare trait bounds using a where clause. It looks a bit odd if there is no bound, but not worse than before.
2020-12-08openpgp: Use parens for assert_send_and_sync!.Azul
2020-12-08openpgp: Allow generic types in assert_send_and_sync!.Azul
- Use generics and the anonmymous lifetime in `assert_send_and_sync!`. - See 627.
2020-12-08openpgp: Ensure public types are Send and Sync.Azul
- See #627.
2020-12-04openpgp: Use pure Rust EAX implementation under CNG backendIgor Matuszewski
- Fixes #556.
2020-11-24openpgp: seal Aead trait.Azul
- Seal the Aead trait so it cannot be implemented outside the openpgp crate. - This way we can extend the trait without breaking the API compatibility. - See #538.
2020-10-19buffered-reader: Make Generic::reader private and add accessors.Justus Winter
2020-09-09openpgp: Explicitly annotate chunk_index type in aead.rsIgor Matuszewski
2020-09-09openpgp: Don't perform no-op en/decryption in AEADIgor Matuszewski
2020-09-09openpgp: Get rid of some write_be_u64 callsIgor Matuszewski
2020-08-13openpgp: Adjust for SymmetricAlgorithm support diff. across backendsIgor Matuszewski
2020-06-22openpgp: Move Nettle AEAD implementation to the backend moduleIgor Matuszewski
2020-05-28openpgp: Use u64 for AEAD chunk sizes.Justus Winter
- Use u64 in packet::aed::AED1 and the API. - Add explicit overflow checks when using chunk sizes as offsets.
2020-04-09openpgp: Limit publicly exposed Nettle APIIgor Matuszewski
2020-03-26Remove redundant field names.Wiktor Kwapisiewicz
2020-03-09Switch from failure to anyhow.Justus Winter
- Use the anyhow crate instead of failure to implement the dynamic side of our error handling. anyhow::Error derefs to dyn std::error::Error, allowing better interoperability with other stdlib-based error handling libraries. - Fixes #444.
2020-01-29buffered-reader: Use the new as_boxed method.Justus Winter
- This cleanly avoids creating a linked list of references on the stack that grows every time we call into_inner.
2020-01-24openpgp: Optimize drop(Vec<u8>::drain(..n)) in debug mode.Justus Winter
- Similar to Vec<u8>::truncate(_), this operation is very slow in debug mode due to the dropping of drained elements. Provide an optimized version in debug mode.
2019-12-06openpgp: Add a compile-time flag to disable authentication checks.Justus Winter
2019-12-03openpgp: Move byte order conversion functions.Justus Winter
2019-12-03openpgp: Rename openpgp::conversions to openpgp::fmt.Justus Winter
2019-11-25openpgp: Rename openpgp::constants to openpgp::types.Justus Winter
- Fixes #381.
2019-11-18openpgp: Optimize .clear() for byte vectors.Justus Winter
2019-11-15Fix rustc warnings.Leonhard Markert
2019-10-27Fix more spelling errors caught by codespellDaniel Kahn Gillmor
Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2019-10-25openpgp: Enable parsing of AED packets using OCB.Justus Winter
- Parsing the headers of AED packets is not possible without knowing the AEAD algorithm used due to the fact that the length of the IV field is dependent on the AEAD algorithm. - In the case of OCB, the RFC4880bis does not specify an exact length of the IV, but GnuPG hardcodes it to 15.