Paul Bakker | bdb912d | 2012-02-13 23:11:30 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Certificate request generation |
| 3 | * |
| 4 | * Copyright (C) 2006-2011, Brainspark B.V. |
| 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 | bdb912d | 2012-02-13 23:11:30 +0000 | [diff] [blame] | 27 | |
| 28 | #include <string.h> |
| 29 | #include <stdlib.h> |
| 30 | #include <stdio.h> |
| 31 | |
Paul Bakker | 7c6b2c3 | 2013-09-16 13:49:26 +0200 | [diff] [blame] | 32 | #include "polarssl/x509_csr.h" |
Manuel Pégourié-Gonnard | ee73179 | 2013-09-11 22:48:40 +0200 | [diff] [blame] | 33 | #include "polarssl/entropy.h" |
| 34 | #include "polarssl/ctr_drbg.h" |
Manuel Pégourié-Gonnard | 31e5940 | 2013-09-12 05:59:05 +0200 | [diff] [blame] | 35 | #include "polarssl/error.h" |
Paul Bakker | bdb912d | 2012-02-13 23:11:30 +0000 | [diff] [blame] | 36 | |
Paul Bakker | 7c6b2c3 | 2013-09-16 13:49:26 +0200 | [diff] [blame] | 37 | #if !defined(POLARSSL_X509_CSR_WRITE_C) || !defined(POLARSSL_FS_IO) || \ |
Paul Bakker | 36713e8 | 2013-09-17 13:25:29 +0200 | [diff] [blame] | 38 | !defined(POLARSSL_PK_PARSE_C) || \ |
Manuel Pégourié-Gonnard | 26b4d45 | 2013-09-12 06:56:06 +0200 | [diff] [blame] | 39 | !defined(POLARSSL_ENTROPY_C) || !defined(POLARSSL_CTR_DRBG_C) |
Paul Bakker | 80d44fe | 2013-09-09 15:59:20 +0200 | [diff] [blame] | 40 | int main( int argc, char *argv[] ) |
| 41 | { |
| 42 | ((void) argc); |
| 43 | ((void) argv); |
| 44 | |
Paul Bakker | 7c6b2c3 | 2013-09-16 13:49:26 +0200 | [diff] [blame] | 45 | printf( "POLARSSL_X509_CSR_WRITE_C and/or POLARSSL_FS_IO and/or " |
Paul Bakker | 36713e8 | 2013-09-17 13:25:29 +0200 | [diff] [blame] | 46 | "POLARSSL_PK_PARSE_C and/or " |
Manuel Pégourié-Gonnard | 26b4d45 | 2013-09-12 06:56:06 +0200 | [diff] [blame] | 47 | "POLARSSL_ENTROPY_C and/or POLARSSL_CTR_DRBG_C " |
| 48 | "not defined.\n"); |
Paul Bakker | 80d44fe | 2013-09-09 15:59:20 +0200 | [diff] [blame] | 49 | return( 0 ); |
| 50 | } |
| 51 | #else |
| 52 | |
Paul Bakker | bdb912d | 2012-02-13 23:11:30 +0000 | [diff] [blame] | 53 | #define DFL_FILENAME "keyfile.key" |
| 54 | #define DFL_DEBUG_LEVEL 0 |
| 55 | #define DFL_OUTPUT_FILENAME "cert.req" |
| 56 | #define DFL_SUBJECT_NAME "CN=Cert,O=PolarSSL,C=NL" |
Paul Bakker | 57be6e2 | 2013-08-26 14:13:14 +0200 | [diff] [blame] | 57 | #define DFL_KEY_USAGE 0 |
| 58 | #define DFL_NS_CERT_TYPE 0 |
Paul Bakker | bdb912d | 2012-02-13 23:11:30 +0000 | [diff] [blame] | 59 | |
| 60 | /* |
| 61 | * global options |
| 62 | */ |
| 63 | struct options |
| 64 | { |
| 65 | char *filename; /* filename of the key file */ |
| 66 | int debug_level; /* level of debugging */ |
| 67 | char *output_file; /* where to store the constructed key file */ |
| 68 | char *subject_name; /* subject name for certificate request */ |
Paul Bakker | 57be6e2 | 2013-08-26 14:13:14 +0200 | [diff] [blame] | 69 | unsigned char key_usage; /* key usage flags */ |
| 70 | unsigned char ns_cert_type; /* NS cert type */ |
Paul Bakker | bdb912d | 2012-02-13 23:11:30 +0000 | [diff] [blame] | 71 | } opt; |
| 72 | |
Manuel Pégourié-Gonnard | ee73179 | 2013-09-11 22:48:40 +0200 | [diff] [blame] | 73 | int write_certificate_request( x509write_csr *req, char *output_file, |
| 74 | int (*f_rng)(void *, unsigned char *, size_t), |
| 75 | void *p_rng ) |
Paul Bakker | bdb912d | 2012-02-13 23:11:30 +0000 | [diff] [blame] | 76 | { |
Paul Bakker | 135f1e9 | 2013-08-26 16:54:13 +0200 | [diff] [blame] | 77 | int ret; |
Paul Bakker | bdb912d | 2012-02-13 23:11:30 +0000 | [diff] [blame] | 78 | FILE *f; |
| 79 | unsigned char output_buf[4096]; |
Paul Bakker | 135f1e9 | 2013-08-26 16:54:13 +0200 | [diff] [blame] | 80 | size_t len = 0; |
Paul Bakker | bdb912d | 2012-02-13 23:11:30 +0000 | [diff] [blame] | 81 | |
Paul Bakker | 135f1e9 | 2013-08-26 16:54:13 +0200 | [diff] [blame] | 82 | memset( output_buf, 0, 4096 ); |
Manuel Pégourié-Gonnard | ee73179 | 2013-09-11 22:48:40 +0200 | [diff] [blame] | 83 | if( ( ret = x509write_csr_pem( req, output_buf, 4096, f_rng, p_rng ) ) < 0 ) |
Paul Bakker | 8eabfc1 | 2013-08-25 10:18:25 +0200 | [diff] [blame] | 84 | return( ret ); |
Paul Bakker | bdb912d | 2012-02-13 23:11:30 +0000 | [diff] [blame] | 85 | |
Paul Bakker | 135f1e9 | 2013-08-26 16:54:13 +0200 | [diff] [blame] | 86 | len = strlen( (char *) output_buf ); |
Paul Bakker | bdb912d | 2012-02-13 23:11:30 +0000 | [diff] [blame] | 87 | |
Paul Bakker | 8eabfc1 | 2013-08-25 10:18:25 +0200 | [diff] [blame] | 88 | if( ( f = fopen( output_file, "w" ) ) == NULL ) |
| 89 | return( -1 ); |
| 90 | |
Paul Bakker | 135f1e9 | 2013-08-26 16:54:13 +0200 | [diff] [blame] | 91 | if( fwrite( output_buf, 1, len, f ) != len ) |
| 92 | return( -1 ); |
| 93 | |
Paul Bakker | bdb912d | 2012-02-13 23:11:30 +0000 | [diff] [blame] | 94 | fclose(f); |
Paul Bakker | 8eabfc1 | 2013-08-25 10:18:25 +0200 | [diff] [blame] | 95 | |
| 96 | return( 0 ); |
Paul Bakker | bdb912d | 2012-02-13 23:11:30 +0000 | [diff] [blame] | 97 | } |
| 98 | |
| 99 | #define USAGE \ |
Paul Bakker | 8693274 | 2013-09-09 14:09:42 +0200 | [diff] [blame] | 100 | "\n usage: cert_req param=<>...\n" \ |
Paul Bakker | bdb912d | 2012-02-13 23:11:30 +0000 | [diff] [blame] | 101 | "\n acceptable parameters:\n" \ |
| 102 | " filename=%%s default: keyfile.key\n" \ |
| 103 | " debug_level=%%d default: 0 (disabled)\n" \ |
| 104 | " output_file=%%s default: cert.req\n" \ |
| 105 | " subject_name=%%s default: CN=Cert,O=PolarSSL,C=NL\n" \ |
Paul Bakker | 57be6e2 | 2013-08-26 14:13:14 +0200 | [diff] [blame] | 106 | " key_usage=%%s default: (empty)\n" \ |
| 107 | " Comma-separated-list of values:\n" \ |
| 108 | " digital_signature\n" \ |
| 109 | " non_repudiation\n" \ |
| 110 | " key_encipherment\n" \ |
| 111 | " data_encipherment\n" \ |
| 112 | " key_agreement\n" \ |
| 113 | " key_certificate_sign\n" \ |
| 114 | " crl_sign\n" \ |
| 115 | " ns_cert_type=%%s default: (empty)\n" \ |
| 116 | " Comma-separated-list of values:\n" \ |
| 117 | " ssl_client\n" \ |
| 118 | " ssl_server\n" \ |
| 119 | " email\n" \ |
| 120 | " object_signing\n" \ |
| 121 | " ssl_ca\n" \ |
| 122 | " email_ca\n" \ |
| 123 | " object_signing_ca\n" \ |
Paul Bakker | bdb912d | 2012-02-13 23:11:30 +0000 | [diff] [blame] | 124 | "\n" |
| 125 | |
Paul Bakker | bdb912d | 2012-02-13 23:11:30 +0000 | [diff] [blame] | 126 | int main( int argc, char *argv[] ) |
| 127 | { |
| 128 | int ret = 0; |
Manuel Pégourié-Gonnard | ee73179 | 2013-09-11 22:48:40 +0200 | [diff] [blame] | 129 | pk_context key; |
Paul Bakker | bdb912d | 2012-02-13 23:11:30 +0000 | [diff] [blame] | 130 | char buf[1024]; |
| 131 | int i, j, n; |
Paul Bakker | 57be6e2 | 2013-08-26 14:13:14 +0200 | [diff] [blame] | 132 | char *p, *q, *r; |
Paul Bakker | cd35803 | 2013-09-09 12:08:11 +0200 | [diff] [blame] | 133 | x509write_csr req; |
Manuel Pégourié-Gonnard | ee73179 | 2013-09-11 22:48:40 +0200 | [diff] [blame] | 134 | entropy_context entropy; |
| 135 | ctr_drbg_context ctr_drbg; |
| 136 | const char *pers = "csr example app"; |
Paul Bakker | bdb912d | 2012-02-13 23:11:30 +0000 | [diff] [blame] | 137 | |
| 138 | /* |
| 139 | * Set to sane values |
| 140 | */ |
Paul Bakker | 82e2945 | 2013-08-25 11:01:31 +0200 | [diff] [blame] | 141 | x509write_csr_init( &req ); |
| 142 | x509write_csr_set_md_alg( &req, POLARSSL_MD_SHA1 ); |
Manuel Pégourié-Gonnard | ee73179 | 2013-09-11 22:48:40 +0200 | [diff] [blame] | 143 | pk_init( &key ); |
Manuel Pégourié-Gonnard | 26b4d45 | 2013-09-12 06:56:06 +0200 | [diff] [blame] | 144 | memset( buf, 0, sizeof( buf ) ); |
Paul Bakker | bdb912d | 2012-02-13 23:11:30 +0000 | [diff] [blame] | 145 | |
| 146 | if( argc == 0 ) |
| 147 | { |
| 148 | usage: |
| 149 | printf( USAGE ); |
Paul Bakker | 57be6e2 | 2013-08-26 14:13:14 +0200 | [diff] [blame] | 150 | ret = 1; |
Paul Bakker | bdb912d | 2012-02-13 23:11:30 +0000 | [diff] [blame] | 151 | goto exit; |
| 152 | } |
| 153 | |
| 154 | opt.filename = DFL_FILENAME; |
| 155 | opt.debug_level = DFL_DEBUG_LEVEL; |
| 156 | opt.output_file = DFL_OUTPUT_FILENAME; |
| 157 | opt.subject_name = DFL_SUBJECT_NAME; |
Paul Bakker | 57be6e2 | 2013-08-26 14:13:14 +0200 | [diff] [blame] | 158 | opt.key_usage = DFL_KEY_USAGE; |
| 159 | opt.ns_cert_type = DFL_NS_CERT_TYPE; |
Paul Bakker | bdb912d | 2012-02-13 23:11:30 +0000 | [diff] [blame] | 160 | |
| 161 | for( i = 1; i < argc; i++ ) |
| 162 | { |
| 163 | |
| 164 | p = argv[i]; |
| 165 | if( ( q = strchr( p, '=' ) ) == NULL ) |
| 166 | goto usage; |
| 167 | *q++ = '\0'; |
| 168 | |
| 169 | n = strlen( p ); |
| 170 | for( j = 0; j < n; j++ ) |
| 171 | { |
| 172 | if( argv[i][j] >= 'A' && argv[i][j] <= 'Z' ) |
| 173 | argv[i][j] |= 0x20; |
| 174 | } |
| 175 | |
| 176 | if( strcmp( p, "filename" ) == 0 ) |
| 177 | opt.filename = q; |
| 178 | else if( strcmp( p, "output_file" ) == 0 ) |
| 179 | opt.output_file = q; |
| 180 | else if( strcmp( p, "debug_level" ) == 0 ) |
| 181 | { |
| 182 | opt.debug_level = atoi( q ); |
| 183 | if( opt.debug_level < 0 || opt.debug_level > 65535 ) |
| 184 | goto usage; |
| 185 | } |
| 186 | else if( strcmp( p, "subject_name" ) == 0 ) |
| 187 | { |
Paul Bakker | bdb912d | 2012-02-13 23:11:30 +0000 | [diff] [blame] | 188 | opt.subject_name = q; |
| 189 | } |
Paul Bakker | 57be6e2 | 2013-08-26 14:13:14 +0200 | [diff] [blame] | 190 | else if( strcmp( p, "key_usage" ) == 0 ) |
| 191 | { |
| 192 | while( q != NULL ) |
| 193 | { |
| 194 | if( ( r = strchr( q, ',' ) ) != NULL ) |
| 195 | *r++ = '\0'; |
| 196 | |
| 197 | if( strcmp( q, "digital_signature" ) == 0 ) |
| 198 | opt.key_usage |= KU_DIGITAL_SIGNATURE; |
| 199 | else if( strcmp( q, "non_repudiation" ) == 0 ) |
| 200 | opt.key_usage |= KU_NON_REPUDIATION; |
| 201 | else if( strcmp( q, "key_encipherment" ) == 0 ) |
| 202 | opt.key_usage |= KU_KEY_ENCIPHERMENT; |
| 203 | else if( strcmp( q, "data_encipherment" ) == 0 ) |
| 204 | opt.key_usage |= KU_DATA_ENCIPHERMENT; |
| 205 | else if( strcmp( q, "key_agreement" ) == 0 ) |
| 206 | opt.key_usage |= KU_KEY_AGREEMENT; |
| 207 | else if( strcmp( q, "key_cert_sign" ) == 0 ) |
| 208 | opt.key_usage |= KU_KEY_CERT_SIGN; |
| 209 | else if( strcmp( q, "crl_sign" ) == 0 ) |
| 210 | opt.key_usage |= KU_CRL_SIGN; |
| 211 | else |
| 212 | goto usage; |
| 213 | |
| 214 | q = r; |
| 215 | } |
| 216 | } |
| 217 | else if( strcmp( p, "ns_cert_type" ) == 0 ) |
| 218 | { |
| 219 | while( q != NULL ) |
| 220 | { |
| 221 | if( ( r = strchr( q, ',' ) ) != NULL ) |
| 222 | *r++ = '\0'; |
| 223 | |
| 224 | if( strcmp( q, "ssl_client" ) == 0 ) |
| 225 | opt.ns_cert_type |= NS_CERT_TYPE_SSL_CLIENT; |
| 226 | else if( strcmp( q, "ssl_server" ) == 0 ) |
| 227 | opt.ns_cert_type |= NS_CERT_TYPE_SSL_SERVER; |
| 228 | else if( strcmp( q, "email" ) == 0 ) |
| 229 | opt.ns_cert_type |= NS_CERT_TYPE_EMAIL; |
| 230 | else if( strcmp( q, "object_signing" ) == 0 ) |
| 231 | opt.ns_cert_type |= NS_CERT_TYPE_OBJECT_SIGNING; |
| 232 | else if( strcmp( q, "ssl_ca" ) == 0 ) |
| 233 | opt.ns_cert_type |= NS_CERT_TYPE_SSL_CA; |
| 234 | else if( strcmp( q, "email_ca" ) == 0 ) |
| 235 | opt.ns_cert_type |= NS_CERT_TYPE_EMAIL_CA; |
| 236 | else if( strcmp( q, "object_signing_ca" ) == 0 ) |
| 237 | opt.ns_cert_type |= NS_CERT_TYPE_OBJECT_SIGNING_CA; |
| 238 | else |
| 239 | goto usage; |
| 240 | |
| 241 | q = r; |
| 242 | } |
| 243 | } |
Paul Bakker | bdb912d | 2012-02-13 23:11:30 +0000 | [diff] [blame] | 244 | else |
| 245 | goto usage; |
| 246 | } |
| 247 | |
Paul Bakker | 57be6e2 | 2013-08-26 14:13:14 +0200 | [diff] [blame] | 248 | if( opt.key_usage ) |
| 249 | x509write_csr_set_key_usage( &req, opt.key_usage ); |
| 250 | |
| 251 | if( opt.ns_cert_type ) |
| 252 | x509write_csr_set_ns_cert_type( &req, opt.ns_cert_type ); |
| 253 | |
Paul Bakker | bdb912d | 2012-02-13 23:11:30 +0000 | [diff] [blame] | 254 | /* |
Manuel Pégourié-Gonnard | ee73179 | 2013-09-11 22:48:40 +0200 | [diff] [blame] | 255 | * 0. Seed the PRNG |
| 256 | */ |
| 257 | printf( " . Seeding the random number generator..." ); |
| 258 | fflush( stdout ); |
| 259 | |
| 260 | entropy_init( &entropy ); |
| 261 | if( ( ret = ctr_drbg_init( &ctr_drbg, entropy_func, &entropy, |
| 262 | (const unsigned char *) pers, |
| 263 | strlen( pers ) ) ) != 0 ) |
| 264 | { |
Manuel Pégourié-Gonnard | 26b4d45 | 2013-09-12 06:56:06 +0200 | [diff] [blame] | 265 | printf( " failed\n ! ctr_drbg_init returned %d", ret ); |
Manuel Pégourié-Gonnard | ee73179 | 2013-09-11 22:48:40 +0200 | [diff] [blame] | 266 | goto exit; |
| 267 | } |
| 268 | |
| 269 | printf( " ok\n" ); |
| 270 | |
| 271 | /* |
Paul Bakker | bdb912d | 2012-02-13 23:11:30 +0000 | [diff] [blame] | 272 | * 1.0. Check the subject name for validity |
| 273 | */ |
Manuel Pégourié-Gonnard | ee73179 | 2013-09-11 22:48:40 +0200 | [diff] [blame] | 274 | printf( " . Checking subjet name..." ); |
| 275 | fflush( stdout ); |
| 276 | |
Paul Bakker | 82e2945 | 2013-08-25 11:01:31 +0200 | [diff] [blame] | 277 | if( ( ret = x509write_csr_set_subject_name( &req, opt.subject_name ) ) != 0 ) |
Paul Bakker | bdb912d | 2012-02-13 23:11:30 +0000 | [diff] [blame] | 278 | { |
Manuel Pégourié-Gonnard | 26b4d45 | 2013-09-12 06:56:06 +0200 | [diff] [blame] | 279 | printf( " failed\n ! x509write_csr_set_subject_name returned %d", ret ); |
Paul Bakker | 8eabfc1 | 2013-08-25 10:18:25 +0200 | [diff] [blame] | 280 | goto exit; |
Paul Bakker | bdb912d | 2012-02-13 23:11:30 +0000 | [diff] [blame] | 281 | } |
| 282 | |
Manuel Pégourié-Gonnard | ee73179 | 2013-09-11 22:48:40 +0200 | [diff] [blame] | 283 | printf( " ok\n" ); |
| 284 | |
Paul Bakker | bdb912d | 2012-02-13 23:11:30 +0000 | [diff] [blame] | 285 | /* |
| 286 | * 1.1. Load the key |
| 287 | */ |
Manuel Pégourié-Gonnard | ee73179 | 2013-09-11 22:48:40 +0200 | [diff] [blame] | 288 | printf( " . Loading the private key ..." ); |
Paul Bakker | bdb912d | 2012-02-13 23:11:30 +0000 | [diff] [blame] | 289 | fflush( stdout ); |
| 290 | |
Paul Bakker | 1a7550a | 2013-09-15 13:01:22 +0200 | [diff] [blame] | 291 | ret = pk_parse_keyfile( &key, opt.filename, NULL ); |
Paul Bakker | bdb912d | 2012-02-13 23:11:30 +0000 | [diff] [blame] | 292 | |
| 293 | if( ret != 0 ) |
| 294 | { |
Paul Bakker | 1a7550a | 2013-09-15 13:01:22 +0200 | [diff] [blame] | 295 | printf( " failed\n ! pk_parse_keyfile returned %d", ret ); |
Paul Bakker | 8eabfc1 | 2013-08-25 10:18:25 +0200 | [diff] [blame] | 296 | goto exit; |
| 297 | } |
| 298 | |
Manuel Pégourié-Gonnard | ee73179 | 2013-09-11 22:48:40 +0200 | [diff] [blame] | 299 | x509write_csr_set_key( &req, &key ); |
Paul Bakker | 8eabfc1 | 2013-08-25 10:18:25 +0200 | [diff] [blame] | 300 | |
| 301 | printf( " ok\n" ); |
| 302 | |
| 303 | /* |
| 304 | * 1.2. Writing the request |
| 305 | */ |
| 306 | printf( " . Writing the certificate request ..." ); |
| 307 | fflush( stdout ); |
| 308 | |
Manuel Pégourié-Gonnard | ee73179 | 2013-09-11 22:48:40 +0200 | [diff] [blame] | 309 | if( ( ret = write_certificate_request( &req, opt.output_file, |
| 310 | ctr_drbg_random, &ctr_drbg ) ) != 0 ) |
Paul Bakker | 8eabfc1 | 2013-08-25 10:18:25 +0200 | [diff] [blame] | 311 | { |
Manuel Pégourié-Gonnard | 26b4d45 | 2013-09-12 06:56:06 +0200 | [diff] [blame] | 312 | printf( " failed\n ! write_certifcate_request %d", ret ); |
Paul Bakker | bdb912d | 2012-02-13 23:11:30 +0000 | [diff] [blame] | 313 | goto exit; |
| 314 | } |
| 315 | |
| 316 | printf( " ok\n" ); |
| 317 | |
Paul Bakker | bdb912d | 2012-02-13 23:11:30 +0000 | [diff] [blame] | 318 | exit: |
Manuel Pégourié-Gonnard | 26b4d45 | 2013-09-12 06:56:06 +0200 | [diff] [blame] | 319 | |
| 320 | if( ret != 0 && ret != 1) |
| 321 | { |
| 322 | #ifdef POLARSSL_ERROR_C |
| 323 | polarssl_strerror( ret, buf, sizeof( buf ) ); |
| 324 | printf( " - %s\n", buf ); |
| 325 | #else |
| 326 | printf("\n"); |
| 327 | #endif |
| 328 | } |
| 329 | |
Paul Bakker | 82e2945 | 2013-08-25 11:01:31 +0200 | [diff] [blame] | 330 | x509write_csr_free( &req ); |
Manuel Pégourié-Gonnard | ee73179 | 2013-09-11 22:48:40 +0200 | [diff] [blame] | 331 | pk_free( &key ); |
Paul Bakker | 1ffefac | 2013-09-28 15:23:03 +0200 | [diff] [blame^] | 332 | entropy_free( &entropy ); |
Paul Bakker | bdb912d | 2012-02-13 23:11:30 +0000 | [diff] [blame] | 333 | |
| 334 | #if defined(_WIN32) |
| 335 | printf( " + Press Enter to exit this program.\n" ); |
| 336 | fflush( stdout ); getchar(); |
| 337 | #endif |
| 338 | |
| 339 | return( ret ); |
| 340 | } |
Paul Bakker | 36713e8 | 2013-09-17 13:25:29 +0200 | [diff] [blame] | 341 | #endif /* POLARSSL_X509_CSR_WRITE_C && POLARSSL_PK_PARSE_C && POLARSSL_FS_IO && |
Manuel Pégourié-Gonnard | 26b4d45 | 2013-09-12 06:56:06 +0200 | [diff] [blame] | 342 | POLARSSL_ENTROPY_C && POLARSSL_CTR_DRBG_C */ |