spaniakos / AES

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

Segmentation fault with aes.cpp in Examples_Rpi #30

Open jaggarwal96 opened 5 years ago

jaggarwal96 commented 5 years ago

So I followed the steps you have in the readme to install the library and run it on a raspberry pi. However when I try to run the aes.cpp (with no modifications) I get a seg fault.

I am using Raspberry pi 3 which is running Raspbian OS. I know that the libraries are installed fine because when I run test_vectors.cpp it produces the expected output. One thing is notice is that the makefile generates a .so file for aes.cpp but for test_vectors is only creates an executable which makes me wonder if something in the makefile is not working.

Would you have any ideas as to why this would be happening?

spaniakos commented 5 years ago

hello,

the code is tested in raspberry pi 2 not 3 , but there should be no difference. i need more insights of the problem, can you add some prinf in various places of the code and identify the line of the segmentation fault ? if the line has a function do the same in the function and identify where the bug is, this way i can help you more.

thank you GS

On Sun, Nov 11, 2018 at 11:28 PM Jevay Aggarwal notifications@github.com wrote:

So I followed the steps you have in the readme to install the library and run it on a raspberry pi. However when I try to run the aes.cpp (with no modifications) I get a seg fault.

I am using Raspberry pi 3 which is running Raspbian OS. I know that the libraries are installed fine because when I run test_vectors.cpp it produces the expected output.

Would you have any ideas as to why this would be happening?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/spaniakos/AES/issues/30, or mute the thread https://github.com/notifications/unsubscribe-auth/ABnM6ijqzw13UI88XhpZ9zb4iMkxUnlrks5uuJZ5gaJpZM4YYshl .

jaggarwal96 commented 5 years ago

Hello thanks for getting back to me.

I see. So I do have a printf in the main as the first line but even that is not printed which makes me wonder if the error could be because of faulty linking of the libraries from the makefile. Do you think that would be an issue?

spaniakos commented 5 years ago

can you try :

sudo make clean sudo make install cd examples_Rpi make clean make sudo ./sketch name

I remember when I was initially building the library I had soem segmentation faults, cant recall the reason, but i think it was something with the install or the sudo.

other than that, I or you since i yet not own a V3 have to check the CFLAGS and g++ handlers in the makefiles (the library and the example make file)

I assume they are correct else the make install would fail. BTW is there any error message while the make install and or make?

We will manage to solve the problem.

spaniakos commented 5 years ago

do we have an update from the segmentation fault from your side ?

jaggarwal96 commented 5 years ago

Not yet, I have not been able to go to work on it. From what I remember though there wasn't any error on installing but I'll get back to you once I reinstall.

jaggarwal96 commented 5 years ago

2018-11-14-132252_1824x984_scrot So I did not get any errors in the install. I have attached a screenshot of the above said commands for you.

jaggarwal96 commented 5 years ago

So I was looking further into the architecture type of my pi and this is what I found when I did a cpuinfo. I think I'll have to change the flags for the compiler accordingly. What are your thoughts? 2018-11-14-144630_1824x984_scrot

spaniakos commented 5 years ago

i will have a deeper look to arm7 v arm6 flags and get back to you.

On Wed, Nov 14, 2018 at 10:46 PM Jevay Aggarwal notifications@github.com wrote:

So I was looking further into the architecture type of my pi and this is what I found when I did a cpuinfo. I think I'll have to change the flags for the compiler accordingly. What are your thoughts? [image: 2018-11-14-144630_1824x984_scrot] https://user-images.githubusercontent.com/11282669/48511353-1858c800-e81c-11e8-9392-f0c6cf67abaa.png

— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/spaniakos/AES/issues/30#issuecomment-438812239, or mute the thread https://github.com/notifications/unsubscribe-auth/ABnM6hYIh9aZ7RV6f0LdueZmPkXuo-Naks5uvIE0gaJpZM4YYshl .

spaniakos commented 5 years ago

can you run cpp -dM ./dummy.hxx |\grep -i -e linux -e arm -e __ARDUINO_X86__ and show me the results ?

spaniakos commented 5 years ago

@jaggarwal96 can you please try with the changes pointed our at #32 issue, and report back? the file change is : AES_config.h at line 8 from #if (defined(__linux) || defined(linux)) && !(defined(__ARDUINO_X86__) || defined(__arm__)) to #if (defined(__linux) || defined(linux) || defined(__arm__)) && !(defined(__ARDUINO_X86__))

PabloGN commented 5 years ago

can you run cpp -dM ./dummy.hxx |\grep -i -e linux -e arm -e ARDUINO_X86 and show me the results ?

In order to use this command you have to do touch dummy.hxx ( taken from https://stackoverflow.com/questions/2565979/macros-for-gcc-g-to-differentiate-linux-and-mac-osx#2567848 )

jaggarwal96 commented 5 years ago

Here is the output 2018-11-25-164742_1824x984_scrot