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

Stop using sodiumoxide #1656

Closed
abacabadabacaba opened this issue Nov 6, 2019 · 1 comment
Closed

Stop using sodiumoxide #1656

abacabadabacaba opened this issue Nov 6, 2019 · 1 comment
Assignees
Milestone

Comments

@abacabadabacaba
Copy link
Collaborator

We are currently using libsodium (via sodiumoxide crate). I see a number of reasons against it:

  • libsodium is written in C and doesn't fully conform to Rust conventions. For example, we have to call init() (do we?), or some of its functions will not be thread-safe.
  • libsodium only provides a high-level API. We cannot use it to implement a VRF (New VRF implementation #1653), or randomness (Randomness NEPs#22), or anything else that requires low-level cryptography.
  • We only use a small subset of libsodium's functionality. When I searched through the code, I only found uses of SHA-256 hash function and Ed25519 signature scheme. Yet, we compile and link the entire library.

I propose to use these crates instead of sodiumoxide:

  • For SHA-256: sha2. Also, consider switching to a more modern hash function, such as BLAKE2.
  • For Ed25519: ed25519-dalek.
@ailisp
Copy link
Member

ailisp commented Nov 25, 2019

I'm going to ensure every c/c++ dependency doesn't use too new instruction set (which cause some validator with old cpus report: illegal instructions). This is better done before examine them so I'll take this

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

No branches or pull requests

3 participants