blob: 451b1a8741d691e60ee4d96ac7ec26bb07dba3e4 [file] [log] [blame]
Paul Bakker896ac222011-05-20 12:33:05 +00001/*
Paul Bakkercb79ae0b2011-05-20 12:44:16 +00002 * SSL server demonstration program using fork() for handling multiple clients
Paul Bakker896ac222011-05-20 12:33:05 +00003 *
Manuel Pégourié-Gonnarda658a402015-01-23 09:45:19 +00004 * Copyright (C) 2006-2013, ARM Limited, All Rights Reserved
Paul Bakker896ac222011-05-20 12:33:05 +00005 *
Manuel Pégourié-Gonnardfe446432015-03-06 13:17:10 +00006 * This file is part of mbed TLS (https://tls.mbed.org)
Paul Bakker896ac222011-05-20 12:33:05 +00007 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 */
22
Manuel Pégourié-Gonnardcef4ad22014-04-29 12:39:06 +020023#if !defined(POLARSSL_CONFIG_FILE)
Manuel Pégourié-Gonnard7f809972015-03-09 17:05:11 +000024#include "mbedtls/config.h"
Manuel Pégourié-Gonnardcef4ad22014-04-29 12:39:06 +020025#else
26#include POLARSSL_CONFIG_FILE
27#endif
Paul Bakker896ac222011-05-20 12:33:05 +000028
Rich Evansf90016a2015-01-19 14:26:37 +000029#if defined(POLARSSL_PLATFORM_C)
Manuel Pégourié-Gonnard7f809972015-03-09 17:05:11 +000030#include "mbedtls/platform.h"
Rich Evansf90016a2015-01-19 14:26:37 +000031#else
Rich Evans18b78c72015-02-11 14:06:19 +000032#include <stdio.h>
Rich Evansf90016a2015-01-19 14:26:37 +000033#define polarssl_fprintf fprintf
Rich Evans18b78c72015-02-11 14:06:19 +000034#define polarssl_printf printf
Rich Evansf90016a2015-01-19 14:26:37 +000035#endif
36
Paul Bakkerb892b132011-10-12 09:19:43 +000037#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_CERTS_C) || \
Paul Bakker508ad5a2011-12-04 17:09:26 +000038 !defined(POLARSSL_ENTROPY_C) || !defined(POLARSSL_SSL_TLS_C) || \
Paul Bakkerb892b132011-10-12 09:19:43 +000039 !defined(POLARSSL_SSL_SRV_C) || !defined(POLARSSL_NET_C) || \
Paul Bakkered27a042013-04-18 22:46:23 +020040 !defined(POLARSSL_RSA_C) || !defined(POLARSSL_CTR_DRBG_C) || \
Manuel Pégourié-Gonnard013bffe2015-02-13 14:09:44 +000041 !defined(POLARSSL_X509_CRT_PARSE_C) || !defined(POLARSSL_TIMING_C) || \
Manuel Pégourié-Gonnard4b3e5ef2015-03-27 11:24:27 +010042 !defined(POLARSSL_FS_IO) || !defined(POLARSSL_PEM_PARSE_C)
Paul Bakkercce9d772011-11-18 14:26:47 +000043int main( int argc, char *argv[] )
Paul Bakkerb892b132011-10-12 09:19:43 +000044{
Paul Bakkercce9d772011-11-18 14:26:47 +000045 ((void) argc);
46 ((void) argv);
47
Rich Evansf90016a2015-01-19 14:26:37 +000048 polarssl_printf("POLARSSL_BIGNUM_C and/or POLARSSL_CERTS_C and/or POLARSSL_ENTROPY_C "
Paul Bakkerb892b132011-10-12 09:19:43 +000049 "and/or POLARSSL_SSL_TLS_C and/or POLARSSL_SSL_SRV_C and/or "
Paul Bakker508ad5a2011-12-04 17:09:26 +000050 "POLARSSL_NET_C and/or POLARSSL_RSA_C and/or "
Paul Bakker36713e82013-09-17 13:25:29 +020051 "POLARSSL_CTR_DRBG_C and/or POLARSSL_X509_CRT_PARSE_C and/or "
Manuel Pégourié-Gonnardb5410db2015-03-27 11:08:49 +010052 "POLARSSL_TIMING_C and/or POLARSSL_PEM_PARSE_C not defined.\n");
Paul Bakkerb892b132011-10-12 09:19:43 +000053 return( 0 );
54}
Paul Bakkercce9d772011-11-18 14:26:47 +000055#elif defined(_WIN32)
Rich Evans85b05ec2015-02-12 11:37:29 +000056int main( void )
Paul Bakkerb892b132011-10-12 09:19:43 +000057{
Rich Evansf90016a2015-01-19 14:26:37 +000058 polarssl_printf("_WIN32 defined. This application requires fork() and signals "
Paul Bakkerb892b132011-10-12 09:19:43 +000059 "to work correctly.\n");
60 return( 0 );
61}
62#else
Paul Bakker896ac222011-05-20 12:33:05 +000063
Manuel Pégourié-Gonnard4b3e5ef2015-03-27 11:24:27 +010064#include "mbedtls/entropy.h"
65#include "mbedtls/ctr_drbg.h"
66#include "mbedtls/certs.h"
67#include "mbedtls/x509.h"
68#include "mbedtls/ssl.h"
69#include "mbedtls/net.h"
70#include "mbedtls/timing.h"
71
72#include <string.h>
73#include <signal.h>
74
75#if !defined(_MSC_VER) || defined(EFIX64) || defined(EFI32)
76#include <unistd.h>
77#endif
78
79#define HTTP_RESPONSE \
80 "HTTP/1.0 200 OK\r\nContent-Type: text/html\r\n\r\n" \
81 "<h2>mbed TLS Test Server</h2>\r\n" \
82 "<p>Successful connection using: %s</p>\r\n"
83
Paul Bakker896ac222011-05-20 12:33:05 +000084#define DEBUG_LEVEL 0
85
Paul Bakker3c5ef712013-06-25 16:37:45 +020086static void my_debug( void *ctx, int level, const char *str )
Paul Bakker896ac222011-05-20 12:33:05 +000087{
88 if( level < DEBUG_LEVEL )
89 {
Rich Evansf90016a2015-01-19 14:26:37 +000090 polarssl_fprintf( (FILE *) ctx, "%s", str );
Paul Bakker896ac222011-05-20 12:33:05 +000091 fflush( (FILE *) ctx );
92 }
93}
94
Rich Evans85b05ec2015-02-12 11:37:29 +000095int main( void )
Paul Bakker896ac222011-05-20 12:33:05 +000096{
97 int ret, len, cnt = 0, pid;
98 int listen_fd;
Manuel Pégourié-Gonnard68821da2013-09-16 12:34:33 +020099 int client_fd = -1;
Paul Bakker896ac222011-05-20 12:33:05 +0000100 unsigned char buf[1024];
Paul Bakkeref3f8c72013-06-24 13:01:08 +0200101 const char *pers = "ssl_fork_server";
Paul Bakker896ac222011-05-20 12:33:05 +0000102
Paul Bakker508ad5a2011-12-04 17:09:26 +0000103 entropy_context entropy;
104 ctr_drbg_context ctr_drbg;
Paul Bakker896ac222011-05-20 12:33:05 +0000105 ssl_context ssl;
Paul Bakkerc559c7a2013-09-18 14:13:26 +0200106 x509_crt srvcert;
Manuel Pégourié-Gonnardac755232013-08-19 14:10:16 +0200107 pk_context pkey;
Paul Bakker896ac222011-05-20 12:33:05 +0000108
Paul Bakker0c226102014-04-17 16:02:36 +0200109 memset( &ssl, 0, sizeof(ssl_context) );
110
111 entropy_init( &entropy );
112 pk_init( &pkey );
113 x509_crt_init( &srvcert );
114
Paul Bakker896ac222011-05-20 12:33:05 +0000115 signal( SIGCHLD, SIG_IGN );
116
117 /*
Paul Bakker508ad5a2011-12-04 17:09:26 +0000118 * 0. Initial seeding of the RNG
119 */
Rich Evansf90016a2015-01-19 14:26:37 +0000120 polarssl_printf( "\n . Initial seeding of the random generator..." );
Paul Bakker508ad5a2011-12-04 17:09:26 +0000121 fflush( stdout );
122
Paul Bakker508ad5a2011-12-04 17:09:26 +0000123 if( ( ret = ctr_drbg_init( &ctr_drbg, entropy_func, &entropy,
Paul Bakkeref3f8c72013-06-24 13:01:08 +0200124 (const unsigned char *) pers,
125 strlen( pers ) ) ) != 0 )
Paul Bakker508ad5a2011-12-04 17:09:26 +0000126 {
Rich Evansf90016a2015-01-19 14:26:37 +0000127 polarssl_printf( " failed\n ! ctr_drbg_init returned %d\n", ret );
Paul Bakker508ad5a2011-12-04 17:09:26 +0000128 goto exit;
129 }
130
Rich Evansf90016a2015-01-19 14:26:37 +0000131 polarssl_printf( " ok\n" );
Paul Bakker508ad5a2011-12-04 17:09:26 +0000132
133 /*
Paul Bakker896ac222011-05-20 12:33:05 +0000134 * 1. Load the certificates and private RSA key
135 */
Rich Evansf90016a2015-01-19 14:26:37 +0000136 polarssl_printf( " . Loading the server cert. and key..." );
Paul Bakker896ac222011-05-20 12:33:05 +0000137 fflush( stdout );
138
Paul Bakker896ac222011-05-20 12:33:05 +0000139 /*
140 * This demonstration program uses embedded test certificates.
Paul Bakkerddf26b42013-09-18 13:46:23 +0200141 * Instead, you may want to use x509_crt_parse_file() to read the
142 * server and CA certificates, as well as pk_parse_keyfile().
Paul Bakker896ac222011-05-20 12:33:05 +0000143 */
Paul Bakkerddf26b42013-09-18 13:46:23 +0200144 ret = x509_crt_parse( &srvcert, (const unsigned char *) test_srv_crt,
Manuel Pégourié-Gonnard75f90102015-03-27 09:56:18 +0100145 test_srv_crt_len );
Paul Bakker896ac222011-05-20 12:33:05 +0000146 if( ret != 0 )
147 {
Rich Evansf90016a2015-01-19 14:26:37 +0000148 polarssl_printf( " failed\n ! x509_crt_parse returned %d\n\n", ret );
Paul Bakker896ac222011-05-20 12:33:05 +0000149 goto exit;
150 }
151
Manuel Pégourié-Gonnarda958d692015-03-27 10:23:53 +0100152 ret = x509_crt_parse( &srvcert, (const unsigned char *) test_cas_pem,
153 test_cas_pem_len );
Paul Bakker896ac222011-05-20 12:33:05 +0000154 if( ret != 0 )
155 {
Rich Evansf90016a2015-01-19 14:26:37 +0000156 polarssl_printf( " failed\n ! x509_crt_parse returned %d\n\n", ret );
Paul Bakker896ac222011-05-20 12:33:05 +0000157 goto exit;
158 }
159
Paul Bakker1a7550a2013-09-15 13:01:22 +0200160 ret = pk_parse_key( &pkey, (const unsigned char *) test_srv_key,
Manuel Pégourié-Gonnard75f90102015-03-27 09:56:18 +0100161 test_srv_key_len, NULL, 0 );
Paul Bakker896ac222011-05-20 12:33:05 +0000162 if( ret != 0 )
163 {
Rich Evansf90016a2015-01-19 14:26:37 +0000164 polarssl_printf( " failed\n ! pk_parse_key returned %d\n\n", ret );
Paul Bakker896ac222011-05-20 12:33:05 +0000165 goto exit;
166 }
167
Rich Evansf90016a2015-01-19 14:26:37 +0000168 polarssl_printf( " ok\n" );
Paul Bakker896ac222011-05-20 12:33:05 +0000169
170 /*
171 * 2. Setup the listening TCP socket
172 */
Rich Evansf90016a2015-01-19 14:26:37 +0000173 polarssl_printf( " . Bind on https://localhost:4433/ ..." );
Paul Bakker896ac222011-05-20 12:33:05 +0000174 fflush( stdout );
175
Manuel Pégourié-Gonnardf5a13122014-03-23 17:38:16 +0100176 if( ( ret = net_bind( &listen_fd, NULL, 4433, NET_PROTO_TCP ) ) != 0 )
Paul Bakker896ac222011-05-20 12:33:05 +0000177 {
Rich Evansf90016a2015-01-19 14:26:37 +0000178 polarssl_printf( " failed\n ! net_bind returned %d\n\n", ret );
Paul Bakker896ac222011-05-20 12:33:05 +0000179 goto exit;
180 }
181
Rich Evansf90016a2015-01-19 14:26:37 +0000182 polarssl_printf( " ok\n" );
Paul Bakker896ac222011-05-20 12:33:05 +0000183
184 while( 1 )
185 {
186 /*
187 * 3. Wait until a client connects
188 */
189 client_fd = -1;
190 memset( &ssl, 0, sizeof( ssl ) );
191
Rich Evansf90016a2015-01-19 14:26:37 +0000192 polarssl_printf( " . Waiting for a remote connection ..." );
Paul Bakker896ac222011-05-20 12:33:05 +0000193 fflush( stdout );
194
195 if( ( ret = net_accept( listen_fd, &client_fd, NULL ) ) != 0 )
196 {
Rich Evansf90016a2015-01-19 14:26:37 +0000197 polarssl_printf( " failed\n ! net_accept returned %d\n\n", ret );
Paul Bakker896ac222011-05-20 12:33:05 +0000198 goto exit;
199 }
200
Rich Evansf90016a2015-01-19 14:26:37 +0000201 polarssl_printf( " ok\n" );
Paul Bakker896ac222011-05-20 12:33:05 +0000202
203 /*
204 * 3.5. Forking server thread
205 */
206
207 pid = fork();
208
Rich Evansf90016a2015-01-19 14:26:37 +0000209 polarssl_printf( " . Forking to handle connection ..." );
Paul Bakker896ac222011-05-20 12:33:05 +0000210 fflush( stdout );
211
212 if( pid < 0 )
213 {
Rich Evansf90016a2015-01-19 14:26:37 +0000214 polarssl_printf(" failed\n ! fork returned %d\n\n", pid );
Paul Bakker896ac222011-05-20 12:33:05 +0000215 goto exit;
216 }
217
Rich Evansf90016a2015-01-19 14:26:37 +0000218 polarssl_printf( " ok\n" );
Paul Bakker896ac222011-05-20 12:33:05 +0000219
220 if( pid != 0 )
221 {
Paul Bakker508ad5a2011-12-04 17:09:26 +0000222 if( ( ret = ctr_drbg_reseed( &ctr_drbg,
Paul Bakkeref3f8c72013-06-24 13:01:08 +0200223 (const unsigned char *) "parent",
224 6 ) ) != 0 )
Paul Bakker508ad5a2011-12-04 17:09:26 +0000225 {
Rich Evansf90016a2015-01-19 14:26:37 +0000226 polarssl_printf( " failed\n ! ctr_drbg_reseed returned %d\n", ret );
Paul Bakker508ad5a2011-12-04 17:09:26 +0000227 goto exit;
228 }
229
Paul Bakker896ac222011-05-20 12:33:05 +0000230 close( client_fd );
231 continue;
232 }
233
234 close( listen_fd );
235
236 /*
237 * 4. Setup stuff
238 */
Rich Evansf90016a2015-01-19 14:26:37 +0000239 polarssl_printf( " . Setting up the SSL data...." );
Paul Bakker896ac222011-05-20 12:33:05 +0000240 fflush( stdout );
241
Paul Bakker508ad5a2011-12-04 17:09:26 +0000242 if( ( ret = ctr_drbg_reseed( &ctr_drbg,
Paul Bakkeref3f8c72013-06-24 13:01:08 +0200243 (const unsigned char *) "child",
244 5 ) ) != 0 )
Paul Bakker508ad5a2011-12-04 17:09:26 +0000245 {
Rich Evansf90016a2015-01-19 14:26:37 +0000246 polarssl_printf( " failed\n ! ctr_drbg_reseed returned %d\n", ret );
Paul Bakker508ad5a2011-12-04 17:09:26 +0000247 goto exit;
248 }
Paul Bakker0c226102014-04-17 16:02:36 +0200249
Paul Bakker896ac222011-05-20 12:33:05 +0000250 if( ( ret = ssl_init( &ssl ) ) != 0 )
251 {
Rich Evansf90016a2015-01-19 14:26:37 +0000252 polarssl_printf( " failed\n ! ssl_init returned %d\n\n", ret );
Paul Bakker896ac222011-05-20 12:33:05 +0000253 goto exit;
254 }
255
Rich Evansf90016a2015-01-19 14:26:37 +0000256 polarssl_printf( " ok\n" );
Paul Bakker896ac222011-05-20 12:33:05 +0000257
258 ssl_set_endpoint( &ssl, SSL_IS_SERVER );
259 ssl_set_authmode( &ssl, SSL_VERIFY_NONE );
260
Manuel Pégourié-Gonnard448ea502015-01-12 11:40:14 +0100261 /* SSLv3 is deprecated, set minimum to TLS 1.0 */
262 ssl_set_min_version( &ssl, SSL_MAJOR_VERSION_3,
263 SSL_MINOR_VERSION_1 );
264
Paul Bakker508ad5a2011-12-04 17:09:26 +0000265 ssl_set_rng( &ssl, ctr_drbg_random, &ctr_drbg );
Paul Bakker896ac222011-05-20 12:33:05 +0000266 ssl_set_dbg( &ssl, my_debug, stdout );
Manuel Pégourié-Gonnardaeab2522015-03-25 19:38:23 +0100267 ssl_set_bio_timeout( &ssl, &client_fd, net_send, net_recv, NULL, 0 );
Paul Bakker896ac222011-05-20 12:33:05 +0000268
Paul Bakker896ac222011-05-20 12:33:05 +0000269 ssl_set_ca_chain( &ssl, srvcert.next, NULL, NULL );
Manuel Pégourié-Gonnardc5fd3912014-07-08 14:05:52 +0200270 if( ( ret = ssl_set_own_cert( &ssl, &srvcert, &pkey ) ) != 0 )
271 {
Rich Evansf90016a2015-01-19 14:26:37 +0000272 polarssl_printf( " failed\n ! ssl_set_own_cert returned %d\n\n", ret );
Manuel Pégourié-Gonnardc5fd3912014-07-08 14:05:52 +0200273 goto exit;
274 }
Paul Bakker896ac222011-05-20 12:33:05 +0000275
276 /*
277 * 5. Handshake
278 */
Rich Evansf90016a2015-01-19 14:26:37 +0000279 polarssl_printf( " . Performing the SSL/TLS handshake..." );
Paul Bakker896ac222011-05-20 12:33:05 +0000280 fflush( stdout );
281
282 while( ( ret = ssl_handshake( &ssl ) ) != 0 )
283 {
284 if( ret != POLARSSL_ERR_NET_WANT_READ && ret != POLARSSL_ERR_NET_WANT_WRITE )
285 {
Rich Evansf90016a2015-01-19 14:26:37 +0000286 polarssl_printf( " failed\n ! ssl_handshake returned %d\n\n", ret );
Paul Bakker896ac222011-05-20 12:33:05 +0000287 goto exit;
288 }
289 }
290
Rich Evansf90016a2015-01-19 14:26:37 +0000291 polarssl_printf( " ok\n" );
Paul Bakker896ac222011-05-20 12:33:05 +0000292
293 /*
294 * 6. Read the HTTP Request
295 */
Rich Evansf90016a2015-01-19 14:26:37 +0000296 polarssl_printf( " < Read from client:" );
Paul Bakker896ac222011-05-20 12:33:05 +0000297 fflush( stdout );
298
299 do
300 {
301 len = sizeof( buf ) - 1;
302 memset( buf, 0, sizeof( buf ) );
303 ret = ssl_read( &ssl, buf, len );
304
305 if( ret == POLARSSL_ERR_NET_WANT_READ || ret == POLARSSL_ERR_NET_WANT_WRITE )
306 continue;
307
308 if( ret <= 0 )
309 {
310 switch( ret )
311 {
312 case POLARSSL_ERR_SSL_PEER_CLOSE_NOTIFY:
Rich Evansf90016a2015-01-19 14:26:37 +0000313 polarssl_printf( " connection was closed gracefully\n" );
Paul Bakker896ac222011-05-20 12:33:05 +0000314 break;
315
316 case POLARSSL_ERR_NET_CONN_RESET:
Rich Evansf90016a2015-01-19 14:26:37 +0000317 polarssl_printf( " connection was reset by peer\n" );
Paul Bakker896ac222011-05-20 12:33:05 +0000318 break;
319
320 default:
Rich Evansf90016a2015-01-19 14:26:37 +0000321 polarssl_printf( " ssl_read returned %d\n", ret );
Paul Bakker896ac222011-05-20 12:33:05 +0000322 break;
323 }
324
325 break;
326 }
327
328 len = ret;
Rich Evansf90016a2015-01-19 14:26:37 +0000329 polarssl_printf( " %d bytes read\n\n%s", len, (char *) buf );
Manuel Pégourié-Gonnard401caad2015-02-14 15:53:24 +0000330
331 if( ret > 0 )
332 break;
Paul Bakker896ac222011-05-20 12:33:05 +0000333 }
Manuel Pégourié-Gonnard401caad2015-02-14 15:53:24 +0000334 while( 1 );
Paul Bakker896ac222011-05-20 12:33:05 +0000335
336 /*
337 * 7. Write the 200 Response
338 */
Rich Evansf90016a2015-01-19 14:26:37 +0000339 polarssl_printf( " > Write to client:" );
Paul Bakker896ac222011-05-20 12:33:05 +0000340 fflush( stdout );
341
342 len = sprintf( (char *) buf, HTTP_RESPONSE,
343 ssl_get_ciphersuite( &ssl ) );
344
Paul Bakker030decd2014-04-17 16:03:23 +0200345 while( cnt++ < 100 )
Paul Bakker896ac222011-05-20 12:33:05 +0000346 {
347 while( ( ret = ssl_write( &ssl, buf, len ) ) <= 0 )
348 {
349 if( ret == POLARSSL_ERR_NET_CONN_RESET )
350 {
Rich Evansf90016a2015-01-19 14:26:37 +0000351 polarssl_printf( " failed\n ! peer closed the connection\n\n" );
Paul Bakker896ac222011-05-20 12:33:05 +0000352 goto exit;
353 }
354
355 if( ret != POLARSSL_ERR_NET_WANT_READ && ret != POLARSSL_ERR_NET_WANT_WRITE )
356 {
Rich Evansf90016a2015-01-19 14:26:37 +0000357 polarssl_printf( " failed\n ! ssl_write returned %d\n\n", ret );
Paul Bakker896ac222011-05-20 12:33:05 +0000358 goto exit;
359 }
360 }
361 len = ret;
Rich Evansf90016a2015-01-19 14:26:37 +0000362 polarssl_printf( " %d bytes written\n\n%s\n", len, (char *) buf );
Paul Bakker896ac222011-05-20 12:33:05 +0000363
364 m_sleep( 1000 );
365 }
366
367 ssl_close_notify( &ssl );
368 goto exit;
369 }
370
371exit:
372
Paul Bakker0c226102014-04-17 16:02:36 +0200373 if( client_fd != -1 )
374 net_close( client_fd );
375
Paul Bakker36713e82013-09-17 13:25:29 +0200376 x509_crt_free( &srvcert );
Manuel Pégourié-Gonnardac755232013-08-19 14:10:16 +0200377 pk_free( &pkey );
Paul Bakker896ac222011-05-20 12:33:05 +0000378 ssl_free( &ssl );
Paul Bakkera317a982014-06-18 16:44:11 +0200379 ctr_drbg_free( &ctr_drbg );
Paul Bakker1ffefac2013-09-28 15:23:03 +0200380 entropy_free( &entropy );
Paul Bakker896ac222011-05-20 12:33:05 +0000381
Paul Bakkercce9d772011-11-18 14:26:47 +0000382#if defined(_WIN32)
Rich Evansf90016a2015-01-19 14:26:37 +0000383 polarssl_printf( " Press Enter to exit this program.\n" );
Paul Bakker896ac222011-05-20 12:33:05 +0000384 fflush( stdout ); getchar();
385#endif
386
387 return( ret );
388}
Paul Bakker508ad5a2011-12-04 17:09:26 +0000389#endif /* POLARSSL_BIGNUM_C && POLARSSL_CERTS_C && POLARSSL_ENTROPY_C &&
Paul Bakker5690efc2011-05-26 13:16:06 +0000390 POLARSSL_SSL_TLS_C && POLARSSL_SSL_SRV_C && POLARSSL_NET_C &&
Manuel Pégourié-Gonnard4b3e5ef2015-03-27 11:24:27 +0100391 POLARSSL_RSA_C && POLARSSL_CTR_DRBG_C && POLARSSL_PEM_PARSE_C &&
392 ! _WIN32 */