paolostivanin / libcotp

C library that generates TOTP and HOTP
Apache License 2.0
80 stars 29 forks source link

compute_hmac assumes little-endian #67

Closed pem closed 5 hours ago

pem commented 21 hours ago

The function compute_hmac reverses the bytes in "C" on the assumption that it's little endian. This doesn't work on big endian architectures, like sparc (Solaris), PowerPC (AIX and Linuxes on PPC), and ARM. (The latter two can be either little or big endian.

paolostivanin commented 20 hours ago

hello, yes, you're right, it assumes the CPU is LE. I never had anyone interested in BE, so I never implemented it.

Looks like I know what to do for the next release :)

paolostivanin commented 6 hours ago

@pem would you be able to test the fix (branch issue67) on a big endian machine? It would be fantastic if you could install criterion and run all the tests

paolostivanin commented 5 hours ago

I was able to test it on a s390x machine, works fine!