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

Support aarch64-apple-darwin #26

Closed
3 tasks
franziskuskiefer opened this issue May 10, 2021 · 7 comments · Fixed by #29
Closed
3 tasks

Support aarch64-apple-darwin #26

franziskuskiefer opened this issue May 10, 2021 · 7 comments · Fixed by #29

Comments

@franziskuskiefer
Copy link
Owner

franziskuskiefer commented May 10, 2021

@franziskuskiefer
Copy link
Owner Author

I can test on my M1 Air.

I would've attempted to PR it myself, but well, I don't really know how to do anything more than adding "aarch64-apple-darwin" => cfg.set_cross_config_flags(vec!["-target", "aarch64-apple-darwin"]), to build.rs.

Originally posted by @aspenluxxxy in #7 (comment)

@aspenluxxxy getting the debug output from that would be helpful already. I expect that changes to the underlying hacl* build are needed though.

@Absolucy
Copy link

error: failed to run custom build command for `evercrypt-sys v0.0.8 (/Users/Aspen/Documents/Code/evercrypt-rust/evercrypt-sys)`

Caused by:
  process didn't exit successfully: `/Users/Aspen/Documents/Code/evercrypt-rust/target/debug/build/evercrypt-sys-8ede419cfa00eba7/build-script-build` (exit code: 101)
  --- stdout
  cargo:rerun-if-changed=wrapper.h
  cargo:rerun-if-changed=hacl-star
  build_config: BuildConfig { hacl_src_dir: "gcc-compatible", cross: false, config_flags: [], make_flags: [], env: {}, lib_name: "evercrypt", windows: false }
  out_path: "/Users/Aspen/Documents/Code/evercrypt-rust/target/debug/build/evercrypt-sys-763f5bba16149e11/out"
  hacl_src_path: "/Users/Aspen/Documents/Code/evercrypt-rust/target/debug/build/evercrypt-sys-763f5bba16149e11/out/hacl-star/dist/gcc-compatible"

  --- stderr
  wrapper.h:1:10: fatal error: 'EverCrypt_AEAD.h' file not found
  wrapper.h:1:10: fatal error: 'EverCrypt_AEAD.h' file not found, err: true
  thread 'main' panicked at 'Unable to generate bindings: ()', evercrypt-sys/build.rs:272:10
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

EverCrypt_AEAD.h does seem to exist in some folders:

❯ fd --no-ignore EverCrypt_AEAD.h ..
../evercrypt-sys/hacl-star/dist/c89-compatible/EverCrypt_AEAD.h
../evercrypt-sys/hacl-star/dist/gcc-compatible/EverCrypt_AEAD.h
../evercrypt-sys/hacl-star/dist/gcc64-only/EverCrypt_AEAD.h
../evercrypt-sys/hacl-star/dist/mitls/EverCrypt_AEAD.h
../evercrypt-sys/hacl-star/dist/msvc-compatible/EverCrypt_AEAD.h
../evercrypt-sys/hacl-star/dist/portable-gcc-compatible/EverCrypt_AEAD.h
../target/debug/build/evercrypt-sys-11ab40622d955d3c/out/hacl-star/dist/c89-compatible/EverCrypt_AEAD.h
../target/debug/build/evercrypt-sys-11ab40622d955d3c/out/hacl-star/dist/gcc-compatible/EverCrypt_AEAD.h
../target/debug/build/evercrypt-sys-11ab40622d955d3c/out/hacl-star/dist/gcc64-only/EverCrypt_AEAD.h
../target/debug/build/evercrypt-sys-11ab40622d955d3c/out/hacl-star/dist/mitls/EverCrypt_AEAD.h
../target/debug/build/evercrypt-sys-11ab40622d955d3c/out/hacl-star/dist/msvc-compatible/EverCrypt_AEAD.h
../target/debug/build/evercrypt-sys-11ab40622d955d3c/out/hacl-star/dist/portable-gcc-compatible/EverCrypt_AEAD.h
../target/release/build/evercrypt-sys-c5b19e9b6e541d5a/out/hacl-star/dist/c89-compatible/EverCrypt_AEAD.h
../target/release/build/evercrypt-sys-c5b19e9b6e541d5a/out/hacl-star/dist/gcc-compatible/EverCrypt_AEAD.h
../target/release/build/evercrypt-sys-c5b19e9b6e541d5a/out/hacl-star/dist/gcc64-only/EverCrypt_AEAD.h
../target/release/build/evercrypt-sys-c5b19e9b6e541d5a/out/hacl-star/dist/mitls/EverCrypt_AEAD.h
../target/release/build/evercrypt-sys-c5b19e9b6e541d5a/out/hacl-star/dist/msvc-compatible/EverCrypt_AEAD.h
../target/release/build/evercrypt-sys-c5b19e9b6e541d5a/out/hacl-star/dist/portable-gcc-compatible/EverCrypt_AEAD.h

@franziskuskiefer
Copy link
Owner Author

Hm, something else appears to be broken here. Can you try to clean everything and redo the build?
I just pushed a version that I can cross-compile on x86_64 macOS for aarch64-apple-darwin to a branch (note that this contains changes to the hacl* build itself). Looks like this should generally work, now we only have to make it build natively.

@Absolucy
Copy link

Absolucy commented May 11, 2021

hm it seems to work now, maybe the hacl* update fixed it? cargo check && cargo build && cargo build --release seems to work on my M1 mac.

as expected from the readme, the tests only succeed with --features rust-crypto-aes:

    Finished test [unoptimized + debuginfo] target(s) in 3.72s
     Running unittests (target/debug/deps/evercrypt-67ef23447ff5bedb)

running 1 test
test p256::scalar_checks ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

     Running tests/test_aead.rs (target/debug/deps/test_aead-a6dad3e5f325b866)

running 2 tests
test key_gen_self_test ... ok
test test_wycheproof ... ok

test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.11s

     Running tests/test_blake2.rs (target/debug/deps/test_blake2-3061fbf8bae1e459)

running 2 tests
test test_blake2b ... ok
test test_blake2s ... ok

test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

     Running tests/test_ed25519.rs (target/debug/deps/test_ed25519-b73e80890eec6f31)

running 1 test
test test_wycheproof ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.11s

     Running tests/test_hkdf.rs (target/debug/deps/test_hkdf-c5cf954369b26bf1)

running 1 test
test test_wycheproof ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.14s

     Running tests/test_hmac.rs (target/debug/deps/test_hmac-93ce81b7db4013ac)

running 1 test
test test_wycheproof ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.08s

     Running tests/test_p256_ecdh.rs (target/debug/deps/test_p256_ecdh-838a5e9258609a86)

running 1 test
test test_wycheproof ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.99s

     Running tests/test_p256_ecdsa.rs (target/debug/deps/test_p256_ecdsa-fa413499965f28b1)

running 2 tests
test test_self ... ok
test test_wycheproof ... ok

test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 1.04s

     Running tests/test_sha.rs (target/debug/deps/test_sha-a4c96f76b95a599d)

running 4 tests
test test_sha3 ... ok
test test_shake ... ok
test test_sha2 ... ok
test invalid_sha3 ... ok

test result: ok. 4 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

     Running tests/test_signatures.rs (target/debug/deps/test_signatures-325aab9f8a253b00)

running 1 test
test test_p256_signature ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s

     Running tests/test_util.rs (target/debug/deps/test_util-a8f05fb449eb1135)

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

     Running tests/test_x25519.rs (target/debug/deps/test_x25519-5ad17cfbe5fee434)

running 2 tests
test key_gen_self_test ... ok
test test_wycheproof ... ok

test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.12s

     Running unittests (target/debug/deps/evercrypt_sys-fef3306de550c1a9)

running 2 tests
test evercrypt_bindings::bindgen_test_layout_EverCrypt_Hash_state_s_s ... ok
test evercrypt_bindings::bindgen_test_layout_EverCrypt_Hash_state_s_s__bindgen_ty_1 ... ok

test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests evercrypt-sys

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests evercrypt

running 13 tests
test src/digest.rs - digest (line 9) ... ok
test src/digest.rs - digest (line 131) ... ok
test src/aead.rs - aead (line 36) ... ok
test src/digest.rs - digest (line 156) ... ok
test src/aead.rs - aead (line 9) ... ok
test src/digest.rs - digest (line 50) ... ok
test src/digest.rs - digest (line 82) ... ok
test src/digest.rs - digest (line 107) ... ok
test src/ecdh.rs - ecdh (line 6) ... ok
test src/ed25519.rs - ed25519 (line 6) ... ok
test src/hkdf.rs - hkdf (line 7) ... ok
test src/hmac.rs - hmac (line 7) ... ok
test src/x25519.rs - x25519 (line 6) ... ok

test result: ok. 13 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.94s

@franziskuskiefer
Copy link
Owner Author

hm it seems to work now, maybe the hacl* update fixed it? cargo check && cargo build && cargo build --release seems to work on my M1 mac.

Nice! Yes the build fix might have been necessary. I'll start the process of getting that in. Then we can add the target here.

as expected from the readme, the tests only succeed with --features rust-crypto-aes:

Yes that's unfortunately expected. I hope that I can remove this soon and get a fall back AES implementation in hacl* itself.

@Absolucy
Copy link

Absolucy commented May 11, 2021

Nice! Yes the build fix might have been necessary. I'll start the process of getting that in. Then we can add the target here.

Nice!

Yes that's unfortunately expected. I hope that I can remove this soon and get a fall back AES implementation in hacl* itself.

Off-topic for this issue, but maybe use ring as a potential fallback option? It can use ARMv8 cryptography extensions for AES.

@franziskuskiefer
Copy link
Owner Author

When the hacl* build changes in this PR landed we can continue here.

Off-topic for this issue, but maybe use ring as a potential fallback option? It can use ARMv8 cryptography extensions for AES.

That would be nice indeed. But actually prefer not needing a fallback at all 😉

@franziskuskiefer franziskuskiefer linked a pull request May 18, 2021 that will close this issue
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants