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

integerify on big-endian-machines #30

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

integerify on big-endian-machines #30

nomeata opened this issue Aug 27, 2015 · 1 comment

Comments

@nomeata
Copy link
Contributor

nomeata commented Aug 27, 2015

This is a step towards #26:

Edmund Grimley Evans suggested this patch, which, according to my testing, fixes the test suite failures of KDF/Scrypt:

diff --git a/cbits/cryptonite_scrypt.c b/cbits/cryptonite_scrypt.c
index fc3fd04..eaf28ac 100644
--- a/cbits/cryptonite_scrypt.c
+++ b/cbits/cryptonite_scrypt.c
@@ -46,7 +46,7 @@ static void blockmix_salsa8(uint32_t *in, uint32_t *out, uint3

 static inline uint64_t integerify(uint32_t *B, const uint32_t r)
 {
-       return le64_to_cpu(*((uint64_t *) (B + (2*r-1) * 16)));
+       return B[(2*r-1) * 16] | (uint64_t)B[(2*r-1) * 16 + 1] << 32;
 }

 static inline uint32_t load32(const uint8_t *p)
@vincenthz
Copy link
Member

looking good. same thing, can you transform it into a PR ?

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