Closed yacoubhanna closed 7 months ago
It does compile correctly on an RPI1.
Please provide the exact commands and outputs. Otherwise it's difficult to debug.
In my first trial, I ran the default commands on Raspberry Pi 4 using
mkdir build && cd build
cmake .. -DALG_LIST="ascon128;asconhash" -DIMPL_LIST="opt32;opt32_lowsize" -DTEST_LIST="getcycles"
cmake --build .
ctest
It build everything and when I try to execute the ./getcycles_crypto_aead_ascon128v12_opt32
I got that
pi@raspberrypi:~/Desktop/Ascon/ascon-c/build $ ./getcycles_crypto_aead_ascon128v12_opt32
Illegal instruction
In my second trial, I ran the commands using armv7
mkdir build && cd build
cmake .. -DALG_LIST="ascon128;asconhash" -DIMPL_LIST="armv7m;armv7m_lowsize" -DTEST_LIST="getcycles"
cmake --build .
I got the following errors
/tmp/ccW0KWFD.s: Assembler messages:
/tmp/ccW0KWFD.s:46: Error: selected processor does not support `orn r10,r2,r9' in ARM mode
/tmp/ccW0KWFD.s:49: Error: selected processor does not support `orn fp,lr,r2' in ARM mode
/tmp/ccW0KWFD.s:62: Error: selected processor does not support `orn r10,r3,r8' in ARM mode
/tmp/ccW0KWFD.s:65: Error: selected processor does not support `orn fp,ip,r3' in ARM mode
make[2]: *** [CMakeFiles/crypto_hash_asconhashv12_armv7m_lowsize.dir/build.make:76: CMakeFiles/crypto_hash_asconhashv12_armv7m_lowsize.dir/crypto_hash/asconhashv12/armv7m_lowsize/permutations.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:90: CMakeFiles/crypto_hash_asconhashv12_armv7m_lowsize.dir/all] Error 2
make: *** [Makefile:95: all] Error 2
Thank you for your time.
Also when I tried to run
cmake .. -DCMAKE_C_COMPILER="arm-linux-gnueabi-gcc" \
-DREL_FLAGS="-O2;-fomit-frame-pointer;-march=armv7;-mtune=cortex-m4" \
-DEMULATOR="qemu-arm;-L;/usr/arm-linux-gnueabi" \
-DALG_LIST="ascon128;ascon128a" -DIMPL_LIST="armv7m;bi32_armv7m"
I got
cmake .. -DCMAKE_C_COMPILER="arm-linux-gnueabi-gcc" -DREL_FLAGS="-O2;-fomit-frame-pointer;-march=armv7;-mtune=cortex-m4" -DEMULATOR="qemu-arm;-L;/usr/arm-linux-gnueabi" -DALG_LIST="ascon128;ascon128a" -DIMPL_LIST="armv7m;bi32_armv7m"
-- The C compiler identification is unknown
-- The ASM compiler identification is unknown
-- Didn't find assembler
CMake Error at CMakeLists.txt:2 (project):
The CMAKE_C_COMPILER:
arm-linux-gnueabi-gcc
is not a full path and was not found in the PATH.
Tell CMake where to find the compiler by setting either the environment
variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
the compiler, or to the compiler name if it is in the PATH.
CMake Error at CMakeLists.txt:2 (project):
No CMAKE_ASM_COMPILER could be found.
Tell CMake where to find the compiler by setting either the environment
variable "ASM" or the CMake cache entry CMAKE_ASM_COMPILER to the full path
to the compiler, or to the compiler name if it is in the PATH.
-- Warning: Did not find file Compiler/-ASM
-- Configuring incomplete, errors occurred!
See also "/home/pi/Desktop/Ascon-2/ascon-c/build/CMakeFiles/CMakeOutput.log".
See also "/home/pi/Desktop/Ascon-2/ascon-c/build/CMakeFiles/CMakeError.log".
Does building the genkat test work?
-DTEST_LIST="genkat"
I think the problem is that the cycle counter does not work for RPI 3/4. Maybe because the assembly instruction is different than for the RPI 1. Another reason could be that you did not compile/install/load the requested kernel module. There are instructions in the readme for RPI 1, but this is most likely different for RPI 3/4.
Regarding your second comment: These instructions are for cross-compiling and simulating using qemu. Not for compiling and running on an RPI.
Perhaps https://github.com/ascon/ascon-c/issues/16 contains a hint to the issue?
The armv7m
implementation of Ascon uses the T32 ORN instruction:
https://developer.arm.com/documentation/dui0801/l/A32-and-T32-Instructions/ORN--T32-only-
This instruction is only available on 32-bit ARMv7-M, ARMv8-M and ARMv8-A CPUs, but not on ARMv7-A CPUs. The RPI3/4 are 64-bit Cortex-A53 and Cortex-A72 CPUs. The best option is to use the opt64
implementation of Ascon then.
If running in 32-bit mode, I assume the compiler uses ARMv7-A, where T32 ORN is not available. The best option is to use the armv6
implementation of Ascon, which is the same as armv7m
with ORN replaced by MVN+ORR. Maybe armv6
should be called armv7a
nowadays.
Hello,
I tried to compile Ascon on my PC using opt64/32 and it was working. However, when I try to compile it on RPI 3/4 using ARMV7 and ARMV6 architecture it doesn't work and it gives me an Illegal Instructions error. How can I compile Ascon on the RPI?
Also when I run lscpu command on RPI I'm getting that it is based on ARMV7.
Thank you for your help.