blob: dedac9420a97e65a7ede15ba2009e0439aa6dffc [file] [log] [blame]
Paul Bakker4fc45522010-03-18 20:11:58 +00001/*
2 * Certificate reading application
3 *
Paul Bakker68884e32013-01-07 18:20:04 +01004 * Copyright (C) 2006-2013, Brainspark B.V.
Paul Bakkerb96f1542010-07-18 20:36:00 +00005 *
6 * This file is part of PolarSSL (http://www.polarssl.org)
Paul Bakker84f12b72010-07-18 10:13:04 +00007 * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
Paul Bakkerb96f1542010-07-18 20:36:00 +00008 *
Paul Bakker4fc45522010-03-18 20:11:58 +00009 * All rights reserved.
10 *
Paul Bakker4fc45522010-03-18 20:11:58 +000011 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License along
22 * with this program; if not, write to the Free Software Foundation, Inc.,
23 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 */
25
Manuel Pégourié-Gonnardabd6e022013-09-20 13:30:43 +020026#include "polarssl/config.h"
Paul Bakker4fc45522010-03-18 20:11:58 +000027
28#include <string.h>
29#include <stdlib.h>
30#include <stdio.h>
31
Paul Bakker508ad5a2011-12-04 17:09:26 +000032#include "polarssl/entropy.h"
33#include "polarssl/ctr_drbg.h"
Paul Bakker4fc45522010-03-18 20:11:58 +000034#include "polarssl/net.h"
35#include "polarssl/ssl.h"
36#include "polarssl/x509.h"
37
Paul Bakker80d44fe2013-09-09 15:59:20 +020038#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_ENTROPY_C) || \
39 !defined(POLARSSL_SSL_TLS_C) || !defined(POLARSSL_SSL_CLI_C) || \
40 !defined(POLARSSL_NET_C) || !defined(POLARSSL_RSA_C) || \
Paul Bakker7c6b2c32013-09-16 13:49:26 +020041 !defined(POLARSSL_X509_CRT_PARSE_C) || !defined(POLARSSL_FS_IO) || \
Paul Bakker80d44fe2013-09-09 15:59:20 +020042 !defined(POLARSSL_CTR_DRBG_C)
43int main( int argc, char *argv[] )
44{
45 ((void) argc);
46 ((void) argv);
47
48 printf("POLARSSL_BIGNUM_C and/or POLARSSL_ENTROPY_C and/or "
49 "POLARSSL_SSL_TLS_C and/or POLARSSL_SSL_CLI_C and/or "
50 "POLARSSL_NET_C and/or POLARSSL_RSA_C and/or "
Paul Bakker7c6b2c32013-09-16 13:49:26 +020051 "POLARSSL_X509_CRT_PARSE_C and/or POLARSSL_FS_IO and/or "
Paul Bakker80d44fe2013-09-09 15:59:20 +020052 "POLARSSL_CTR_DRBG_C not defined.\n");
53 return( 0 );
54}
55#else
56
Paul Bakker4fc45522010-03-18 20:11:58 +000057#define MODE_NONE 0
58#define MODE_FILE 1
59#define MODE_SSL 2
60
61#define DFL_MODE MODE_NONE
62#define DFL_FILENAME "cert.crt"
Paul Bakker777a5752013-05-21 16:20:04 +020063#define DFL_CA_FILE ""
64#define DFL_CA_PATH ""
Paul Bakker4fc45522010-03-18 20:11:58 +000065#define DFL_SERVER_NAME "localhost"
66#define DFL_SERVER_PORT 4433
67#define DFL_DEBUG_LEVEL 0
Paul Bakker6c0ceb32011-12-04 12:24:18 +000068#define DFL_PERMISSIVE 0
Paul Bakker4fc45522010-03-18 20:11:58 +000069
70/*
71 * global options
72 */
73struct options
74{
75 int mode; /* the mode to run the application in */
Paul Bakkeref3f8c72013-06-24 13:01:08 +020076 const char *filename; /* filename of the certificate file */
77 const char *ca_file; /* the file with the CA certificate(s) */
78 const char *ca_path; /* the path with the CA certificate(s) reside */
79 const char *server_name; /* hostname of the server (client only) */
Paul Bakker4fc45522010-03-18 20:11:58 +000080 int server_port; /* port on which the ssl service runs */
81 int debug_level; /* level of debugging */
Paul Bakker6c0ceb32011-12-04 12:24:18 +000082 int permissive; /* permissive parsing */
Paul Bakker4fc45522010-03-18 20:11:58 +000083} opt;
84
Paul Bakker3c5ef712013-06-25 16:37:45 +020085static void my_debug( void *ctx, int level, const char *str )
Paul Bakker4fc45522010-03-18 20:11:58 +000086{
87 if( level < opt.debug_level )
88 {
89 fprintf( (FILE *) ctx, "%s", str );
90 fflush( (FILE *) ctx );
91 }
92}
93
Paul Bakkerc559c7a2013-09-18 14:13:26 +020094static int my_verify( void *data, x509_crt *crt, int depth, int *flags )
Paul Bakker777a5752013-05-21 16:20:04 +020095{
96 char buf[1024];
97 ((void) data);
98
99 printf( "\nVerify requested for (Depth %d):\n", depth );
Paul Bakkerddf26b42013-09-18 13:46:23 +0200100 x509_crt_info( buf, sizeof( buf ) - 1, "", crt );
Paul Bakker777a5752013-05-21 16:20:04 +0200101 printf( "%s", buf );
102
103 if( ( (*flags) & BADCERT_EXPIRED ) != 0 )
104 printf( " ! server certificate has expired\n" );
105
106 if( ( (*flags) & BADCERT_REVOKED ) != 0 )
107 printf( " ! server certificate has been revoked\n" );
108
109 if( ( (*flags) & BADCERT_CN_MISMATCH ) != 0 )
110 printf( " ! CN mismatch\n" );
111
112 if( ( (*flags) & BADCERT_NOT_TRUSTED ) != 0 )
113 printf( " ! self-signed or not signed by a trusted CA\n" );
114
115 if( ( (*flags) & BADCRL_NOT_TRUSTED ) != 0 )
116 printf( " ! CRL not trusted\n" );
117
118 if( ( (*flags) & BADCRL_EXPIRED ) != 0 )
119 printf( " ! CRL expired\n" );
120
121 if( ( (*flags) & BADCERT_OTHER ) != 0 )
122 printf( " ! other (unknown) flag\n" );
123
124 if ( ( *flags ) == 0 )
125 printf( " This certificate has no flags\n" );
126
127 return( 0 );
128}
129
130#define USAGE_IO \
131 " ca_file=%%s The single file containing the top-level CA(s) you fully trust\n" \
132 " default: \"\" (none)\n" \
133 " ca_path=%%s The path containing the top-level CA(s) you fully trust\n" \
134 " default: \"\" (none) (overrides ca_file)\n"
135
Paul Bakker4fc45522010-03-18 20:11:58 +0000136#define USAGE \
137 "\n usage: cert_app param=<>...\n" \
138 "\n acceptable parameters:\n" \
Paul Bakker777a5752013-05-21 16:20:04 +0200139 " mode=file|ssl default: none\n" \
Paul Bakker4fc45522010-03-18 20:11:58 +0000140 " filename=%%s default: cert.crt\n" \
Paul Bakker777a5752013-05-21 16:20:04 +0200141 USAGE_IO \
Paul Bakker4fc45522010-03-18 20:11:58 +0000142 " server_name=%%s default: localhost\n" \
143 " server_port=%%d default: 4433\n" \
144 " debug_level=%%d default: 0 (disabled)\n" \
Paul Bakker6c0ceb32011-12-04 12:24:18 +0000145 " permissive=%%d default: 0 (disabled)\n" \
Paul Bakker4fc45522010-03-18 20:11:58 +0000146 "\n"
147
148int main( int argc, char *argv[] )
149{
150 int ret = 0, server_fd;
151 unsigned char buf[1024];
Paul Bakker508ad5a2011-12-04 17:09:26 +0000152 entropy_context entropy;
153 ctr_drbg_context ctr_drbg;
Paul Bakker4fc45522010-03-18 20:11:58 +0000154 ssl_context ssl;
Paul Bakkerc559c7a2013-09-18 14:13:26 +0200155 x509_crt cacert;
156 x509_crt clicert;
Manuel Pégourié-Gonnardac755232013-08-19 14:10:16 +0200157 pk_context pkey;
Paul Bakker36713e82013-09-17 13:25:29 +0200158 int i, j;
Paul Bakker777a5752013-05-21 16:20:04 +0200159 int flags, verify = 0;
Paul Bakker4fc45522010-03-18 20:11:58 +0000160 char *p, *q;
Paul Bakkeref3f8c72013-06-24 13:01:08 +0200161 const char *pers = "cert_app";
Paul Bakker4fc45522010-03-18 20:11:58 +0000162
Paul Bakker1a207ec2011-02-06 13:22:40 +0000163 /*
164 * Set to sane values
165 */
166 server_fd = 0;
Paul Bakker369d2eb2013-09-18 11:58:25 +0200167 x509_crt_init( &cacert );
168 x509_crt_init( &clicert );
Manuel Pégourié-Gonnardac755232013-08-19 14:10:16 +0200169 pk_init( &pkey );
Paul Bakker1a207ec2011-02-06 13:22:40 +0000170
Paul Bakker4fc45522010-03-18 20:11:58 +0000171 if( argc == 0 )
172 {
173 usage:
174 printf( USAGE );
175 goto exit;
176 }
177
178 opt.mode = DFL_MODE;
179 opt.filename = DFL_FILENAME;
Paul Bakker777a5752013-05-21 16:20:04 +0200180 opt.ca_file = DFL_CA_FILE;
181 opt.ca_path = DFL_CA_PATH;
Paul Bakker4fc45522010-03-18 20:11:58 +0000182 opt.server_name = DFL_SERVER_NAME;
183 opt.server_port = DFL_SERVER_PORT;
184 opt.debug_level = DFL_DEBUG_LEVEL;
Paul Bakker6c0ceb32011-12-04 12:24:18 +0000185 opt.permissive = DFL_PERMISSIVE;
Paul Bakker4fc45522010-03-18 20:11:58 +0000186
187 for( i = 1; i < argc; i++ )
188 {
Paul Bakker4fc45522010-03-18 20:11:58 +0000189 p = argv[i];
190 if( ( q = strchr( p, '=' ) ) == NULL )
191 goto usage;
192 *q++ = '\0';
193
Paul Bakkerace02862013-09-16 21:40:34 +0200194 for( j = 0; p + j < q; j++ )
195 {
196 if( argv[i][j] >= 'A' && argv[i][j] <= 'Z' )
197 argv[i][j] |= 0x20;
198 }
199
Paul Bakker4fc45522010-03-18 20:11:58 +0000200 if( strcmp( p, "mode" ) == 0 )
201 {
202 if( strcmp( q, "file" ) == 0 )
203 opt.mode = MODE_FILE;
204 else if( strcmp( q, "ssl" ) == 0 )
205 opt.mode = MODE_SSL;
206 else
207 goto usage;
208 }
209 else if( strcmp( p, "filename" ) == 0 )
210 opt.filename = q;
Paul Bakker777a5752013-05-21 16:20:04 +0200211 else if( strcmp( p, "ca_file" ) == 0 )
212 opt.ca_file = q;
213 else if( strcmp( p, "ca_path" ) == 0 )
214 opt.ca_path = q;
Paul Bakker4fc45522010-03-18 20:11:58 +0000215 else if( strcmp( p, "server_name" ) == 0 )
216 opt.server_name = q;
217 else if( strcmp( p, "server_port" ) == 0 )
218 {
219 opt.server_port = atoi( q );
220 if( opt.server_port < 1 || opt.server_port > 65535 )
221 goto usage;
222 }
223 else if( strcmp( p, "debug_level" ) == 0 )
224 {
225 opt.debug_level = atoi( q );
226 if( opt.debug_level < 0 || opt.debug_level > 65535 )
227 goto usage;
228 }
Paul Bakker6c0ceb32011-12-04 12:24:18 +0000229 else if( strcmp( p, "permissive" ) == 0 )
230 {
231 opt.permissive = atoi( q );
232 if( opt.permissive < 0 || opt.permissive > 1 )
233 goto usage;
234 }
Paul Bakker4fc45522010-03-18 20:11:58 +0000235 else
236 goto usage;
237 }
238
Paul Bakker777a5752013-05-21 16:20:04 +0200239 /*
240 * 1.1. Load the trusted CA
241 */
242 printf( " . Loading the CA root certificate ..." );
243 fflush( stdout );
244
245 if( strlen( opt.ca_path ) )
246 {
Paul Bakkerddf26b42013-09-18 13:46:23 +0200247 ret = x509_crt_parse_path( &cacert, opt.ca_path );
Paul Bakker777a5752013-05-21 16:20:04 +0200248 verify = 1;
249 }
250 else if( strlen( opt.ca_file ) )
251 {
Paul Bakkerddf26b42013-09-18 13:46:23 +0200252 ret = x509_crt_parse_file( &cacert, opt.ca_file );
Paul Bakker777a5752013-05-21 16:20:04 +0200253 verify = 1;
254 }
255
256 if( ret < 0 )
257 {
Paul Bakkerddf26b42013-09-18 13:46:23 +0200258 printf( " failed\n ! x509_crt_parse returned -0x%x\n\n", -ret );
Paul Bakker777a5752013-05-21 16:20:04 +0200259 goto exit;
260 }
261
262 printf( " ok (%d skipped)\n", ret );
263
Paul Bakker4fc45522010-03-18 20:11:58 +0000264 if( opt.mode == MODE_FILE )
265 {
Paul Bakkerc559c7a2013-09-18 14:13:26 +0200266 x509_crt crt;
267 x509_crt *cur = &crt;
Paul Bakker369d2eb2013-09-18 11:58:25 +0200268 x509_crt_init( &crt );
Paul Bakker4fc45522010-03-18 20:11:58 +0000269
270 /*
Paul Bakker14cb63a2011-11-25 12:44:31 +0000271 * 1.1. Load the certificate(s)
Paul Bakker4fc45522010-03-18 20:11:58 +0000272 */
Paul Bakker14cb63a2011-11-25 12:44:31 +0000273 printf( "\n . Loading the certificate(s) ..." );
Paul Bakker4fc45522010-03-18 20:11:58 +0000274 fflush( stdout );
275
Paul Bakkerddf26b42013-09-18 13:46:23 +0200276 ret = x509_crt_parse_file( &crt, opt.filename );
Paul Bakker4fc45522010-03-18 20:11:58 +0000277
Paul Bakker69e095c2011-12-10 21:55:01 +0000278 if( ret < 0 )
Paul Bakker4fc45522010-03-18 20:11:58 +0000279 {
Paul Bakkerddf26b42013-09-18 13:46:23 +0200280 printf( " failed\n ! x509_crt_parse_file returned %d\n\n", ret );
Paul Bakker7c6b2c32013-09-16 13:49:26 +0200281 x509_crt_free( &crt );
Paul Bakker4fc45522010-03-18 20:11:58 +0000282 goto exit;
283 }
284
Paul Bakker69e095c2011-12-10 21:55:01 +0000285 if( opt.permissive == 0 && ret > 0 )
286 {
Paul Bakkerddf26b42013-09-18 13:46:23 +0200287 printf( " failed\n ! x509_crt_parse failed to parse %d certificates\n\n", ret );
Paul Bakker7c6b2c32013-09-16 13:49:26 +0200288 x509_crt_free( &crt );
Paul Bakker69e095c2011-12-10 21:55:01 +0000289 goto exit;
290 }
291
Paul Bakker4fc45522010-03-18 20:11:58 +0000292 printf( " ok\n" );
293
294 /*
Paul Bakker14cb63a2011-11-25 12:44:31 +0000295 * 1.2 Print the certificate(s)
Paul Bakker4fc45522010-03-18 20:11:58 +0000296 */
Paul Bakker14cb63a2011-11-25 12:44:31 +0000297 while( cur != NULL )
Paul Bakker4fc45522010-03-18 20:11:58 +0000298 {
Paul Bakker14cb63a2011-11-25 12:44:31 +0000299 printf( " . Peer certificate information ...\n" );
Paul Bakkerddf26b42013-09-18 13:46:23 +0200300 ret = x509_crt_info( (char *) buf, sizeof( buf ) - 1, " ",
301 cur );
Paul Bakker14cb63a2011-11-25 12:44:31 +0000302 if( ret == -1 )
303 {
Paul Bakkerddf26b42013-09-18 13:46:23 +0200304 printf( " failed\n ! x509_crt_info returned %d\n\n", ret );
Paul Bakker7c6b2c32013-09-16 13:49:26 +0200305 x509_crt_free( &crt );
Paul Bakker14cb63a2011-11-25 12:44:31 +0000306 goto exit;
307 }
Paul Bakker4fc45522010-03-18 20:11:58 +0000308
Paul Bakker14cb63a2011-11-25 12:44:31 +0000309 printf( "%s\n", buf );
310
311 cur = cur->next;
312 }
Paul Bakker4fc45522010-03-18 20:11:58 +0000313
Paul Bakker777a5752013-05-21 16:20:04 +0200314 /*
315 * 1.3 Verify the certificate
316 */
317 if( verify )
318 {
319 printf( " . Verifying X.509 certificate..." );
320
Paul Bakkerddf26b42013-09-18 13:46:23 +0200321 if( ( ret = x509_crt_verify( &crt, &cacert, NULL, NULL, &flags,
322 my_verify, NULL ) ) != 0 )
Paul Bakker777a5752013-05-21 16:20:04 +0200323 {
324 printf( " failed\n" );
325
326 if( ( ret & BADCERT_EXPIRED ) != 0 )
327 printf( " ! server certificate has expired\n" );
328
329 if( ( ret & BADCERT_REVOKED ) != 0 )
330 printf( " ! server certificate has been revoked\n" );
331
332 if( ( ret & BADCERT_CN_MISMATCH ) != 0 )
333 printf( " ! CN mismatch (expected CN=%s)\n", opt.server_name );
334
335 if( ( ret & BADCERT_NOT_TRUSTED ) != 0 )
336 printf( " ! self-signed or not signed by a trusted CA\n" );
337
338 printf( "\n" );
339 }
340 else
341 printf( " ok\n" );
342 }
343
Paul Bakker7c6b2c32013-09-16 13:49:26 +0200344 x509_crt_free( &crt );
Paul Bakker4fc45522010-03-18 20:11:58 +0000345 }
346 else if( opt.mode == MODE_SSL )
347 {
348 /*
349 * 1. Initialize the RNG and the session data
350 */
Paul Bakker508ad5a2011-12-04 17:09:26 +0000351 printf( "\n . Seeding the random number generator..." );
352 fflush( stdout );
353
354 entropy_init( &entropy );
355 if( ( ret = ctr_drbg_init( &ctr_drbg, entropy_func, &entropy,
Paul Bakkeref3f8c72013-06-24 13:01:08 +0200356 (const unsigned char *) pers,
357 strlen( pers ) ) ) != 0 )
Paul Bakker508ad5a2011-12-04 17:09:26 +0000358 {
359 printf( " failed\n ! ctr_drbg_init returned %d\n", ret );
360 goto exit;
361 }
Paul Bakker4fc45522010-03-18 20:11:58 +0000362
Paul Bakker777a5752013-05-21 16:20:04 +0200363 printf( " ok\n" );
364
Paul Bakker4fc45522010-03-18 20:11:58 +0000365 /*
366 * 2. Start the connection
367 */
368 printf( " . SSL connection to tcp/%s/%-4d...", opt.server_name,
369 opt.server_port );
370 fflush( stdout );
371
372 if( ( ret = net_connect( &server_fd, opt.server_name,
373 opt.server_port ) ) != 0 )
374 {
375 printf( " failed\n ! net_connect returned %d\n\n", ret );
376 goto exit;
377 }
378
379 /*
380 * 3. Setup stuff
381 */
382 if( ( ret = ssl_init( &ssl ) ) != 0 )
383 {
384 printf( " failed\n ! ssl_init returned %d\n\n", ret );
385 goto exit;
386 }
387
388 ssl_set_endpoint( &ssl, SSL_IS_CLIENT );
Paul Bakker777a5752013-05-21 16:20:04 +0200389 if( verify )
390 {
391 ssl_set_authmode( &ssl, SSL_VERIFY_REQUIRED );
392 ssl_set_ca_chain( &ssl, &cacert, NULL, opt.server_name );
393 ssl_set_verify( &ssl, my_verify, NULL );
394 }
395 else
396 ssl_set_authmode( &ssl, SSL_VERIFY_NONE );
Paul Bakker4fc45522010-03-18 20:11:58 +0000397
Paul Bakker508ad5a2011-12-04 17:09:26 +0000398 ssl_set_rng( &ssl, ctr_drbg_random, &ctr_drbg );
Paul Bakker4fc45522010-03-18 20:11:58 +0000399 ssl_set_dbg( &ssl, my_debug, stdout );
400 ssl_set_bio( &ssl, net_recv, &server_fd,
401 net_send, &server_fd );
402
Manuel Pégourié-Gonnardac755232013-08-19 14:10:16 +0200403 ssl_set_own_cert( &ssl, &clicert, &pkey );
Paul Bakker4fc45522010-03-18 20:11:58 +0000404
Manuel Pégourié-Gonnarda7496f02013-09-20 11:29:59 +0200405#if defined(POLARSSL_SSL_SERVER_NAME_INDICATION)
Paul Bakker4fc45522010-03-18 20:11:58 +0000406 ssl_set_hostname( &ssl, opt.server_name );
Manuel Pégourié-Gonnarda7496f02013-09-20 11:29:59 +0200407#endif
Paul Bakker4fc45522010-03-18 20:11:58 +0000408
409 /*
410 * 4. Handshake
411 */
412 while( ( ret = ssl_handshake( &ssl ) ) != 0 )
413 {
Paul Bakker831a7552011-05-18 13:32:51 +0000414 if( ret != POLARSSL_ERR_NET_WANT_READ && ret != POLARSSL_ERR_NET_WANT_WRITE )
Paul Bakker4fc45522010-03-18 20:11:58 +0000415 {
416 printf( " failed\n ! ssl_handshake returned %d\n\n", ret );
Paul Bakker9a736322012-11-14 12:39:52 +0000417 ssl_free( &ssl );
Paul Bakker4fc45522010-03-18 20:11:58 +0000418 goto exit;
419 }
420 }
421
422 printf( " ok\n" );
423
424 /*
425 * 5. Print the certificate
426 */
427 printf( " . Peer certificate information ...\n" );
Paul Bakkerddf26b42013-09-18 13:46:23 +0200428 ret = x509_crt_info( (char *) buf, sizeof( buf ) - 1, " ",
429 ssl.session->peer_cert );
Paul Bakker4fc45522010-03-18 20:11:58 +0000430 if( ret == -1 )
431 {
Paul Bakkerddf26b42013-09-18 13:46:23 +0200432 printf( " failed\n ! x509_crt_info returned %d\n\n", ret );
Paul Bakker9a736322012-11-14 12:39:52 +0000433 ssl_free( &ssl );
Paul Bakker4fc45522010-03-18 20:11:58 +0000434 goto exit;
435 }
436
437 printf( "%s\n", buf );
438
439 ssl_close_notify( &ssl );
Paul Bakker9a736322012-11-14 12:39:52 +0000440 ssl_free( &ssl );
Paul Bakker4fc45522010-03-18 20:11:58 +0000441 }
442 else
443 goto usage;
444
445exit:
446
Paul Bakker1a207ec2011-02-06 13:22:40 +0000447 if( server_fd )
448 net_close( server_fd );
Paul Bakker7c6b2c32013-09-16 13:49:26 +0200449 x509_crt_free( &cacert );
450 x509_crt_free( &clicert );
Manuel Pégourié-Gonnardac755232013-08-19 14:10:16 +0200451 pk_free( &pkey );
Paul Bakker4fc45522010-03-18 20:11:58 +0000452
Paul Bakkercce9d772011-11-18 14:26:47 +0000453#if defined(_WIN32)
Paul Bakker4fc45522010-03-18 20:11:58 +0000454 printf( " + Press Enter to exit this program.\n" );
455 fflush( stdout ); getchar();
456#endif
457
458 return( ret );
459}
Paul Bakker508ad5a2011-12-04 17:09:26 +0000460#endif /* POLARSSL_BIGNUM_C && POLARSSL_ENTROPY_C && POLARSSL_SSL_TLS_C &&
Paul Bakker5690efc2011-05-26 13:16:06 +0000461 POLARSSL_SSL_CLI_C && POLARSSL_NET_C && POLARSSL_RSA_C &&
Paul Bakker36713e82013-09-17 13:25:29 +0200462 POLARSSL_X509_CRT_PARSE_C && POLARSSL_FS_IO && POLARSSL_CTR_DRBG_C */