Skip to content
This repository has been archived by the owner on Sep 20, 2023. It is now read-only.

Use mkLE instead of LE #31

Closed
nomeata opened this issue Aug 27, 2015 · 1 comment
Closed

Use mkLE instead of LE #31

nomeata opened this issue Aug 27, 2015 · 1 comment

Comments

@nomeata
Copy link
Contributor

nomeata commented Aug 27, 2015

Another step towards #26:

--- haskell-cryptonite-0.6.orig/Crypto/Cipher/ChaChaPoly1305.hs
+++ haskell-cryptonite-0.6/Crypto/Cipher/ChaChaPoly1305.hs
@@ -108,5 +108,5 @@ finalize :: State -> Poly1305.Auth
 finalize (State _ macState aadLength plainLength) =
     Poly1305.finalize $ Poly1305.updates macState
         [ pad16 plainLength
-        , either (error "finalize: internal error") id $ P.fill 16 (P.putStorable (LE aadLength) >> P.putStorable (LE plainLength))
+        , either (error "finalize: internal error") id $ P.fill 16 (P.putStorable (toLE aadLength) >> P.putStorable (toLE plainLength))
         ]

With this and #30 applied, the test suite goes through. I hope it is comprehensive enough that this makes it likely that all endianness-bugs are fixed...

@vincenthz
Copy link
Member

good catch: my own mixup on what LE / toLE represented.

Thanks,
Edit: can you make it a Pull request, as that simplify the attribution of the code fix to the rightful owner.

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

No branches or pull requests

2 participants