![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
15:21 9nov
Diff: main.cpp
- Revision:
- 5:cc8680cda38f
- Parent:
- 4:98332985e06f
- Child:
- 6:13ef02c7dd17
--- a/main.cpp Fri Nov 09 10:05:59 2018 +0000 +++ b/main.cpp Fri Nov 09 10:27:44 2018 +0000 @@ -12,6 +12,7 @@ r = g = b = 1; g = 0; int ret = 0; + char errbuf[] = ""; mbedtls_pk_context pk; mbedtls_pk_init( &pk ); @@ -47,7 +48,10 @@ if( ( ret = mbedtls_pk_encrypt( &pk, to_encrypt, sizeof(to_encrypt), buf, &olen, sizeof(buf), mbedtls_ctr_drbg_random, &ctr_drbg ) ) != 0 ) { - pc.printf( " failed\n ! mbedtls_pk_encrypt returned -0x%04x\n", -ret ); + 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;