LNSym icon indicating copy to clipboard operation
LNSym copied to clipboard

Add ELFLoader test for AES-GCM assembly routines

Open pennyannn opened this issue 1 year ago • 1 comments

Description:

This PR adds ELFLoader tests for AES-GCM assembly routines.

When updating the binary file crypto_test, the file exceeds the maximum file size on Github. In this PR, crypto_test is removed and it is now built in the CI. Note that building this binary requires an Arm machine so we separate the ELFLoader tests for AWS-LC from the other Tests, and run the AWS-LC ELFLoader Tests on MacOS-14.

Testing:

What tests have been run? Did make all succeed for your changes? Was conformance testing successful on an Aarch64 machine? Not yet

License:

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

pennyannn avatar Aug 20 '24 19:08 pennyannn

running objdump -r on the produced object file causes LLVM to crash with LLVM ERROR: Malformed MachO file:

➜  build git:(main) ✗ objdump -r  crypto/libcrypto.a | grep _ecp_nistz256_mul_mont
0000000000057370 ARM64_RELOC_BRANCH26     _ecp_nistz256_mul_mont
0000000000057238 ARM64_RELOC_BRANCH26     _ecp_nistz256_mul_mont
0000000000057224 ARM64_RELOC_BRANCH26     _ecp_nistz256_mul_mont
0000000000057214 ARM64_RELOC_BRANCH26     _ecp_nistz256_mul_mont
00000000000567d8 ARM64_RELOC_BRANCH26     _ecp_nistz256_mul_mont
00000000000567c8 ARM64_RELOC_BRANCH26     _ecp_nistz256_mul_mont
00000000000567a8 ARM64_RELOC_BRANCH26     _ecp_nistz256_mul_mont
000000000005677c ARM64_RELOC_BRANCH26     _ecp_nistz256_mul_mont
0000000000056604 ARM64_RELOC_BRANCH26     _ecp_nistz256_mul_mont
0000000000056474 ARM64_RELOC_BRANCH26     _ecp_nistz256_mul_mont
000000000005644c ARM64_RELOC_BRANCH26     _ecp_nistz256_mul_mont
00000000000562bc ARM64_RELOC_BRANCH26     _ecp_nistz256_mul_mont
0000000000056294 ARM64_RELOC_BRANCH26     _ecp_nistz256_mul_mont
00000000000561d0 ARM64_RELOC_BRANCH26     _ecp_nistz256_mul_mont
000000000005619c ARM64_RELOC_BRANCH26     _ecp_nistz256_mul_mont
0000000000056144 ARM64_RELOC_BRANCH26     _ecp_nistz256_mul_mont
0000000000056110 ARM64_RELOC_BRANCH26     _ecp_nistz256_mul_mont
00000000000560f4 ARM64_RELOC_BRANCH26     _ecp_nistz256_mul_mont
LLVM ERROR: Malformed MachO file.
[5]    18295 abort      objdump -r crypto/libcrypto.a |
       18296 done       grep --color=auto --exclude-dir={.bzr,CVS,.git,.hg,.svn,.idea,.tox}

I hope we are not running into something deeply troubled here :(

bollu avatar Aug 21 '24 02:08 bollu

@pennyannn I'm trying to use docker to setup the xcompile as explained in the aws-lc repo: https://github.com/aws/aws-lc/blob/main/tests/ci/README.md

bollu avatar Aug 21 '24 04:08 bollu

@pennyannn I can cross compile on macOS as follows, via docker:

cd /path/to/aws-lc
docker build -t ubuntu-22.04-aarch:base -f tests/ci/docker_images/linux-aarch/ubuntu-22.04_base/Dockerfile tests/ci/docker_images/dependencies
docker build -t  ubuntu-22.04-gcc-12x tests/ci/docker_images/linux-aarch/ubuntu-22.04_gcc-12x/
docker run -v `pwd`:`pwd` -w `pwd` ubuntu-22.04-gcc-12x bash -c 'rm -rf build && mkdir -p build && cd build && cmake ../  -DCMAKE_BUILD_TYPE=RelWithDebInfo -DKEEP_ASM_LOCAL_SYMBOLS=1 && make -j4 crypto_test'
file build/crypto/crypto_test
cp build/crypto/crypto_test ~/LNSym/tests/ELFParser/Data/crypto_test

bollu avatar Aug 21 '24 04:08 bollu