spaniakos / AES

AES for microcontrollers (Arduino & Raspberry pi)
http://spaniakos.github.io/AES/
GNU Affero General Public License v3.0
126 stars 56 forks source link

Flags for Raspberry Pi (fixed, not pushed yet) #32

Open PabloGN opened 6 years ago

PabloGN commented 6 years ago

Error in platform selection The if statement doesn't set the correct .h file: #if (defined(__linux) || defined(linux)) && !(defined(__ARDUINO_X86__) || defined(__arm__)) when doing in Raspberry Pi:

sudo make install
g++ -Wall -fPIC -Ofast -mfpu=vfp -mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s -c AES.cpp
In file included from AES.h:4:0,
                 from AES.cpp:1:
AES_config.h:19:23: fatal error: Arduino.h: No such file or directory
   #include <Arduino.h>
                       ^
compilation terminated.
Makefile:40: recipe for target 'AES.o' failed
make: *** [AES.o] Error 1

Flags defined in my system:

cpp -dM ./dummy.hxx |\grep -i -e linux -e __arm__ -e __ARDUINO_X86__
#define __linux 1
#define __linux__ 1
#define __gnu_linux__ 1
#define linux 1
#define __arm__ 1

So it compiles when: #if (defined(__linux) || defined(linux)) && !defined(__ARDUINO_X86__) || defined(__arm__)

OS

$ lsb_release -a
No LSB modules are available.
Distributor ID: Raspbian
Description:    Raspbian GNU/Linux 8.0 (jessie)
Release:        8.0
Codename:       jessie

Taken from https://blog.hypriot.com/

spaniakos commented 6 years ago

this is a bug and thank you for mentioning it! i cannot believe that this has slipped form the tests before merging!!

The correct code should be `

if (defined(linux) || defined(linux) || defined(arm) ) && !defined(ARDUINO_X86__)`

but i would need some confirmation with ARM Arduino devices that i do not have in order to optimize it. @FrancMunoz can you please try the library with the above code and report back compatibility with your devices? This is a major bug and will be fixed ASAP.

spaniakos commented 6 years ago

BTW @PabloGN i see that you have RPI v2, if you own a V3 as well can you please compile it there as well? i have an open issue #30 that i cant solve before i buy a new RPi v3

FrancMunoz commented 6 years ago

Hi! @spaniakos and @PabloGN, it was my fault. I will try with ARM arduino and suggest a condition to be appended to the one that works with other platforms, are you agree?

spaniakos commented 6 years ago

sure :) And i will revise my test methods so this wont happen again :)

PabloGN commented 6 years ago

BTW @PabloGN i see that you have RPI v2, if you own a V3 as well can you please compile it there as well? i have an open issue #30 that i cant solve before i buy a new RPi v3

I have a RPi3, I'll test as quick as possible :-)

FrancMunoz commented 6 years ago

I confirm that the corrected code:

#if (defined(__linux) || defined(linux) || defined(__arm__) ) && !defined(__ARDUINO_X86__)

Works with Arduino MKRGSM1400 AND MKRVIDOR. I've compiled, encrypted and decrypted and worked fine.

spaniakos commented 6 years ago

good, i will test with my arsenal of devices tonight or tomorrow and push the changes!

jaggarwal96 commented 5 years ago

@PabloGN Were you able to get it working on the Rpi 3?

PabloGN commented 5 years ago

A colleague of mine compiled and tested in RPi 3, so she only had to change the flags to set the libs. Quite faster than RPi2. So no core dumps, no freeze, no problem.

jaggarwal96 commented 5 years ago

So the only flag you had to change was the one mentioned above in the AES_config.h file or was there something else?

PabloGN commented 5 years ago

She only had to change that line#if (defined(__linux) || defined(linux) || defined(__arm__) ) && !defined(__ARDUINO_X86__) as far as I know.