| Commit message (Collapse) | Author | Age |
|
|
|
|
|
|
| |
Our main function is unsafe as it uses the entry attribute. clippy
requires a Safety section in the doc comment of public unsafe functions,
but as we don’t have any documentation yet, we disable the
clippy::missing_safety_doc lint.
|
|
|
|
|
|
|
|
|
|
|
| |
This patch updates all dependencies to the newest versions (except
static_assertions). It replaces the Git versions of stm32f103xx-usb and
usb-device with crates.io versions of stm32-usbd (via stm32f1xx-hal) and
usb-device.
This bumps the minimum supported Rust version to 1.36.0 (for
stm32-usbd). static_assertions is not updated as it would require an
even newer Rust version.
|
|
|
|
|
|
|
|
|
|
| |
There are different ways to implement the CRC check: For testing, we
might want to calulate the CRC in the software. On STM32 MCUs, we want
to use the CRC peripheral.
This patch splits the struct Crc into the Crc trait and the Stm32Crc
struct implementing Crc using the CRC peripheral. The Nitrokey struct
can now accept any Crc implementation.
|
|
|
|
|
|
|
| |
The data sent with Set_Report requests contains a CRC which we so far
ignored. This patch adds a Crc struct that uses the CRC peripheral to
calculate the CRC for some data and uses it to validate the CRC of the
received data.
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch refactors the command execution. A command is represented by
a struct implementing the Command trait. The enum_cmd macro is used to
generate a mapping from the CommandId enum to a Command instance and to
execute the command. The request and response data is manually
converted from and to raw byte slices.
As we do not have a standard library, we cannot create a Box<Command>
from a CommandId. Instead, we directly delegate the execute method to
the corresponding Command.
|
|
|
|
|
|
|
|
|
| |
The HID USB class needs device-specific information – currently, the
subclass and the protocol of the device, but also the report descriptors
and request handlers once we support these functions. Therefore, this
patch introduces the HidDevice trait that provides this data. It also
adds a Nitrokey struct that implements this trait for the Nitrokey Pro
device.
|
|
|
|
|
|
|
|
| |
We need several enums that map to a u8 value. This patch adds the
enum_u8 macro that automatically derives the From and TryFrom macros for
an enum to make these conversions easier.
As TryFrom is not stable yet, we add our own TryFrom trait.
|
|
|
|
|
|
|
|
| |
This patch adds the usb-device and stm32f103xx-usb crates that provide a
USB stack. It introduces the HidClass struct, a basic implementation of
the Human Interface Device (HID) USB class. Devices with that class are
recognized as HID devices with the specified vendor and product ID, but
do not provide the endpoints required for interaction.
|
|
|