File tree Expand file tree Collapse file tree 4 files changed +24
-0
lines changed Expand file tree Collapse file tree 4 files changed +24
-0
lines changed Original file line number Diff line number Diff line change 24
24
#include " mbedtls/platform.h"
25
25
26
26
int main () {
27
+ mbedtls_platform_context platform_ctx;
28
+ if (mbedtls_platform_setup (&platform_ctx)) {
29
+ return -1 ;
30
+ }
31
+
27
32
int exit_code = MBEDTLS_EXIT_SUCCESS;
28
33
Authcrypt *authcrypt = new Authcrypt ();
29
34
@@ -34,5 +39,6 @@ int main() {
34
39
35
40
delete authcrypt;
36
41
42
+ mbedtls_platform_teardown (&platform_ctx);
37
43
return exit_code;
38
44
}
Original file line number Diff line number Diff line change @@ -961,8 +961,14 @@ static int benchmark( int argc, char *argv[] )
961
961
}
962
962
963
963
int main (void ) {
964
+ mbedtls_platform_context platform_ctx;
965
+ if (mbedtls_platform_setup (&platform_ctx)) {
966
+ return -1 ;
967
+ }
968
+
964
969
int ret = benchmark (0 , NULL );
965
970
if (ret != 0 ) {
966
971
mbedtls_printf (" Benchmark failed with error %d\r\n " , ret);
967
972
}
973
+ mbedtls_platform_teardown (&platform_ctx);
968
974
}
Original file line number Diff line number Diff line change @@ -152,8 +152,14 @@ static int example(void)
152
152
}
153
153
154
154
int main () {
155
+ mbedtls_platform_context platform_ctx;
156
+ if ( mbedtls_platform_setup (&platform_ctx)) {
157
+ return -1 ;
158
+ }
159
+
155
160
int ret = example ();
156
161
if (ret != 0 ) {
157
162
mbedtls_printf (" Example failed with error %d\r\n " , ret);
158
163
}
164
+ mbedtls_platform_teardown (&platform_ctx);
159
165
}
Original file line number Diff line number Diff line change @@ -49,6 +49,10 @@ const int SERVER_PORT = 443;
49
49
*/
50
50
int main ()
51
51
{
52
+ mbedtls_platform_context platform_ctx;
53
+ if ( mbedtls_platform_setup (&platform_ctx)) {
54
+ return -1 ;
55
+ }
52
56
/*
53
57
* The default 9600 bps is too slow to print full TLS debug info and could
54
58
* cause the other party to time out.
@@ -71,6 +75,7 @@ int main()
71
75
if (client == NULL ) {
72
76
mbedtls_printf (" Failed to allocate HelloHttpsClient object\n "
73
77
" \n FAIL\n " );
78
+ mbedtls_platform_teardown (&platform_ctx);
74
79
return exit_code;
75
80
}
76
81
@@ -84,5 +89,6 @@ int main()
84
89
85
90
delete client;
86
91
92
+ mbedtls_platform_teardown (&platform_ctx);
87
93
return exit_code;
88
94
}
You can’t perform that action at this time.
0 commit comments