I'm having a weird problem with mbedtls security library. I've downloaded the newest version of it (link to download the .tar.gz) on my Ubuntu machine, then compiled it and copied the header files to /usr/include
and the shared library files to the /usr/lib
.
When I'm compiling my C++ program which calls the function mbedtls_cipher_cmac_starts
from mbedtls/cmac.h, I get the undefined reference error Security.cpp:599: undefined reference to 'mbedtls_cipher_cmac_starts'
. However, I have included and linked the libraries correctly (At least I think so, this is not an ordering problem, right?). The problem seems to be in the mbedtls library itself, as when I nm -D libmbedcrypto.so
, I can't find the needed function. I also checked the libmbedtls.so but also no luck from there.
0000000000020206 T mbedtls_cipher_auth_decrypt
0000000000020128 T mbedtls_cipher_auth_encrypt
000000000001ff17 T mbedtls_cipher_check_tag
0000000000020022 T mbedtls_cipher_crypt
0000000000264960 D mbedtls_cipher_definitions
000000000001fb49 T mbedtls_cipher_finish
Although it seems to be in the library makefile when compiling the library. Also, it is weird that the header file (cmac.h) can be referenced from code, but it just won't compile because of the undefined references.