Topic: Running AES-CTR on Riot OS
Hi everyone:
I am trying to use wolfCrypt on RIOT OS for my IoT project. The current version of wolfCrypt on RIOT is 4.5.0. I followed the instructions:
$ ./autogen.sh
$ ./configure --enable-aesctr
$ make
$ make check # (optional, but highly recommended)
$ sudo make install
to enable AES-CTR. In the options.h, it shows that AES-CTR is enabled.
#undef WOLFSSL_AES_COUNTER
#define WOLFSSL_AES_COUNTER
However, when I tried to compile my code on native board, it says:
undefined reference to `wc_AesCtrEncrypt'
collect2: error: ld returned 1 exit status
whereas I did include the "aes.h" in my main.c file:
#include <stdio.h>
#include <unistd.h>
#include <wolfssl/options.h>
#include <wolfssl/wolfcrypt/sha256.h>
#include <wolfssl/wolfcrypt/random.h>
#include <wolfssl/wolfcrypt/pwdbased.h>
#include <wolfssl/wolfcrypt/aes.h>
#include "xtimer.h"
#include "log.h"
Also, Here is my Makefile:
APPLICATION = test_aes
BOARD ?= native
RIOTBASE ?= $(CURDIR)/../..
DEVELHELP ?= 1
QUIET ?= 1
CFLAGS += -DTHREAD_STACKSIZE_MAIN=2*THREAD_STACKSIZE_LARGE
USEPKG += wolfssl
USEMODULE += wolfcrypt_ecc
USEMODULE += wolfcrypt-test
USEMODULE += wolfcrypt_asn
USEMODULE += wolfcrypt_aes
USEMODULE += wolfcrypt
USEMODULE += wolfcrypt_random
USEMODULE += wolfcrypt_sha256
USEMODULE += wolfssl_dtls
USEMODULE += wolfcrypt_pwdbased
USEMODULE += gnrc_sock_check_reuse
USEMODULE += gnrc_sock_udp
USEMODULE += gnrc_ipv6
USEMODULE += xtimer
ifneq ($(BOARD),native)
CFLAGS += -DBENCH_EMBEDDED
endif
TEST_ON_CI_WHITELIST += native
include $(RIOTBASE)/Makefile.include
---------------------------------------
My code works well for AES-CBC mode (wc_AesCbcEncrypt), but keeps saying: undefined reference to `wc_AesCtrEncrypt'. I got stucked here for several days and tried everything I could. Any advice would be helpful. Thank you.