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

Add `no_std` support #52

Merged
merged 9 commits into from Jul 10, 2019

Conversation

Projects
None yet
5 participants
@apoelstra
Copy link
Member

commented Jul 5, 2019

When no_std is on we lose the io::Write impls on all the hash engines, naturally, as well as the std::error::Error impl on Error.

We also lose the ToHex trait, since this outputs a String, though we retain the format_hex function as well as fmt::{Display, LowerHex, UpperHex} for all hashes.

Fixes #12

Show resolved Hide resolved src/std_impls.rs
Show resolved Hide resolved src/siphash24.rs Outdated
Show resolved Hide resolved .gitignore
Show resolved Hide resolved src/lib.rs
Show resolved Hide resolved src/lib.rs

apoelstra added some commits Jul 5, 2019

eliminate `write_impl` macro
This was saving a very small amount of code and will make it difficult
to refactor the `write` function into the `input` function in the next
commit.

@apoelstra apoelstra force-pushed the 2019-07-nostd branch from a2c5637 to 8554cf9 Jul 7, 2019

@apoelstra

This comment has been minimized.

Copy link
Member Author

commented Jul 7, 2019

Rebased, fixed build failure with --features "fuzztarget", added no_std build test to Travis

@apoelstra apoelstra force-pushed the 2019-07-nostd branch from 8554cf9 to c26dfb4 Jul 9, 2019

@apoelstra

This comment has been minimized.

Copy link
Member Author

commented Jul 9, 2019

Removed redundant fuzztarget/nonfuzztarget siphash24::midstate

@stevenroose

This comment has been minimized.

Copy link
Collaborator

commented Jul 10, 2019

Is there a specific reason why you implemented input for each hash instead of using a macro like there was for write_impl? Could have prevented a bit of code duplication.

Otherwise ACK.

@apoelstra

This comment has been minimized.

Copy link
Member Author

commented Jul 10, 2019

It was just short, and all the duplication was in one file right next to each other. If I need to change it I'll convert it to a macro.

@apoelstra

This comment has been minimized.

Copy link
Member Author

commented Jul 10, 2019

Added a commit to bump the version number.

@sgeisler am I ok to merge?

@elichai

This comment has been minimized.

Copy link

commented Jul 10, 2019

If anyone really wants the ToHex trait, they could try and maybe make it similar to this https://github.com/debris/rustc-hex/blob/master/src/lib.rs#L31
(generic over FromIterator<char>)

@dongcarl
Copy link
Member

left a comment

Should probably cherry-pick dongcarl@01ae9cb for proper propagation of {no_,}std, can also cherry-pick dongcarl@4ac63b7

dongcarl added some commits Jul 10, 2019

Add engine_input_impl! macro.
This was previously removed to aid restructuring, but should be added
back so we don't have to remember to modify every HashEngine every time
we modify the input function.
@apoelstra

This comment has been minimized.

Copy link
Member Author

commented Jul 10, 2019

cherry-picked both. Thanks!

@dongcarl

This comment has been minimized.

Copy link
Member

commented Jul 10, 2019

ACK eac6cde

@dongcarl dongcarl merged commit 115266d into master Jul 10, 2019

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@apoelstra apoelstra deleted the 2019-07-nostd branch Jul 10, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.