Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
conradoplg opened this issue Apr 21, 2023 · 1 comment

Comments

@conradoplg
Copy link
Contributor

@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.

@conradoplg
Copy link
Contributor Author

See ZcashFoundation/redjubjub#25 for a previous attempt of adding a Blake2b trait

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Product Backlog
Development

No branches or pull requests

1 participant