1 (edited by gussabina 2017-07-02 15:17:00)

Topic: Conflicting types for Aes error

Hello:

I have a Wolfssl + ATECC508 example working on ATSAMD21 and I want to port it to ATSAM4E which already has AES hardware.
When compiling I get "Conflicting types for Aes" so I guess the error is because an Aes structure is defined both in Atmel files and WolfSSL as well.

In fact, the port compiled before but since I 'm using FreeRTOS, I commented out the line #define SINGLE_THREADED in user_settings.h for wolfssl. I also had to declare FREERTOS_TCP to match configuration in setting.h. From this configuration, I'm getting the error.

My question is how to proceed in this cases? Renaming one of them could impact other source files so I'm not sure what to do. Also, how to setup wolfssl to use AES hardware in this case?

Thanks
Gus

Share

Re: Conflicting types for Aes error

Hi gussabina,

While FreeRTOS does have a mechanism for threading it is not your standard "pthreads" type implementation. FreeRTOS uses "tasks" to "simulate" threading and are managed accordingly if I remember correctly.

I can look into this more if you like but my first thought here is that trying to remove the "SINGLE_THREADED" define would not be the correct approach here.


Warm Regards,

Kaleb

Re: Conflicting types for Aes error

Hello Kaleb:

Thanks for looking into this.

I now included #define SINGLE_THREADED and also created a project level #define WOLFSSL_LWIP but I still get the same "Conflicting types Aes" error.

(in my previous post I said including SINGLE_THREADED the project compiled, but I was including a function that call the wolfssl stack so the error was still there...).

If I don't include WOLFSSL_LWIP I get additional errors...

It seems Atmel port handles this issue as in wolfssl/wolfcrypt/src/port/atmel/atmel.c these lines remap those structures;

#include <wolfssl/wolfcrypt/settings.h>

#ifdef WOLFSSL_ATMEL

#include <wolfssl/wolfcrypt/memory.h>
#include <wolfssl/wolfcrypt/error-crypt.h>
#include <wolfssl/ssl.h>
#include <wolfssl/internal.h>

#define Aes Aes_Remap
#define Gmac Gmac_Remap
#include "asf.h"
#undef Aes
#undef Gmac

#include <wolfssl/wolfcrypt/port/atmel/atmel.h>

static bool mAtcaInitDone = 0;

#ifdef WOLFSSL_ATECC508A

/* List of available key slots */

.......

but it still fails...

I would appreciate any guide on this.

Thanks

Gus

Share

Re: Conflicting types for Aes error

Hi gussabina,

Could you send the following please:

Compile/link error output
List of headers you are including in the application
Build Settings for wolfSSL
Summary of how you are building/linking against the wolfSSL library including compiler information


Warm Regards,

Kaleb

Re: Conflicting types for Aes error

Hi gussabina,

I never heard back from you so here is my educated guess of what is occurring. You stated the ATSAM4E has AES hardware crypto engine available so I bet the headers for that device have API's that provide access to that crypto engine (and also an Aes Structure definition that you are getting a conflict with). You would need to reference one of our existing pre-processor macros where we have added hardware support for other devices. One good one would be

STM32F2_CRYPTO

.

By referencing that macro and where it is used throughout the wolfCrypt sources, as it pertains to AES, you will get a good idea of the sections of the library that will need to be updated for your porting effort.

Let me know if this helps.


Warm Regards,

Kaleb

Re: Conflicting types for Aes error

Hello Kaleb:

Sorry for not replying before.
Actually I didn't know very well how to look at the information you requested, as I'm using Atmel Studio IDE (GCC tools) and I took an example ready for SAMD20 which was working fine but when porting to SAM4E I got these errors.

I was able to get rid of the errors, but I renamed the Aes y Gmac structures/definition in wolf and then renamed accordingly to correct subsequent errors in compilation. I'm not sure if it was a good idea but at least it compiles. I can revert this changes if necessary.

It's a good tip you give me in your last post so I will use it and learn more.

I will post if I get more errors or I have it working at some point.

Thanks
Gus

Share