Rust library to interact with Security Keys, used by Firefox
Перейти к файлу
Tim Taubert 2ea634cd61 Bug 1400513 - u2f-hid-rs: fuzzers should use a deterministic cmd byte r=jcj 2017-09-17 20:12:15 +02:00
examples Add MPL license 2017-09-13 15:47:07 -07:00
fuzz Bug 1400513 - u2f-hid-rs: fuzzers should use a deterministic cmd byte r=jcj 2017-09-17 20:12:15 +02:00
src All unsupported platforms to use stub 2017-09-14 18:00:19 -07:00
.gitignore Initial OSX support 2017-03-31 14:19:42 -07:00
.travis.yml Be less verbose with ASAN builds 2017-08-09 11:50:54 -07:00
Cargo.toml Correct J.C.'s email address 2017-07-27 12:13:13 -07:00
LICENSE Add MPL license 2017-09-13 15:47:07 -07:00
README.md README update 2017-08-14 09:57:52 -07:00
build.rs Add MPL license 2017-09-13 15:47:07 -07:00
rustfmt.toml Run rustfmt, and configure Travis to enforce rustfmt. 2017-07-27 10:00:53 -07:00

README.md

A Rust HID library for interacting with U2F Security Keys

Build Status Maturity Level

This is a cross-platform library for interacting with U2F Security Key-type devices via Rust.

  • Supported Platforms: Windows, Linux, and Mac OS X.
  • Supported HID Transports: USB.
  • Supported Protocols: FIDO U2F over USB.

This library currently focuses on U2F security keys, but is expected to be extended to support additional protocols and transports.

Usage

There's only a simple example function that tries to register and sign right now. It uses env_logger for logging, which you configure with the RUST_LOG environment variable:

cargo build
RUST_LOG=debug cargo run --example main

Proper usage should be to call into this library from something else - e.g., Firefox. There are some C headers exposed for the purpose.

Tests

There are some tests of the cross-platform runloop logic and the protocol decoder:

cargo test

Fuzzing

There are fuzzers for the USB protocol reader, basically fuzzing inputs from the HID layer. There are not (yet) fuzzers for the C API used by callers (such as Gecko).

To fuzz, you will need cargo-fuzz (the latest version from GitHub) as well as Rust Nightly.

rustup install nightly
cargo install --git https://github.com/rust-fuzz/cargo-fuzz/

rustup run nightly cargo fuzz run u2f_read -- -max_len=512
rustup run nightly cargo fuzz run u2f_read_write -- -max_len=512