![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
15:21 9nov
Diff: main.cpp
- Revision:
- 6:13ef02c7dd17
- Parent:
- 5:cc8680cda38f
- Child:
- 7:8331ee141606
--- a/main.cpp Fri Nov 09 10:27:44 2018 +0000 +++ b/main.cpp Fri Nov 09 10:34:20 2018 +0000 @@ -1,6 +1,7 @@ #include "mbed.h" #include "mbedtls/pk.h" #include "mbedtls/ctr_drbg.h" +#include "mbedtls/error.h" PwmOut r(LED_RED); PwmOut g(LED_GREEN); PwmOut b(LED_BLUE); @@ -28,7 +29,8 @@ * Read the RSA public key */ if( ( ret = mbedtls_pk_parse_public_key( &pk, key,sizeof(key)) ) != 0 ) { - printf( " failed\n ! mbedtls_pk_parse_public_key returned -0x%04x\n", -ret ); + mbedtls_strerror( ret, errbuf, 200 ); + printf( " failed\n ! mbedtls_pk_parse_public_key returned -0x%04x\n%s\n", -ret , errbuf); g = b = 1; r = 0; goto exit; @@ -50,8 +52,6 @@ mbedtls_ctr_drbg_random, &ctr_drbg ) ) != 0 ) { mbedtls_strerror( ret, errbuf, 200 ); pc.printf( " failed\n ! mbedtls_pk_encrypt returned -0x%04x\n%s\n", -ret, errbuf ); - mbedtls_printf("Last error was: -0x%04x - %s\n\n", (int) -ret, errbuf ); - r = g = 1; b = 0; goto exit;