Paul Bakker | 896ac22 | 2011-05-20 12:33:05 +0000 | [diff] [blame] | 1 | /* |
Paul Bakker | cb79ae0b | 2011-05-20 12:44:16 +0000 | [diff] [blame] | 2 | * SSL server demonstration program using fork() for handling multiple clients |
Paul Bakker | 896ac22 | 2011-05-20 12:33:05 +0000 | [diff] [blame] | 3 | * |
Paul Bakker | 3c5ef71 | 2013-06-25 16:37:45 +0200 | [diff] [blame] | 4 | * Copyright (C) 2006-2013, Brainspark B.V. |
Paul Bakker | 896ac22 | 2011-05-20 12:33:05 +0000 | [diff] [blame] | 5 | * |
| 6 | * This file is part of PolarSSL (http://www.polarssl.org) |
| 7 | * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> |
| 8 | * |
| 9 | * All rights reserved. |
| 10 | * |
| 11 | * 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é-Gonnard | abd6e02 | 2013-09-20 13:30:43 +0200 | [diff] [blame^] | 26 | #include "polarssl/config.h" |
Paul Bakker | 896ac22 | 2011-05-20 12:33:05 +0000 | [diff] [blame] | 27 | |
Paul Bakker | cce9d77 | 2011-11-18 14:26:47 +0000 | [diff] [blame] | 28 | #if defined(_WIN32) |
Paul Bakker | 896ac22 | 2011-05-20 12:33:05 +0000 | [diff] [blame] | 29 | #include <windows.h> |
| 30 | #endif |
| 31 | |
| 32 | #include <string.h> |
| 33 | #include <stdlib.h> |
| 34 | #include <stdio.h> |
| 35 | #include <unistd.h> |
| 36 | #include <signal.h> |
| 37 | |
Paul Bakker | 508ad5a | 2011-12-04 17:09:26 +0000 | [diff] [blame] | 38 | #include "polarssl/entropy.h" |
| 39 | #include "polarssl/ctr_drbg.h" |
Paul Bakker | 896ac22 | 2011-05-20 12:33:05 +0000 | [diff] [blame] | 40 | #include "polarssl/certs.h" |
| 41 | #include "polarssl/x509.h" |
| 42 | #include "polarssl/ssl.h" |
| 43 | #include "polarssl/net.h" |
| 44 | #include "polarssl/timing.h" |
| 45 | |
| 46 | #define HTTP_RESPONSE \ |
| 47 | "HTTP/1.0 200 OK\r\nContent-Type: text/html\r\n\r\n" \ |
| 48 | "<h2>PolarSSL Test Server</h2>\r\n" \ |
| 49 | "<p>Successful connection using: %s</p>\r\n" |
| 50 | |
Paul Bakker | b892b13 | 2011-10-12 09:19:43 +0000 | [diff] [blame] | 51 | #if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_CERTS_C) || \ |
Paul Bakker | 508ad5a | 2011-12-04 17:09:26 +0000 | [diff] [blame] | 52 | !defined(POLARSSL_ENTROPY_C) || !defined(POLARSSL_SSL_TLS_C) || \ |
Paul Bakker | b892b13 | 2011-10-12 09:19:43 +0000 | [diff] [blame] | 53 | !defined(POLARSSL_SSL_SRV_C) || !defined(POLARSSL_NET_C) || \ |
Paul Bakker | ed27a04 | 2013-04-18 22:46:23 +0200 | [diff] [blame] | 54 | !defined(POLARSSL_RSA_C) || !defined(POLARSSL_CTR_DRBG_C) || \ |
Paul Bakker | 36713e8 | 2013-09-17 13:25:29 +0200 | [diff] [blame] | 55 | !defined(POLARSSL_X509_CRT_PARSE_C) || !defined(POLARSSL_TIMING_C) |
Paul Bakker | cce9d77 | 2011-11-18 14:26:47 +0000 | [diff] [blame] | 56 | int main( int argc, char *argv[] ) |
Paul Bakker | b892b13 | 2011-10-12 09:19:43 +0000 | [diff] [blame] | 57 | { |
Paul Bakker | cce9d77 | 2011-11-18 14:26:47 +0000 | [diff] [blame] | 58 | ((void) argc); |
| 59 | ((void) argv); |
| 60 | |
Paul Bakker | 508ad5a | 2011-12-04 17:09:26 +0000 | [diff] [blame] | 61 | printf("POLARSSL_BIGNUM_C and/or POLARSSL_CERTS_C and/or POLARSSL_ENTROPY_C " |
Paul Bakker | b892b13 | 2011-10-12 09:19:43 +0000 | [diff] [blame] | 62 | "and/or POLARSSL_SSL_TLS_C and/or POLARSSL_SSL_SRV_C and/or " |
Paul Bakker | 508ad5a | 2011-12-04 17:09:26 +0000 | [diff] [blame] | 63 | "POLARSSL_NET_C and/or POLARSSL_RSA_C and/or " |
Paul Bakker | 36713e8 | 2013-09-17 13:25:29 +0200 | [diff] [blame] | 64 | "POLARSSL_CTR_DRBG_C and/or POLARSSL_X509_CRT_PARSE_C and/or " |
Paul Bakker | fa9b100 | 2013-07-03 15:31:03 +0200 | [diff] [blame] | 65 | "POLARSSL_TIMING_C not defined.\n"); |
Paul Bakker | b892b13 | 2011-10-12 09:19:43 +0000 | [diff] [blame] | 66 | return( 0 ); |
| 67 | } |
Paul Bakker | cce9d77 | 2011-11-18 14:26:47 +0000 | [diff] [blame] | 68 | #elif defined(_WIN32) |
| 69 | int main( int argc, char *argv[] ) |
Paul Bakker | b892b13 | 2011-10-12 09:19:43 +0000 | [diff] [blame] | 70 | { |
Paul Bakker | cce9d77 | 2011-11-18 14:26:47 +0000 | [diff] [blame] | 71 | ((void) argc); |
| 72 | ((void) argv); |
| 73 | |
| 74 | printf("_WIN32 defined. This application requires fork() and signals " |
Paul Bakker | b892b13 | 2011-10-12 09:19:43 +0000 | [diff] [blame] | 75 | "to work correctly.\n"); |
| 76 | return( 0 ); |
| 77 | } |
| 78 | #else |
Paul Bakker | 896ac22 | 2011-05-20 12:33:05 +0000 | [diff] [blame] | 79 | |
| 80 | #define DEBUG_LEVEL 0 |
| 81 | |
Paul Bakker | 3c5ef71 | 2013-06-25 16:37:45 +0200 | [diff] [blame] | 82 | static void my_debug( void *ctx, int level, const char *str ) |
Paul Bakker | 896ac22 | 2011-05-20 12:33:05 +0000 | [diff] [blame] | 83 | { |
| 84 | if( level < DEBUG_LEVEL ) |
| 85 | { |
| 86 | fprintf( (FILE *) ctx, "%s", str ); |
| 87 | fflush( (FILE *) ctx ); |
| 88 | } |
| 89 | } |
| 90 | |
Paul Bakker | cce9d77 | 2011-11-18 14:26:47 +0000 | [diff] [blame] | 91 | int main( int argc, char *argv[] ) |
Paul Bakker | 896ac22 | 2011-05-20 12:33:05 +0000 | [diff] [blame] | 92 | { |
| 93 | int ret, len, cnt = 0, pid; |
| 94 | int listen_fd; |
Manuel Pégourié-Gonnard | 68821da | 2013-09-16 12:34:33 +0200 | [diff] [blame] | 95 | int client_fd = -1; |
Paul Bakker | 896ac22 | 2011-05-20 12:33:05 +0000 | [diff] [blame] | 96 | unsigned char buf[1024]; |
Paul Bakker | ef3f8c7 | 2013-06-24 13:01:08 +0200 | [diff] [blame] | 97 | const char *pers = "ssl_fork_server"; |
Paul Bakker | 896ac22 | 2011-05-20 12:33:05 +0000 | [diff] [blame] | 98 | |
Paul Bakker | 508ad5a | 2011-12-04 17:09:26 +0000 | [diff] [blame] | 99 | entropy_context entropy; |
| 100 | ctr_drbg_context ctr_drbg; |
Paul Bakker | 896ac22 | 2011-05-20 12:33:05 +0000 | [diff] [blame] | 101 | ssl_context ssl; |
Paul Bakker | c559c7a | 2013-09-18 14:13:26 +0200 | [diff] [blame] | 102 | x509_crt srvcert; |
Manuel Pégourié-Gonnard | ac75523 | 2013-08-19 14:10:16 +0200 | [diff] [blame] | 103 | pk_context pkey; |
Paul Bakker | 896ac22 | 2011-05-20 12:33:05 +0000 | [diff] [blame] | 104 | |
Paul Bakker | cce9d77 | 2011-11-18 14:26:47 +0000 | [diff] [blame] | 105 | ((void) argc); |
| 106 | ((void) argv); |
| 107 | |
Paul Bakker | 896ac22 | 2011-05-20 12:33:05 +0000 | [diff] [blame] | 108 | signal( SIGCHLD, SIG_IGN ); |
| 109 | |
| 110 | /* |
Paul Bakker | 508ad5a | 2011-12-04 17:09:26 +0000 | [diff] [blame] | 111 | * 0. Initial seeding of the RNG |
| 112 | */ |
| 113 | printf( "\n . Initial seeding of the random generator..." ); |
| 114 | fflush( stdout ); |
| 115 | |
| 116 | entropy_init( &entropy ); |
| 117 | if( ( ret = ctr_drbg_init( &ctr_drbg, entropy_func, &entropy, |
Paul Bakker | ef3f8c7 | 2013-06-24 13:01:08 +0200 | [diff] [blame] | 118 | (const unsigned char *) pers, |
| 119 | strlen( pers ) ) ) != 0 ) |
Paul Bakker | 508ad5a | 2011-12-04 17:09:26 +0000 | [diff] [blame] | 120 | { |
| 121 | printf( " failed\n ! ctr_drbg_init returned %d\n", ret ); |
| 122 | goto exit; |
| 123 | } |
| 124 | |
| 125 | printf( " ok\n" ); |
| 126 | |
| 127 | /* |
Paul Bakker | 896ac22 | 2011-05-20 12:33:05 +0000 | [diff] [blame] | 128 | * 1. Load the certificates and private RSA key |
| 129 | */ |
Paul Bakker | 508ad5a | 2011-12-04 17:09:26 +0000 | [diff] [blame] | 130 | printf( " . Loading the server cert. and key..." ); |
Paul Bakker | 896ac22 | 2011-05-20 12:33:05 +0000 | [diff] [blame] | 131 | fflush( stdout ); |
| 132 | |
Paul Bakker | 369d2eb | 2013-09-18 11:58:25 +0200 | [diff] [blame] | 133 | x509_crt_init( &srvcert ); |
Paul Bakker | 896ac22 | 2011-05-20 12:33:05 +0000 | [diff] [blame] | 134 | |
| 135 | /* |
| 136 | * This demonstration program uses embedded test certificates. |
Paul Bakker | ddf26b4 | 2013-09-18 13:46:23 +0200 | [diff] [blame] | 137 | * Instead, you may want to use x509_crt_parse_file() to read the |
| 138 | * server and CA certificates, as well as pk_parse_keyfile(). |
Paul Bakker | 896ac22 | 2011-05-20 12:33:05 +0000 | [diff] [blame] | 139 | */ |
Paul Bakker | ddf26b4 | 2013-09-18 13:46:23 +0200 | [diff] [blame] | 140 | ret = x509_crt_parse( &srvcert, (const unsigned char *) test_srv_crt, |
| 141 | strlen( test_srv_crt ) ); |
Paul Bakker | 896ac22 | 2011-05-20 12:33:05 +0000 | [diff] [blame] | 142 | if( ret != 0 ) |
| 143 | { |
Paul Bakker | ddf26b4 | 2013-09-18 13:46:23 +0200 | [diff] [blame] | 144 | printf( " failed\n ! x509_crt_parse returned %d\n\n", ret ); |
Paul Bakker | 896ac22 | 2011-05-20 12:33:05 +0000 | [diff] [blame] | 145 | goto exit; |
| 146 | } |
| 147 | |
Paul Bakker | ddf26b4 | 2013-09-18 13:46:23 +0200 | [diff] [blame] | 148 | ret = x509_crt_parse( &srvcert, (const unsigned char *) test_ca_crt, |
| 149 | strlen( test_ca_crt ) ); |
Paul Bakker | 896ac22 | 2011-05-20 12:33:05 +0000 | [diff] [blame] | 150 | if( ret != 0 ) |
| 151 | { |
Paul Bakker | ddf26b4 | 2013-09-18 13:46:23 +0200 | [diff] [blame] | 152 | printf( " failed\n ! x509_crt_parse returned %d\n\n", ret ); |
Paul Bakker | 896ac22 | 2011-05-20 12:33:05 +0000 | [diff] [blame] | 153 | goto exit; |
| 154 | } |
| 155 | |
Manuel Pégourié-Gonnard | ac75523 | 2013-08-19 14:10:16 +0200 | [diff] [blame] | 156 | pk_init( &pkey ); |
Paul Bakker | 1a7550a | 2013-09-15 13:01:22 +0200 | [diff] [blame] | 157 | ret = pk_parse_key( &pkey, (const unsigned char *) test_srv_key, |
Paul Bakker | 896ac22 | 2011-05-20 12:33:05 +0000 | [diff] [blame] | 158 | strlen( test_srv_key ), NULL, 0 ); |
| 159 | if( ret != 0 ) |
| 160 | { |
Paul Bakker | 1a7550a | 2013-09-15 13:01:22 +0200 | [diff] [blame] | 161 | printf( " failed\n ! pk_parse_key returned %d\n\n", ret ); |
Paul Bakker | 896ac22 | 2011-05-20 12:33:05 +0000 | [diff] [blame] | 162 | goto exit; |
| 163 | } |
| 164 | |
| 165 | printf( " ok\n" ); |
| 166 | |
| 167 | /* |
| 168 | * 2. Setup the listening TCP socket |
| 169 | */ |
| 170 | printf( " . Bind on https://localhost:4433/ ..." ); |
| 171 | fflush( stdout ); |
| 172 | |
| 173 | if( ( ret = net_bind( &listen_fd, NULL, 4433 ) ) != 0 ) |
| 174 | { |
| 175 | printf( " failed\n ! net_bind returned %d\n\n", ret ); |
| 176 | goto exit; |
| 177 | } |
| 178 | |
| 179 | printf( " ok\n" ); |
| 180 | |
| 181 | while( 1 ) |
| 182 | { |
| 183 | /* |
| 184 | * 3. Wait until a client connects |
| 185 | */ |
| 186 | client_fd = -1; |
| 187 | memset( &ssl, 0, sizeof( ssl ) ); |
| 188 | |
| 189 | printf( " . Waiting for a remote connection ..." ); |
| 190 | fflush( stdout ); |
| 191 | |
| 192 | if( ( ret = net_accept( listen_fd, &client_fd, NULL ) ) != 0 ) |
| 193 | { |
| 194 | printf( " failed\n ! net_accept returned %d\n\n", ret ); |
| 195 | goto exit; |
| 196 | } |
| 197 | |
| 198 | printf( " ok\n" ); |
| 199 | |
| 200 | /* |
| 201 | * 3.5. Forking server thread |
| 202 | */ |
| 203 | |
| 204 | pid = fork(); |
| 205 | |
| 206 | printf( " . Forking to handle connection ..." ); |
| 207 | fflush( stdout ); |
| 208 | |
| 209 | if( pid < 0 ) |
| 210 | { |
| 211 | printf(" failed\n ! fork returned %d\n\n", pid ); |
| 212 | goto exit; |
| 213 | } |
| 214 | |
| 215 | printf( " ok\n" ); |
| 216 | |
| 217 | if( pid != 0 ) |
| 218 | { |
Paul Bakker | 508ad5a | 2011-12-04 17:09:26 +0000 | [diff] [blame] | 219 | if( ( ret = ctr_drbg_reseed( &ctr_drbg, |
Paul Bakker | ef3f8c7 | 2013-06-24 13:01:08 +0200 | [diff] [blame] | 220 | (const unsigned char *) "parent", |
| 221 | 6 ) ) != 0 ) |
Paul Bakker | 508ad5a | 2011-12-04 17:09:26 +0000 | [diff] [blame] | 222 | { |
| 223 | printf( " failed\n ! ctr_drbg_reseed returned %d\n", ret ); |
| 224 | goto exit; |
| 225 | } |
| 226 | |
Paul Bakker | 896ac22 | 2011-05-20 12:33:05 +0000 | [diff] [blame] | 227 | close( client_fd ); |
| 228 | continue; |
| 229 | } |
| 230 | |
| 231 | close( listen_fd ); |
| 232 | |
| 233 | /* |
| 234 | * 4. Setup stuff |
| 235 | */ |
Paul Bakker | 508ad5a | 2011-12-04 17:09:26 +0000 | [diff] [blame] | 236 | printf( " . Setting up the SSL data...." ); |
Paul Bakker | 896ac22 | 2011-05-20 12:33:05 +0000 | [diff] [blame] | 237 | fflush( stdout ); |
| 238 | |
Paul Bakker | 508ad5a | 2011-12-04 17:09:26 +0000 | [diff] [blame] | 239 | if( ( ret = ctr_drbg_reseed( &ctr_drbg, |
Paul Bakker | ef3f8c7 | 2013-06-24 13:01:08 +0200 | [diff] [blame] | 240 | (const unsigned char *) "child", |
| 241 | 5 ) ) != 0 ) |
Paul Bakker | 508ad5a | 2011-12-04 17:09:26 +0000 | [diff] [blame] | 242 | { |
| 243 | printf( " failed\n ! ctr_drbg_reseed returned %d\n", ret ); |
| 244 | goto exit; |
| 245 | } |
| 246 | |
Paul Bakker | 896ac22 | 2011-05-20 12:33:05 +0000 | [diff] [blame] | 247 | if( ( ret = ssl_init( &ssl ) ) != 0 ) |
| 248 | { |
| 249 | printf( " failed\n ! ssl_init returned %d\n\n", ret ); |
| 250 | goto exit; |
| 251 | } |
| 252 | |
| 253 | printf( " ok\n" ); |
| 254 | |
| 255 | ssl_set_endpoint( &ssl, SSL_IS_SERVER ); |
| 256 | ssl_set_authmode( &ssl, SSL_VERIFY_NONE ); |
| 257 | |
Paul Bakker | 508ad5a | 2011-12-04 17:09:26 +0000 | [diff] [blame] | 258 | ssl_set_rng( &ssl, ctr_drbg_random, &ctr_drbg ); |
Paul Bakker | 896ac22 | 2011-05-20 12:33:05 +0000 | [diff] [blame] | 259 | ssl_set_dbg( &ssl, my_debug, stdout ); |
| 260 | ssl_set_bio( &ssl, net_recv, &client_fd, |
| 261 | net_send, &client_fd ); |
Paul Bakker | 896ac22 | 2011-05-20 12:33:05 +0000 | [diff] [blame] | 262 | |
Paul Bakker | 896ac22 | 2011-05-20 12:33:05 +0000 | [diff] [blame] | 263 | ssl_set_ca_chain( &ssl, srvcert.next, NULL, NULL ); |
Manuel Pégourié-Gonnard | ac75523 | 2013-08-19 14:10:16 +0200 | [diff] [blame] | 264 | ssl_set_own_cert( &ssl, &srvcert, &pkey ); |
Paul Bakker | 896ac22 | 2011-05-20 12:33:05 +0000 | [diff] [blame] | 265 | |
| 266 | /* |
| 267 | * 5. Handshake |
| 268 | */ |
| 269 | printf( " . Performing the SSL/TLS handshake..." ); |
| 270 | fflush( stdout ); |
| 271 | |
| 272 | while( ( ret = ssl_handshake( &ssl ) ) != 0 ) |
| 273 | { |
| 274 | if( ret != POLARSSL_ERR_NET_WANT_READ && ret != POLARSSL_ERR_NET_WANT_WRITE ) |
| 275 | { |
| 276 | printf( " failed\n ! ssl_handshake returned %d\n\n", ret ); |
| 277 | goto exit; |
| 278 | } |
| 279 | } |
| 280 | |
| 281 | printf( " ok\n" ); |
| 282 | |
| 283 | /* |
| 284 | * 6. Read the HTTP Request |
| 285 | */ |
| 286 | printf( " < Read from client:" ); |
| 287 | fflush( stdout ); |
| 288 | |
| 289 | do |
| 290 | { |
| 291 | len = sizeof( buf ) - 1; |
| 292 | memset( buf, 0, sizeof( buf ) ); |
| 293 | ret = ssl_read( &ssl, buf, len ); |
| 294 | |
| 295 | if( ret == POLARSSL_ERR_NET_WANT_READ || ret == POLARSSL_ERR_NET_WANT_WRITE ) |
| 296 | continue; |
| 297 | |
| 298 | if( ret <= 0 ) |
| 299 | { |
| 300 | switch( ret ) |
| 301 | { |
| 302 | case POLARSSL_ERR_SSL_PEER_CLOSE_NOTIFY: |
| 303 | printf( " connection was closed gracefully\n" ); |
| 304 | break; |
| 305 | |
| 306 | case POLARSSL_ERR_NET_CONN_RESET: |
| 307 | printf( " connection was reset by peer\n" ); |
| 308 | break; |
| 309 | |
| 310 | default: |
| 311 | printf( " ssl_read returned %d\n", ret ); |
| 312 | break; |
| 313 | } |
| 314 | |
| 315 | break; |
| 316 | } |
| 317 | |
| 318 | len = ret; |
| 319 | printf( " %d bytes read\n\n%s", len, (char *) buf ); |
| 320 | } |
| 321 | while( 0 ); |
| 322 | |
| 323 | /* |
| 324 | * 7. Write the 200 Response |
| 325 | */ |
| 326 | printf( " > Write to client:" ); |
| 327 | fflush( stdout ); |
| 328 | |
| 329 | len = sprintf( (char *) buf, HTTP_RESPONSE, |
| 330 | ssl_get_ciphersuite( &ssl ) ); |
| 331 | |
| 332 | while( cnt < 100 ) |
| 333 | { |
| 334 | while( ( ret = ssl_write( &ssl, buf, len ) ) <= 0 ) |
| 335 | { |
| 336 | if( ret == POLARSSL_ERR_NET_CONN_RESET ) |
| 337 | { |
| 338 | printf( " failed\n ! peer closed the connection\n\n" ); |
| 339 | goto exit; |
| 340 | } |
| 341 | |
| 342 | if( ret != POLARSSL_ERR_NET_WANT_READ && ret != POLARSSL_ERR_NET_WANT_WRITE ) |
| 343 | { |
| 344 | printf( " failed\n ! ssl_write returned %d\n\n", ret ); |
| 345 | goto exit; |
| 346 | } |
| 347 | } |
| 348 | len = ret; |
| 349 | printf( " %d bytes written\n\n%s\n", len, (char *) buf ); |
| 350 | |
| 351 | m_sleep( 1000 ); |
| 352 | } |
| 353 | |
| 354 | ssl_close_notify( &ssl ); |
| 355 | goto exit; |
| 356 | } |
| 357 | |
| 358 | exit: |
| 359 | |
| 360 | net_close( client_fd ); |
Paul Bakker | 36713e8 | 2013-09-17 13:25:29 +0200 | [diff] [blame] | 361 | x509_crt_free( &srvcert ); |
Manuel Pégourié-Gonnard | ac75523 | 2013-08-19 14:10:16 +0200 | [diff] [blame] | 362 | pk_free( &pkey ); |
Paul Bakker | 896ac22 | 2011-05-20 12:33:05 +0000 | [diff] [blame] | 363 | ssl_free( &ssl ); |
| 364 | |
Paul Bakker | cce9d77 | 2011-11-18 14:26:47 +0000 | [diff] [blame] | 365 | #if defined(_WIN32) |
Paul Bakker | 896ac22 | 2011-05-20 12:33:05 +0000 | [diff] [blame] | 366 | printf( " Press Enter to exit this program.\n" ); |
| 367 | fflush( stdout ); getchar(); |
| 368 | #endif |
| 369 | |
| 370 | return( ret ); |
| 371 | } |
Paul Bakker | 508ad5a | 2011-12-04 17:09:26 +0000 | [diff] [blame] | 372 | #endif /* POLARSSL_BIGNUM_C && POLARSSL_CERTS_C && POLARSSL_ENTROPY_C && |
Paul Bakker | 5690efc | 2011-05-26 13:16:06 +0000 | [diff] [blame] | 373 | POLARSSL_SSL_TLS_C && POLARSSL_SSL_SRV_C && POLARSSL_NET_C && |
Paul Bakker | 508ad5a | 2011-12-04 17:09:26 +0000 | [diff] [blame] | 374 | POLARSSL_RSA_C && POLARSSL_CTR_DRBG_C */ |