summaryrefslogtreecommitdiffstats
path: root/ffi/src/core.rs
AgeCommit message (Collapse)Author
2021-12-10Remove the ffi crates.Justus Winter
- Remove the general-purpose ffi crates. They will be moved into their own repository. Note that we consider general-purpose ffi crates to be a dead end: exposing Sequoia's interface requires a large number of types and functions, and using the interface from C turned out to be verbose and error-prone. Instead, we prefer to write point solutions in Rust that implement exactly the functionality the downstream consumer needs, then expose this via ffi bindings. - See https://gitlab.com/sequoia-pgp/sequoia-ffi.
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-09-30Avoid naming field setting it from variable of the same nameLars Wirzenius
When creating a struct with a field foo, using a variable also named foo, it's not necessary to name the field explicitly. Thus, instead of: Self { foo: foo } use this: Self { foo } The shorter form is more idiomatic and thus less confusing to experienced Rust programmers. This was found by the clippy lint redundant_field_names: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_field_names Sponsored-by: author
2021-08-26ipc: Move the types from the core module to the top-level.Justus Winter
2021-04-09Lint: Remove redundant closures.Nora Widdecke
- https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure
2021-03-31ipc: Incorporate sequoia-core crate as a core module.Wiktor Kwapisiewicz
- This moves all functionality from sequoia_core crate as an inner `core` module of the ipc crate. - The `core` module has to be public as other crates depend on `core::Context` either directly (store, ffi) or indirectly (store through ffi crate). - Remove the `core` crate completely.
2021-03-03ffi: Fix memory leak.Nora Widdecke
- When dropping the Context, free the error pointer, too. - Add test that would have allowed valgrind to find the issue. - Fixes #671
2021-01-15net: Decouple from core.Justus Winter
- Move core::NetworkPolicy to net::Policy, update all code accordingly.
2020-10-14Use 'Examples' for the examples section.Justus Winter
- See #480.
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-06-26openpgp-ffi, ffi, ffi-macros: Avoid deprecated integer types.Justus Winter
2019-05-15core, store, tool: Use realm instead of domain.Justus Winter
- Remove the domain parameter from core::Context. - Replace it with a realm to be passed in when opening a store. - For sq, merge store name and realm into the --store parameter. - Fixes #105.
2019-05-07openpgp-ffi, ffi: Fix calling convention on Windows.Justus Winter
- Use `extern "C"` instead of `extern "system"`. The latter selects stdcall, which is only appropriate for talking to the Windows API.
2019-03-22openpgp, core: Return old value in setters.Justus Winter
- Fixes #147.
2019-01-29openpgp-ffi: Convert Error.Justus Winter
2019-01-17openpgp-ffi: New crate.Justus Winter
- This creates a new crate, 'sequoia-openpgp-ffi', and moves a handful of functions from 'sequoia-ffi' to it. - The 'sequoia-ffi' crate is a superset of the 'sequoia-openpgp-ffi' crate. This is accomplished by some include! magic. - My first attempt involved having 'sequoia-ffi' depend on 'sequoia-openpgp-ffi', so that the former just re-exports the symbols. However, that turned out to be unreliable, and might be not what we want, because it could also duplicate parts of Rust's standard library. - Fixes #144.
2019-01-17ffi: Do not use a context where an errp suffices.Justus Winter
- This prepares us for the FFI crate split. - Fixes #158.
2019-01-16ffi: Use the new set of macros.Justus Winter
- First, for the two existing functions with an error-pointer.
2019-01-16ffi: Add new error-pointer-based error handling.Justus Winter
- Express existing context-based error handling using the new set of macros.
2019-01-16ffi: Store raw pointers to errors in the Context.Justus Winter
2019-01-16ffi: Introduce setter for the error in the Context.Justus Winter
2019-01-16ffi: Rework complex error handling macros.Justus Winter
- Introduce a macro that emits local macros that implicitly use the given context to store complex errors. - This prepares us to decouple error handling from contexts, at least for the functions that otherwise do not use the context.
2019-01-16ffi: Wrap every function using ffi_catch_abort.Justus Winter
- This prevents stack unwinding across the FFI boundary. - Fixes #161.
2019-01-15ffi: Allocate returned strings using libc.Justus Winter
- Allocate all returned strings using libc's allocator. This has the advantage that the user can easily use strings and free them using free(3). - Fixes #157.
2019-01-15ffi: Introduce macro for *char parameters.Justus Winter
2019-01-10ffi: Fix memory leaks in C tests.Justus Winter
2019-01-09ffi: Use Option<&mut T> for destructors.Justus Winter
- This reflects the fact that destructors may be called with NULL.
2019-01-09ffi: Use *const T for non-optional arguments.Justus Winter
- Previously, Option<&T> was used, primarily because it was more ergonomic in Rust. However, this gave the impression that the argument was optional. - Likewise for mutable references. - This patch addresses all pointers to Rust values. - See #149.
2019-01-09ffi: Use ffi_param_ref_mut for mutable arguments.Justus Winter
2019-01-09ffi: Fix conversion to ffi_param_ref.Justus Winter
2019-01-09ffi: Introduce macro for moving ownership from C.Justus Winter
2019-01-09ffi: Introduce macro for passing references from C.Justus Winter
2019-01-08ffi: Add and use ffi_free!.Justus Winter
2018-07-26ffi: Improve c doctests.Justus Winter
- Wrap code in a main function if none exists. - Derive names for tests not bound to a function. - Honor no-run and ignore. - Fix all examples that are now tests.
2018-07-26ffi: Enable syntax-highlighting for all c snippets.Justus Winter
2018-07-20ffi: Add a new allocating writer.Justus Winter
2018-07-20ffi: Fix documentation.Justus Winter
2018-03-15ffi: Improve error reporting when creating contexts.Justus Winter
- Usually, we report complex errors by attaching them to the ffi context. However, when we create the contexts, there is no context to attach the error to. Therefore, we add an explicit error argument here.
2018-03-15ffi: Improve error reporting.Justus Winter
- Add a status code representing errors. - Hand out errors as opaque objects. These objects can then be queried for the numeric status code, and a string representation.
2018-03-01ffi: Avoid boxing the error.Justus Winter
- There is no need to box failure::Error, which is in fact a struct and not a trait.
2018-02-28ffi: Create glue for readers and writers.Justus Winter
- Add support for generic readers (i.e. implementations of std::io::Read) and writers. - Implemented constructors allow creating both readers and writers by opening a file, using an existing file descriptor, or by backing it with a provided buffer.
2018-02-28ffi: Make freeing a NULL context a nop.Justus Winter
2018-02-26ffi: Use enums for network and IPC policy.Justus Winter
- Also add the missing prototypes for getting and setting the IPC policy.
2018-02-14ffi: Do not try to compile C example.Justus Winter
2018-02-14ffi: Split into several modules.Justus Winter
- Organize the ffi module the way Sequoia is organized. - Add more examples.