Skip to content

Support for hardware wallets and other embedded systems (including #![no_std]) #62

@conradoplg

Description

@conradoplg

@saleemrashid commented on Tue Feb 25 2020

Current Plan

  • Keep thiserror usage behind thiserror feature — thiserror does not support #![no_std] and hardware wallets will want to minimize code size so core::fmt is out of the question.

  • Add trait Blake2b and provide implementation for blake2b_simd when feature is enabled. Hardware wallets have their own BLAKE2b implementations and will want to minimize code size by not adding another. For other embedded systems, there may be implementations more suitable than blake2b_simd. This requires adding a Blake2b type parameter to struct HStar, PublicKey::verify, and SecretKey::sign.

  • Wrap blake2b_simd and thiserror in an std feature, and add #![cfg_attr(not(feature = "std"), no_std)]. Replace all use std:: with use core::.

Issues

  • The BLAKE2b issue will be present in other crates that hardware wallets need to use, so trait Blake2b would be useful there. Therefore, it doesn't seem like a good idea to define that trait in this crate. Which crate should it go in?

  • How much code size does rand_core add? This is important for hardware wallets, especially ones that are not already using Rust as they will also incur the code size cost of the standard library. If it adds too much code size, perhaps another signing method should be added to SecretKey, which accepts the entropy as a parameter, rather than accepting a CryptoRng instance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Product Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions