2
votes

I'm trying to use the AES function in AVR Crypto Lib (http://avrcryptolib.das-labor.org/trac/wiki/AES) in my AVR project however when I copy all the required files it gives me the errors below. I'm using WinAVR on Windows and have also tried this on AVR Studio 5 with a default project without success.

main.o: In function `main':
c:\.../main.c:40: undefined reference to `aes128_init'
c:\.../main.c:41: undefined reference to `aes128_enc'
"make.exe": *** [main.elf] Error 1

It's like it doesn't even try to read the .c files in which these functions do exist. The example on the website says to call #include "aes.h" and if you look in that file it calls all the other .h files.

If I edit the .h files and tell them to include the .c files of themselves - e.g. in aes_keyschedule.h I tell it to include "aes_keyschedule.c" that sort of works and makes the `aes128_init' message go away but introduces more issues. Eventually it doesn't compile when I reach the asm .S file. Surely this isn't how it should work but I don't know how anyone else has gotten this to compile.

So I thought I'd ask - did anyone else experience this or does anyone have a very simple AES example that I can take a look at? Maybe there is something better than AVR Crypto Lib?

Thank you, Alex

1

1 Answers

1
votes

Found the issue, had to modify the makefile.

I changed SRC to the below and it all works:

SRC = $(TARGET).c aes128_dec.c aes128_enc.c aes_dec.c aes_enc.c aes_invsbox.c aes_keyschedule.c aes_sbox.c

Also, I changed ASRC to: ASRC = gf256mul.S