I'm trying to add a crypto driver for the XMEGA architecture.
For the moment I just want to test the AES algorithm, so I had the idea to disable all the other algorithm in the driver header file (os/hal/ports/AVR:XMEGA/LLD/CRYPv1/hal_crypto_lld.h)
Code: Select all
30 /*==========================================================================*/
31 /* Driver constants. */
32 /*==========================================================================*/
33
34 /**
35 * @name Driver capability switches
36 * @{
37 */
38 #define CRY_LLD_SUPPORTS_AES TRUE
39 #define CRY_LLD_SUPPORTS_AES_ECB FALSE
40 #define CRY_LLD_SUPPORTS_AES_CBC FALSE
41 #define CRY_LLD_SUPPORTS_AES_CFB FALSE
42 #define CRY_LLD_SUPPORTS_AES_CTR FALSE
43 #define CRY_LLD_SUPPORTS_AES_GCM FALSE
44 #define CRY_LLD_SUPPORTS_DES FALSE
45 #define CRY_LLD_SUPPORTS_DES_ECB FALSE
46 #define CRY_LLD_SUPPORTS_DES_CBC FALSE
47 #define CRY_LLD_SUPPORTS_SHA1 FALSE
48 #define CRY_LLD_SUPPORTS_SHA256 FALSE
49 #define CRY_LLD_SUPPORTS_SHA512 FALSE
50 #define CRY_LLD_SUPPORTS_HMAC_SHA256 FALSE
51 #define CRY_LLD_SUPPORTS_HMAC_SHA512 FALSE
52 #define CRY_LLD_SUPPORTS_TRNG FALSE
Then I have the following errors:
Code: Select all
Compiling hal.c
In file included from ../../../../os/hal/include/hal.h:136:0,
from ../../../../os/hal/src/hal.c:25:
../../../../os/hal/include/hal_crypto.h:345:32: error: unknown type name ‘HMACSHA256Context’
HMACSHA256Context *hmacsha256ctxp);
^
../../../../os/hal/include/hal_crypto.h:347:34: error: unknown type name ‘HMACSHA256Context’
HMACSHA256Context *hmacsha256ctxp,
^
../../../../os/hal/include/hal_crypto.h:351:33: error: unknown type name ‘HMACSHA256Context’
HMACSHA256Context *hmacsha256ctxp,
^
../../../../os/hal/include/hal_crypto.h:354:32: error: unknown type name ‘HMACSHA512Context’
HMACSHA512Context *hmacsha512ctxp);
^
../../../../os/hal/include/hal_crypto.h:356:34: error: unknown type name ‘HMACSHA512Context’
HMACSHA512Context *hmacsha512ctxp,
^
../../../../os/hal/include/hal_crypto.h:360:33: error: unknown type name ‘HMACSHA512Context’
HMACSHA512Context *hmacsha512ctxp,
^
../../../../os/common/ports/AVR/compilers/GCC/rules.mk:174: recipe for target 'build/obj/hal.o' failed
make: *** [build/obj/hal.o] Error 1
The same errors also appear in STM32 code if I made the same modification to the STM driver.
I think the hal_crypto must have a conditional compilation to avoid that errors if the driver do not support one or many algorithm.
Can I make change to the code? to resolve this?
What do you think about? Another way to do?
Thanks.