Description
In atca_mbedtls_wrap.h file, there are few APIs such as
atca_mbedtls_pk_init();
etc.
In a recent release, probably 3.7.7, the mbedtls related support was moved under
ATCA_MBEDTLS
configuration option.
But the atca_mbedtls_wrap.h
does not get the value of ATCA_MBEDTLS
by itself. You need to include other file for e.g., cryptoauthlib.h
file ( or atca_config.h
) before this file to get required behaviour.
For e.g.,
#include "atca_mbedtls_wrap.h"
#include "cryptoauthlib.h"
doesnt work
but
#include "cryptoauthlib.h"
#include "atca_mbedtls_wrap.h"
works.
in second case the mbedtls support is enabled as ATCA_MBEDTLS=1
is obtained through cryptoauthlib.h
To Reproduce
Run any example which uses mbedTLS layer APIs with including atca_mbedtls_wrap.h
first.
Resultant behaviour
/Users/flying_raijin/esp/esp-idf/components/esp-tls/esp_tls_mbedtls.c: In function 'esp_set_atecc608a_pki_context':
/Users/flying_raijin/esp/esp-idf/components/esp-tls/esp_tls_mbedtls.c:1113:11: error: implicit declaration of function 'atca_mbedtls_cert_add' [-Wimplicit-function-declaration]
1113 | ret = atca_mbedtls_cert_add(&tls->clientcert, cert_def);
| ^~~~~~~~~~~~~~~~~~~~~
/Users/flying_raijin/esp/esp-idf/components/esp-tls/esp_tls_mbedtls.c:1140:11: error: implicit declaration of function 'atca_mbedtls_pk_init'; did you mean 'mbedtls_pk_init'? [-Wimplicit-function-declaration]
1140 | ret = atca_mbedtls_pk_init(&tls->clientkey, 0);
| ^~~~~~~~~~~~~~~~~~~~
| mbedtls_pk_init
Expected behavior
Ideally atca_mbedtls_wrap.h
itself should include cryptoauthlib.h
or relevant header file which obtains the value of ATCA_MBEDTLS
configuration ( e.g., atca_config.h
)
Additional context
including appropriate header before
to get the definition ofATCA_MBEDTLS
should solve the issue