~ireas/nitrokey-sys-rs

Merge branch 'release-v3.6.0'
Disable default features for bindgen

The default features for bindgen, e. g. clap, are not required for our
use case, so we disable them with this patch.
Add build script for CI

This patch adds a build script that builds, tests and lints
nitrokey-sys-rs.
Fix formatting for deprecation attributes

This patch fixes the formating of the deprecation attributes added by
the deprecated.diff patch.
Update contribution information in readme
Add the Librem Key model to the unit tests
Add verify-bindings make target

This patch adds the verify-bindings make target that re-generates the
bindings using bindgen and verifies that they do not differ from the
pre-generated bindings in the Git repository.
Add feature to generate bindings during build

This patch adds the bindgen feature to the crate that allows users to
re-generate the bindings, including layout tests, during the build
instead of using the pre-generated bindings.  Per default, this feature
is disabled.
Do not include layout tests in generated bindings

We are generating the Rust bindings in src/ffi.rs using bindgen once for
all platforms on an amd64 machine.  These bindings previously included
layout tests.  But these tests fail on some 32-bit architecture.  See
this discussion for more information:
	https://lists.sr.ht/~ireas/nitrokey-rs-dev/%3C20200919182408.GA1513%40ireas.org%3E

With this patch, we remove the layout tests from the generated bindings.
Instead, we will add the option to re-generate the bindings, including
the layout tests, during the build in the next patch.
Automatically refresh patches

This patch adds the --refresh option to the quilt push invocation in the
Makefile to automatically update the patches if the context changed.
Update to libnitrokey v3.6

This patch updates libnitrokey from version 3.5 to version 3.6, causing
these changes:

- New constants:
  - `NK_device_model_NK_LIBREM` (`NK_device_model` enum)
- New structures:
  - `NK_config`
- New functions:
  - `NK_device_serial_number_as_u32`
  - `NK_write_config_struct`
  - `NK_free_config`
  - `NK_read_config_struct`
  - `NK_free_password_safe_slot_status`
- Deprecated functions:
  - `NK_set_unencrypted_read_only`
  - `NK_set_unencrypted_read_write`
Implement Display for Version in build.rs

Previously, we implemented the std::string::ToString trait for the
Version enum in build.rs for converting the libnitrokey version number
to a string.  This patch replaces this implementation with an
implementation of the std::fmt::Display trait, which automatically
generates a ToString implementation and is more idiomatic.
e9a06bb9 — Robin Krahl 2 months ago
Derive Default for libnitrokey structs

This patch adds the --with-derive-default option to the bindgen
invocation so that it derives Default implementations for all
libnitrokey structs.  This allows us to simplify code in nitrokey-rs,
for example the initialization of structs that are used in nitrokey-sys
functions with output parameters.
483ec725 — Robin Krahl 2 months ago
Re-generate bindings in src/ffi.rs

Older versions of bindgen rendered C++ doc comments as Rust doc comments
using the /// syntax.  Newer versions use the doc attribute instead.
This patch re-generates the src/ffi.rs file with bindgen 0.55.1 so that
it uses the new format.  This makes it easier to perform changes in the
future.
Remove unnecessary __uint*_t typedefs

While bindgen is able to replace the C uint types with the correct Rust
types, it still generates typedefs for __uint{8,16,32,64}_t [0].  We
don’t need these typedefs, so we add a patch to remove them.

[0] https://github.com/rust-lang/rust-bindgen/issues/1663
2b367a30 — Robin Krahl 2 months ago
Use quilt to manage modifications in src/ffi.rs

Previously, we manually modified the src/ffi.rs file to add deprecation
attributes.  With this patch, we use quilt to automatically apply
patches with the changes.
7394a6b1 — Robin Krahl 2 months ago
Add Makefile for generating src/ffi.rs

This patch adds a Makefile to make it easier to generate the src/ffi.rs
file using bindgen.  As we can use whitelists instead of manually
removing the unnecessary type definitions, we also re-generate the file
with the new settings.
Mark deprecated functions using the deprecated attribute

nitrokey-sys currently contains two deprecated functions: `NK_status`
and `NK_totp_get_time`.  This patch adds Rust’s `deprecated` attribute
to the functions.
Update to libnitrokey v3.5

This patch updates libnitrokey from version 3.4.1 to version 3.5 and
lists all API changes in the changelog.
Next