2017-04-06 5 views
0

J'ai compilé mbedtls pour une carte K64F avec ARM Mbed OS. J'essaye d'exécuter les exemples qui viennent dans le dtls_client.c et le dtls_server.c. Dans un premier temps, sur la compilation du client je suis arrivé cette erreur:mbed tls Modules NET et TIMING non disponibles

"The NET and TIMING modules are not available for mbed OS - please use the network and timing functions provided by mbed OS" 

Je trouve que cela était lié à avoir ces deux lignes actives dans le fichier config.h.

#define MBEDTLS_NET_C 
    #define MBEDTLS_TIMING_C 

I commented them and the check that requires the values: 

#if !defined(MBEDTLS_SSL_CLI_C) || !defined(MBEDTLS_SSL_PROTO_DTLS) || \ 
    !defined(MBEDTLS_NET_C) || !defined(MBEDTLS_TIMING_C) ||    \ 
    !defined(MBEDTLS_ENTROPY_C) || !defined(MBEDTLS_CTR_DRBG_C) ||  \ 
    !defined(MBEDTLS_X509_CRT_PARSE_C) || !defined(MBEDTLS_RSA_C) ||  \ 
    !defined(MBEDTLS_CERTS_C) || !defined(MBEDTLS_PEM_PARSE_C) 
int main(void) 
{ 
    mbedtls_printf("MBEDTLS_SSL_CLI_C and/or MBEDTLS_SSL_PROTO_DTLS and/or " 
      "MBEDTLS_NET_C and/or MBEDTLS_TIMING_C and/or " 
      "MBEDTLS_ENTROPY_C and/or MBEDTLS_CTR_DRBG_C and/or " 
      "MBEDTLS_X509_CRT_PARSE_C and/or MBEDTLS_RSA_C and/or " 
      "MBEDTLS_CERTS_C and/or MBEDTLS_PEM_PARSE_C not defined.\n"); 
    return(0); 
} 

Maintenant, je vois que l'erreur de compilation que je reçois est lié à la redéfinition de certaines fonctions:

main.cpp:(.text.startup.main+0x18): undefined reference to `mbedtls_net_init' 
main.cpp:(.text.startup.main+0xce): undefined reference to `mbedtls_net_connect' 
main.cpp:(.text.startup.main+0x2fc): undefined reference to `mbedtls_net_recv_timeout' 
main.cpp:(.text.startup.main+0x300): undefined reference to `mbedtls_net_send' 
main.cpp:(.text.startup.main+0x304): undefined reference to `mbedtls_net_recv' 
main.cpp:(.text.startup.main+0x308): undefined reference to `mbedtls_timing_get_delay' 
main.cpp:(.text.startup.main+0x30c): undefined reference to `mbedtls_timing_set_delay' 
main.cpp:(.text.startup.main+0x35c): undefined reference to `mbedtls_net_free' 

Comment puis-je définir cette demande pour le faire fonctionner?

Répondre

1

déjà répondu ici: https://tls.mbed.org/discussions/platform-specific/compiling-mbeddtls-on-k64f:

Hi Jordi,
dtls_client.c and dtls_server.c are sample applications that arrive as part of the mbed TLS git repository.
Note that mbed-OS arrives with its own mbed TLS feature directory. To test TLS feature, you can use the TLS client app and modify it to fit DTLS protocol, and also for server. You can also look at this example for reference how to configure your dtls client and server.
I hope this helps
mbed TLS Team member
Ron