summaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2019-01-29openpgp-ffi: Convert Error.Justus Winter
2019-01-29openpgp-ffi: Explicitly convert to failure::Error.Justus Winter
2019-01-29openpgp-ffi: Add missing declaration.Justus Winter
2019-01-29openpgp-ffi: Check for missing declarations.Justus Winter
2019-01-29openpgp-ffi: Convert TSK.Justus Winter
2019-01-29openpgp-ffi: Fix TPK handling.Justus Winter
- Fixes 9d6e628d6a183b483bdf115993d0a5a377c3d823.
2019-01-29ffi-macros: Prepare for wrapped references.Justus Winter
- A consequence of using wrapper types in the API is that we can no longer hand out references. For example, with the recently introduced wrapper types, pgp_tsk_tpk no longer works, as it returns bare references. - With this change, we wrap immutable and mutable references to objects. It presents an opportunity for a uniform API (i.e. just always free references you got from us), and for us the ability to track mutability of references.
2019-01-29openpgp-ffi: Build examples below CARGO_TARGET_DIR.Justus Winter
- Addresses #172.
2019-01-29store: Fix documentation.Neal H. Walfield
- In a1eba557ff62f09bef2c7e379a238c643ac240d7, I changed the store to insert all subkeys into the key_to_keyid table. Update the documentation to reflect this change.
2019-01-29openpgp: Add a macro to profile a block of code.Neal H. Walfield
- A macro to make profiling a few bits of code straightforward.
2019-01-29openpgp-ffi: Copy edit documentation.Neal H. Walfield
2019-01-29Execute normal build targets in openpgp-ffi too.Neal H. Walfield
- Any place where we execute a build command for the ffi crate, we should do the same for the openpgp-ffi crate, too.
2019-01-29ffi,openpgp-ffi: Install .pc files in target directory.Neal H. Walfield
- Install the .pc files in the target directory when building so that it is easier to link against built, but uninstalled libraries. - 177835be9dba392ab10994254b67aa676be66331 accidentally removed this functionality for debug builds. Restore it, and also add it for release builds. - Avoid code duplication by using a macro.
2019-01-29openpgp: TPKBuilder::autocrypt should not default to an empty UIDNeal H. Walfield
- TPKBuilder::autocrypt created a TPK with a single User ID, as required by the Autocrypt specification. Since no User ID was passed, it used the empty string. - An empty User ID is a bit surprising, and it is unclear if it is even a reasonable default (GnuPG rejects it). But, even if the programmer is aware of this, adding a new user ID does not replace the empty User ID, and removing the empty User ID is a pain. - Change the API to better match typical usage: have the constructor take the User ID. - Nevertheless, preserve the flexibility by making the User ID optional to allow the caller to add a User ID later. In this case, a non-autocrypt compliant TPK with no User ID is created instead of an empty User ID. - Closes #146.
2019-01-29openpgp: Change TPKBuilder::add_userid to take an Into<Cow>>.Neal H. Walfield
- Change TPKBuilder::add_userid to take an Into<Cow<'a, str>>> instead of a &str.
2019-01-29ffi-macros: Improve assert_tag error message.Neal H. Walfield
- A wrapper object may be deallocated either if the object is freed *or* the object is moved. Change the error message to mention both of these possibilities.
2019-01-28openpgp-ffi: Rust bool -> C bool, not int.Neal H. Walfield
- A Rust boolean maps to a C _Bool, not a C int. - Note: this mapping has recently been formalized. See, for instance, https://github.com/rust-lang/rust/pull/46176 .
2019-01-25python: Only use features found in Debian Stable (Debian 9)Neal H. Walfield
- CDefError is not exposed as cffi.error.CDefError, but as cffi.api.CDefError in python3-cffi 1.9.1-2. This change is forwards compatible with python3-cffi 1.11.5-3 (from Debian Testing). - enum.auto is only available in Python v3.6. Albeit uglier, manually assigning values works in Python v3.5 (and later).
2019-01-25ffi-macros: Protect against use-after-free.Justus Winter
- When we transfer ownership from C to Rust, we move the wrapped object out of the wrapper, and poison the wrapper. - This prevents reuse of the wrapper object. When a stale reference is given to us, we check the tag encoding the type information. - If the tag field is poisoned, we can produce a more helpful error message. This is not exact, of course. As soon as the memory is reused, our tag is overwritten.
2019-01-25ffi-macros: Check wrapper types at runtime.Justus Winter
- This change adds a tag to the derived wrapper types that identify the type of the wrapped value. - At runtime, we can verify that references to wrapper objects indeed carry the right tag. - Fixes #166.
2019-01-25openpgp-ffi: Use wrapper types.Justus Winter
- With the abstractions for moving ownership and references across the FFI boundary, we can now switch to actually using the wrapper types by changing the function signatures to use the wrapper type, and updating the generated functions.
2019-01-25openpgp-ffi: Prepare to use the wrapper types.Justus Winter
2019-01-25openpgp-ffi: Convert TPK.Justus Winter
2019-01-25openpgp-ffi: Convert PacketPile.Justus Winter
2019-01-25openpgp-ffi: Convert Fingerprint.Justus Winter
2019-01-25openpgp-ffi: Convert KeyID.Justus Winter
2019-01-25openpgp-ffi: Derive conversion functions.Justus Winter
- This is a framework for dealing with ownership and references at the FFI boundary. Previously, we used macros to do that. This change introduces a more idiomatic interface, we use traits converting from raw pointers of a wrapper type to objects, references, or mutable references to a wrapped type. - For now, we use the wrapped type as wrapper type. We merely introduce a new mechanism replacing the macro-based one. - This patch also converts all the derived functions. - The following patches will convert all the functions that are already using the ffi_wrapper_type. Once this conversion is done, we can introduce our own wrapper type.
2019-01-25openpgp-ffi: Improve error handling.Justus Winter
- In case of errors, set *tpk_out to None.
2019-01-25openpgp: remove tracing output from ecdh::wrap_session_keyKai Michaelis
2019-01-25Update build instructions in README.Neal H. Walfield
- We need at least version 1.31.0 of rustc. - Prefix commands that require root with sudo.
2019-01-24openpgp: add a way to import X25519 public key materialKai Michaelis
2019-01-24openpgp: split ecdh::wrap_session_keyKai Michaelis
This patch splits off the deterministic stage into it's own function to make it easier to write tests for ECDH keys.
2019-01-24openpgp: fix crash in TPK parser.Kai Michaelis
This fixes a crash in the TPK parser resulting from reaching and unreachable branch. The problem is triggered by an invalid SecretSubkey packet. The packet is parsed as Packet::Unknown(Tag::SecretSubkey,...). The parser then calls pkt.tag() to convert the Packet into a Token. The patch uses a match instead of tag() when converting. Closes #120.
2019-01-24openpgp: allow usage of armored!() in openpgp crateKai Michaelis
2019-01-24openpgp: more verbose error messages for grammar.lalrpopKai Michaelis
2019-01-23openpgp-ffi: Add test.Justus Winter
2019-01-23openpgp-ffi: Paper over the shady parsing in c-tests.Justus Winter
- Fixes tests not being found because the functions signature were formatted differently. In the end, only proper parsing will help here.
2019-01-23Fix making examples.Justus Winter
2019-01-23openpgp-ffi: Remove pgp_tpk_dump.Justus Winter
- This function was used early on to demonstrate the FFI layer. It can now be expressed using pgp_tpk_debug().
2019-01-23openpgp-ffi: Wrap TPK.Justus Winter
2019-01-22openpgp-ffi: Wrap KeyID.Justus Winter
2019-01-22openpgp-ffi: Wrap PacketPile.Justus Winter
2019-01-22openpgp-ffi: Wrap Fingerprint.Justus Winter
2019-01-22ffi-macros: Add ffi_wrapper_type that derives functions.Justus Winter
- Note that the wrapper type is not actually used for now, the functions still operate on the original type. But, this lets us derive functions, and for that we merge it now. - See #166.
2019-01-22openpgp-ffi: Qualify KeyID.Justus Winter
2019-01-22openpgp-ffi: Cleanup paths in macros.Justus Winter
2019-01-22ffi: Drop superfluous dependency on openpgp-ffi.Justus Winter
2019-01-21Distribute highlight.js with our documentation.Justus Winter
- For C code fragments, we use the highlight.js highlighter to apply syntax highlighting. Previously, highlight.js was only used in the FFI documentation, and was loaded from a CDN. - We now distribute highlight.js with our documentation. This is done in the 'doc' make target. - This helps to protect the privacy of users viewing the documentation. - Unfortunately, highlighting no longer works when viewing the documentation locally in a browser using the file:// scheme.
2019-01-21openpgp-ffi: Fix links in the documentation.Justus Winter
2019-01-21openpgp-ffi: Improve module documentation.Justus Winter