Hi Michael,
On Wed, Jan 13, 2021 at 8:00 PM Michael Weiser michael.weiser@gmx.de wrote:
Out of curiosity as I can't seem to find the beginning of the discussion: Is there anyone but me with an actual use-case for big-endian arm64 here? If not, I'd hate to cause a lot of effort for you and would certainly put in the effort to get this going myself.
It would be nice to get the implementation of the enhanced algorithm working for both endian modes as it yields a good performance boost. Also, there is no much effort here, the only thing I'm struggling with is to get the binary built for Aarch64_be, I'm using Ubuntu on x86_64 as host and it seems there is no official package to cross compile for Aarch64_be.
The patch is built on top of the master branch.
First it failed to compile gcm-hash.o with error "No rule to make target" which turned out to be caused by a missing arm64/machine.m4. After I added an empty file there it compiled fine on aarch64 and the testsuite succeeded on the actual hardware as well as under qemu-aarch64 user mode emulation (both LE).
On aarch64_be it fails to compile with the following error message:
gcm-hash.s:113: Error: unknown mnemonic `zip' -- `zip v23.2d,v2.2d,v22.2d' gcm-hash.s:119: Error: unknown mnemonic `zip' -- `zip v25.2d,v3.2d,v22.2d' gcm-hash.s:129: Error: unknown mnemonic `zip' -- `zip v27.2d,v4.2d,v22.2d' gcm-hash.s:137: Error: unknown mnemonic `zip' -- `zip v29.2d,v5.2d,v22.2d'
This happens with gcc 10.2.0 on my hardware board as well as cross gcc 9.3.0 of Buildroot 2020.11.1 in a container.
I did a search of the aarch64 instruction set and saw that there's zip1 and zip2 instructions. So as a first test I just changed zip to zip1 which made it compile. As was to be expected, the testsuite failed though.
You are on the right track so far.
Before you try and get me up to speed on what the routine is supposed to be doing there's also an option for you to get a cross toolchain and emulator for your own tests without too much effort. Here's how I cross-compile nettle and run the testsuite using rootless podman (docker should do just as well) on my x86_64 box:
cd ~/Downloads mkdir nettle cd nettle git clone https://git.lysator.liu.se/nettle/nettle cd nettle git apply ~/arm64_ghash.patch ./.bootstrap podman run -it -v ~/Downloads/nettle:/nettle michaelweisernettleci/buildroot:2020.11.1-aarch64_be-glibc-gdb cd /nettle/ mkdir build-aarch64_be cd build-aarch64_be/ ../nettle/configure --host=$(cat /buildroot/triple) --enable-armv8-a-crypto make -j4 make -j4 check EMULATOR=/buildroot/qemu
I tried that but I'm having difficulty getting it work, it seems there is a problem in my system configuration that prevents podman establishing a socket for connection, I spend some time looking for alternative solutions with no chance. Do you have any other solutions? all what I can think of is either setup ssh connection or work together to get it work if you are into it!
regards, Mamone