junwei-wang / AES-ARM-NEON

Efficient implementation of maksed AES on ARM NEON
MIT License
21 stars 4 forks source link

a Makefile? #1

Open netsafe opened 7 years ago

netsafe commented 7 years ago

Good time of day! Can you please make a reference/example GNU Makefile or a building script?

junwei-wang commented 7 years ago

Actually, there is no difference in this project with other C or assembly codes. You can just build the source code in your entire project, and all the exposed methods are listed in the "aes.h". Don't hesitate to reply if you have further question.

netsafe commented 7 years ago

I understand - I'm quite a long time in IT :) but when I've tried to build it on my Cortex-A7 CPU that indicates that it does have a NEON - it fails. CPU is Allwinner H3, gcc was 4.9 - all the toolchain is on stable versions from Armbian distro. And I have had weird error msgs when I was trying to build on ARM. That's why I asked about the Makefile - not a complex one, just a compiling part - pehaps I've missed something? The CPU has 4 cores :

# cat /proc/cpuinfo processor : 0 model name : ARMv7 Processor rev 5 (v7l) BogoMIPS : 22.85 Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm CPU implementer : 0x41 CPU architecture: 7 CPU variant : 0x0 CPU part : 0xc07 CPU revision : 5`

looks like everything is in place, the CPU should be OK

gcc is

# gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/arm-linux-gnueabihf/4.9/lto-wrapper Target: arm-linux-gnueabihf Configured with: ../src/configure -v --with-pkgversion='Raspbian 4.9.2-10' --with-bugurl=file:///usr/share/doc/gcc-4.9/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.9 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.9 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-libitm --disable-libquadmath --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.9-armhf/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.9-armhf --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.9-armhf --with-arch-directory=arm --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-sjlj-exceptions --with-arch=armv6 --with-fpu=vfp --with-float=hard --enable-checking=release --build=arm-linux-gnueabihf --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf Thread model: posix gcc version 4.9.2 (Raspbian 4.9.2-10)

Maybe you can help me to build your code? What exact subfolder you do recommend to use and how to build it? Thanks!

junwei-wang commented 7 years ago

What exact subfolder you do recommend to use and how to build it?

It really depends on how secure and how efficient do you want. I wrote a paper about this implementation, please refer to it for more details. Actually, I recommend you use the latest research result from my colleague, their work was presented in EuroCrypt 2017 and the codes will be public sooner.

Maybe you can help me to build your code?

I hope the official document may help you. http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dht0002a/ch01s04s02.html Don't forget to add -mfpu=neon .

Actually, I implemented this repo several years ago. I didn't test the code on a real device, but a simulator. Contribution are welcome if make any progress on it.

netsafe commented 7 years ago

What exact research of your colleagues do you mention - can you post a link to it? The basic problem I want to solve is using AES for a FAST lane using NEON, and - of course - I've tried -mfpu=neon and -mfpu=neon+xxx for supported VFP instruction sets. And yes - I'll post here if it will be any progress in it.

Ko- commented 7 years ago

Hi, similar issue here. Tried to compile with gcc 4.9.2 in /NEON/generic/:

gcc -march=native -mfpu=neon -o aes main.c *.s

I get tons of assembler errors with bad instructions and junk at the end of the line. Am I correct that all kinds of directives in the assembly files are specific to the IAR assembler iasmarm, which is not available for Linux? It would be useful to mention these things.