-
Notifications
You must be signed in to change notification settings - Fork 14
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
Move to cryptonite #32
Conversation
Thanks for looking into this, @nwf!
|
Thanks @nwf ! There shouldn't be any drawbacks moving to
A bit out of topic, but encrypt :: Keys -> Input -> IO Output
encrypt (chachaKey, polyKey) plaintext = do
nonce <- getEntropy 12
let encryptedData = fst $ ChaCha.combine (ChaCha.initialize 12 chachaKey nonce) plaintext
encryptedDataIV = B.concat [nonce, encryptedData]
mac = Poly1305.auth polyKey encryptedDataIV
in B.concat [encryptedDataIV, mac] |
Regarding ChaCha + Poly1305, I'm not opposed to moving to different crypto should it prove to be beneficial. This reminds me of #23. BTW, though, what do you mean by getting rid of the DRG? You still have a |
The In many cases where you need something actually random (entropy), it's probably much more efficient to ask the system to gives entropy. In the case of client session, it's very likely that you are in this situation. This does "solve" the reseeding problem, as the system entropy do not have to be reseeded. For the ChaCha + Poly1305, it's very related to #23 indeed. It's more up-to-date with what modern crypto{graphers/users} like to uses at this specific point of time (ChaCha is almost trivial to implement compared to AES, and got excellent properties, likewise for Poly1305); It's also has the benefit of being faster than AES_CTR+Skein (not verified by benchmarks, but interpolated from multiples sources), specially on hardware that do not support AESNI. |
I agree it's useful to have something that does not reseed itself. So what I would love is a wrapper around any DRG/CPRNG adding automatic reseeding. Regarding entropy, using the system entropy is usually orders of magnitude more expensive than using a reseeding CPRNG. We can't afford to read from |
I've made a quick benchmarks with ChaChaDRG, SystemDRG (both from (7.8.4, osx, rdrand, no aesni), generating 4096 bytes in chunks of 64 bytes:
(7.10, linux, rdrand + aesni)
(7.10, windows, no rdrand, no aesni)
|
Especially in light of those performance numbers, I'd welcome moving as much as possible (i.e. everything but possibly some parts of test harnesses?) to SystemDRG. Letting the kernel provide entropy and manage reseeds and all that seems much better than re-implementing all of that again; more eyes on that code, more users of that code, more likely to be kept up to date, less effort from the Haskell community, etc. :) |
Would be nice to revive this, to move away from old packages. @snoyberg are you happy for me to do a PR to update the crypto parts (when I get to it) ? |
Yes sounds good thanks
…On Sat, Apr 8, 2017, 7:04 PM Vincent Hanquez ***@***.***> wrote:
Would be nice to revive this, to move away from old packages. @snoyberg
<https://github.com/snoyberg> are you happy for me to do a PR to update
the crypto parts (when I get to it) ?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#32 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AADBBy9D0TVVZ1dxeUVnziPRDzYxtrqQks5rt6_wgaJpZM4FHmjE>
.
|
This at least compiles and passes the self-tests, but that's about all I'm willing to say about it with any certainty. Review would be much appreciated!