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

Port Ganeti.Hash to cryptonite #1405

Merged
merged 1 commit into from Dec 8, 2019
Merged

Conversation

apoikos
Copy link
Member

@apoikos apoikos commented Nov 29, 2019

Crypto has not been updated since 2012, and it currently seems to bebroken with GHC 8.6; hmac_sha1 [] [] gets caught in an endless loop accumulating over an array. Rather than try to fix it, I think it's a good idea to port the HMAC implementation to cryptonite, which is thede-facto standard for crypto in Haskell these days.

Re-implement computeMac using cryptonite, while keeping the high-levelAPI intact.

@apoikos apoikos force-pushed the feature/cryptonite branch 2 times, most recently from 31da7cf to eac268e Compare November 30, 2019 22:15
@apoikos
Copy link
Member Author

apoikos commented Nov 30, 2019

@iliastsi kindly pointed out that this is actually due to Crypto assuming accumArray to be lazy. Consensus is that it's rather unlikely to be fixed in Crypto.

@dannyman
Copy link
Contributor

dannyman commented Dec 1, 2019

Apollon, thank you for pushing the ball forward on ganeti maintenance.

@apoikos
Copy link
Member Author

apoikos commented Dec 1, 2019

@dannyman you're welcome :)

There's a bug exposed by the combination of Crypto and GHC 8.6 that
results in an endless loop[1], caused by GHC 8.6 changing accumArray
from lazy to strict. The endless loop can be reproduced as follows:

 Prelude> :m +Data.HMAC
 Prelude Data.HMAC> hmac_sha1 [] []

Unfortunately Crypto was last updated in 2012 and seems to be largely
unmaintained, so at this point it's probably a good idea to switch our
HMAC implementation over to cryptonite, which is the de facto standard
for crypto in Haskell these days.

[1] https://gitlab.haskell.org/ghc/ghc/issues/16406

Signed-off-by: Apollon Oikonomopoulos <apoikos@dmesg.gr>
@apoikos apoikos added this to the Release 3.0 milestone Dec 7, 2019
Copy link
Contributor

@iustin iustin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@apoikos apoikos merged commit 665ecb4 into ganeti:master Dec 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants