summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core/wee-crypto.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/core/wee-crypto.c b/src/core/wee-crypto.c
index e91233495..090449271 100644
--- a/src/core/wee-crypto.c
+++ b/src/core/wee-crypto.c
@@ -524,6 +524,10 @@ weecrypto_totp_generate_internal (const char *secret, int length_secret,
int rc, offset, length;
unsigned long bin_code;
+#if __BYTE_ORDER == __BIG_ENDIAN
+ /* Big endian does not need to swap bytes here! */
+ moving_factor_swapped = moving_factor;
+#else
moving_factor_swapped = (moving_factor >> 56)
| ((moving_factor << 40) & 0x00FF000000000000)
| ((moving_factor << 24) & 0x0000FF0000000000)
@@ -532,6 +536,7 @@ weecrypto_totp_generate_internal (const char *secret, int length_secret,
| ((moving_factor >> 24) & 0x0000000000FF0000)
| ((moving_factor >> 40) & 0x000000000000FF00)
| (moving_factor << 56);
+#endif
rc = weecrypto_hmac (secret, length_secret,
&moving_factor_swapped, sizeof (moving_factor_swapped),