Skip to content
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

Fix the endianness detection #12

Merged
merged 4 commits into from
Jan 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,26 @@ jobs:
run: |
pip install --user codecov
/home/runner/.local/bin/codecov

test-on-s390x:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Setup emulator
run: |
sudo docker run --rm --privileged tonistiigi/binfmt:qemu-v6.2.0
- name: Run build
uses: uraimo/[email protected]
with:
arch: s390x
distro: ubuntu22.04
install: |
apt-get update -y
DEBIAN_FRONTEND=noninteractive apt-get install -y rebar3 gcc libssl-dev
run: |
echo "---rebar3 as test get-deps---"
rebar3 as test get-deps
echo "---rebar3 as test compile---"
rebar3 as test compile
echo "---rebar3 as test ct---"
rebar3 as test ct
4 changes: 2 additions & 2 deletions c_src/fast_pbkdf2.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

static inline void write32_be(uint32_t n, uint8_t out[4])
{
#if defined(__GNUC__) && __GNUC__ >= 4 && __BYTE_ORDER == __LITTLE_ENDIAN
#if defined(__GNUC__) && __GNUC__ >= 4 && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
*(uint32_t *)(out) = __builtin_bswap32(n);
#else
out[0] = (n >> 24) & 0xff;
Expand All @@ -50,7 +50,7 @@ static inline void write32_be(uint32_t n, uint8_t out[4])

static inline void write64_be(uint64_t n, uint8_t out[8])
{
#if defined(__GNUC__) && __GNUC__ >= 4 && __BYTE_ORDER == __LITTLE_ENDIAN
#if defined(__GNUC__) && __GNUC__ >= 4 && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
*(uint64_t *)(out) = __builtin_bswap64(n);
#else
write32_be((n >> 32) & 0xffffffff, out);
Expand Down
Loading