blob: cd16e33202542c5097503daa8c123c6582c20ffa [file] [log] [blame]
Paul Bakkered56b222011-07-13 11:26:43 +00001/*
2 * Key reading application
3 *
Bence Szépkúti1e148272020-08-07 13:07:28 +02004 * Copyright The Mbed TLS Contributors
Manuel Pégourié-Gonnard37ff1402015-09-04 14:21:07 +02005 * SPDX-License-Identifier: Apache-2.0
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License"); you may
8 * not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
Paul Bakkered56b222011-07-13 11:26:43 +000018 */
19
Bence Szépkútic662b362021-05-27 11:25:03 +020020#include "mbedtls/build_info.h"
Paul Bakkered56b222011-07-13 11:26:43 +000021
Manuel Pégourié-Gonnard7f809972015-03-09 17:05:11 +000022#include "mbedtls/platform.h"
Rich Evansf90016a2015-01-19 14:26:37 +000023
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020024#if defined(MBEDTLS_BIGNUM_C) && \
Manuel Pégourié-Gonnard1503a9a2021-06-16 10:35:56 +020025 defined(MBEDTLS_PK_PARSE_C) && defined(MBEDTLS_FS_IO) && \
26 defined(MBEDTLS_ENTROPY_C) && defined(MBEDTLS_CTR_DRBG_C)
Manuel Pégourié-Gonnard7f809972015-03-09 17:05:11 +000027#include "mbedtls/error.h"
28#include "mbedtls/rsa.h"
Jaeden Ameroed736992018-10-26 16:55:14 +010029#include "mbedtls/pk.h"
Manuel Pégourié-Gonnard1503a9a2021-06-16 10:35:56 +020030#include "mbedtls/entropy.h"
31#include "mbedtls/ctr_drbg.h"
Manuel Pégourié-Gonnard84dea012021-06-15 11:29:26 +020032
Rich Evans18b78c72015-02-11 14:06:19 +000033#include <string.h>
34#endif
35
36#define MODE_NONE 0
37#define MODE_PRIVATE 1
38#define MODE_PUBLIC 2
39
40#define DFL_MODE MODE_NONE
41#define DFL_FILENAME "keyfile.key"
42#define DFL_PASSWORD ""
43#define DFL_PASSWORD_FILE ""
44#define DFL_DEBUG_LEVEL 0
Manuel Pégourié-Gonnard6c5abfa2015-02-13 14:12:07 +000045
Rich Evans18b78c72015-02-11 14:06:19 +000046#define USAGE \
47 "\n usage: key_app param=<>...\n" \
48 "\n acceptable parameters:\n" \
49 " mode=private|public default: none\n" \
50 " filename=%%s default: keyfile.key\n" \
51 " password=%%s default: \"\"\n" \
52 " password_file=%%s default: \"\"\n" \
53 "\n"
54
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020055#if !defined(MBEDTLS_BIGNUM_C) || \
Manuel Pégourié-Gonnard1503a9a2021-06-16 10:35:56 +020056 !defined(MBEDTLS_PK_PARSE_C) || !defined(MBEDTLS_FS_IO) || \
57 !defined(MBEDTLS_ENTROPY_C) || !defined(MBEDTLS_CTR_DRBG_C)
Gilles Peskine449bd832023-01-11 14:50:10 +010058int main(void)
Paul Bakker15254952013-09-17 11:24:56 +020059{
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020060 mbedtls_printf("MBEDTLS_BIGNUM_C and/or "
Gilles Peskine449bd832023-01-11 14:50:10 +010061 "MBEDTLS_PK_PARSE_C and/or MBEDTLS_FS_IO and/or "
62 "MBEDTLS_ENTROPY_C and/or MBEDTLS_CTR_DRBG_C not defined.\n");
63 mbedtls_exit(0);
Paul Bakker15254952013-09-17 11:24:56 +020064}
65#else
Simon Butcher63cb97e2018-12-06 17:43:31 +000066
Simon Butcher63cb97e2018-12-06 17:43:31 +000067
Paul Bakkered56b222011-07-13 11:26:43 +000068/*
69 * global options
70 */
Gilles Peskine449bd832023-01-11 14:50:10 +010071struct options {
Paul Bakkered56b222011-07-13 11:26:43 +000072 int mode; /* the mode to run the application in */
Paul Bakkeref3f8c72013-06-24 13:01:08 +020073 const char *filename; /* filename of the key file */
74 const char *password; /* password for the private key */
75 const char *password_file; /* password_file for the private key */
Paul Bakkered56b222011-07-13 11:26:43 +000076} opt;
77
Gilles Peskine449bd832023-01-11 14:50:10 +010078int main(int argc, char *argv[])
Paul Bakkered56b222011-07-13 11:26:43 +000079{
Andres Amaya Garcia0faf1a52018-04-29 20:02:18 +010080 int ret = 1;
81 int exit_code = MBEDTLS_EXIT_FAILURE;
Paul Bakkered56b222011-07-13 11:26:43 +000082 char buf[1024];
Paul Bakkerdb2509c2012-09-27 12:44:31 +000083 int i;
Paul Bakkered56b222011-07-13 11:26:43 +000084 char *p, *q;
85
Manuel Pégourié-Gonnard1503a9a2021-06-16 10:35:56 +020086 const char *pers = "pkey/key_app";
87 mbedtls_entropy_context entropy;
88 mbedtls_ctr_drbg_context ctr_drbg;
89
Hanno Becker54ebf992017-08-23 06:45:38 +010090 mbedtls_pk_context pk;
91 mbedtls_mpi N, P, Q, D, E, DP, DQ, QP;
92
Paul Bakkered56b222011-07-13 11:26:43 +000093 /*
94 * Set to sane values
95 */
Gilles Peskine449bd832023-01-11 14:50:10 +010096 mbedtls_entropy_init(&entropy);
97 mbedtls_ctr_drbg_init(&ctr_drbg);
Manuel Pégourié-Gonnard1503a9a2021-06-16 10:35:56 +020098
Gilles Peskine449bd832023-01-11 14:50:10 +010099 mbedtls_pk_init(&pk);
100 memset(buf, 0, sizeof(buf));
Paul Bakkered56b222011-07-13 11:26:43 +0000101
Przemek Stekiel2c1ef092023-04-19 09:38:12 +0200102#if defined(MBEDTLS_USE_PSA_CRYPTO)
103 psa_status_t status = psa_crypto_init();
104 if (status != PSA_SUCCESS) {
105 mbedtls_fprintf(stderr, "Failed to initialize PSA Crypto implementation: %d\n",
106 (int) status);
107 goto cleanup;
108 }
109#endif /* MBEDTLS_USE_PSA_CRYPTO */
110
Gilles Peskine449bd832023-01-11 14:50:10 +0100111 mbedtls_mpi_init(&N); mbedtls_mpi_init(&P); mbedtls_mpi_init(&Q);
112 mbedtls_mpi_init(&D); mbedtls_mpi_init(&E); mbedtls_mpi_init(&DP);
113 mbedtls_mpi_init(&DQ); mbedtls_mpi_init(&QP);
Hanno Becker54ebf992017-08-23 06:45:38 +0100114
Aditya Deshpande644a5c02023-01-30 15:58:50 +0000115 if (argc < 2) {
Gilles Peskine449bd832023-01-11 14:50:10 +0100116usage:
117 mbedtls_printf(USAGE);
Ron Eldor6a9257b2017-08-24 14:20:17 +0300118 goto cleanup;
Paul Bakkered56b222011-07-13 11:26:43 +0000119 }
120
121 opt.mode = DFL_MODE;
122 opt.filename = DFL_FILENAME;
Paul Bakkerdb2509c2012-09-27 12:44:31 +0000123 opt.password = DFL_PASSWORD;
124 opt.password_file = DFL_PASSWORD_FILE;
Paul Bakkered56b222011-07-13 11:26:43 +0000125
Gilles Peskine449bd832023-01-11 14:50:10 +0100126 for (i = 1; i < argc; i++) {
Paul Bakkered56b222011-07-13 11:26:43 +0000127 p = argv[i];
Gilles Peskine449bd832023-01-11 14:50:10 +0100128 if ((q = strchr(p, '=')) == NULL) {
Paul Bakkered56b222011-07-13 11:26:43 +0000129 goto usage;
Gilles Peskine449bd832023-01-11 14:50:10 +0100130 }
Paul Bakkered56b222011-07-13 11:26:43 +0000131 *q++ = '\0';
132
Gilles Peskine449bd832023-01-11 14:50:10 +0100133 if (strcmp(p, "mode") == 0) {
134 if (strcmp(q, "private") == 0) {
Paul Bakkered56b222011-07-13 11:26:43 +0000135 opt.mode = MODE_PRIVATE;
Gilles Peskine449bd832023-01-11 14:50:10 +0100136 } else if (strcmp(q, "public") == 0) {
Paul Bakkered56b222011-07-13 11:26:43 +0000137 opt.mode = MODE_PUBLIC;
Gilles Peskine449bd832023-01-11 14:50:10 +0100138 } else {
Paul Bakkered56b222011-07-13 11:26:43 +0000139 goto usage;
Gilles Peskine449bd832023-01-11 14:50:10 +0100140 }
141 } else if (strcmp(p, "filename") == 0) {
Paul Bakkered56b222011-07-13 11:26:43 +0000142 opt.filename = q;
Gilles Peskine449bd832023-01-11 14:50:10 +0100143 } else if (strcmp(p, "password") == 0) {
Paul Bakkerdb2509c2012-09-27 12:44:31 +0000144 opt.password = q;
Gilles Peskine449bd832023-01-11 14:50:10 +0100145 } else if (strcmp(p, "password_file") == 0) {
Paul Bakkerdb2509c2012-09-27 12:44:31 +0000146 opt.password_file = q;
Gilles Peskine449bd832023-01-11 14:50:10 +0100147 } else {
Paul Bakkered56b222011-07-13 11:26:43 +0000148 goto usage;
Gilles Peskine449bd832023-01-11 14:50:10 +0100149 }
Paul Bakkered56b222011-07-13 11:26:43 +0000150 }
151
Gilles Peskine449bd832023-01-11 14:50:10 +0100152 if (opt.mode == MODE_PRIVATE) {
153 if (strlen(opt.password) && strlen(opt.password_file)) {
154 mbedtls_printf("Error: cannot have both password and password_file\n");
Paul Bakkerdb2509c2012-09-27 12:44:31 +0000155 goto usage;
156 }
157
Gilles Peskine449bd832023-01-11 14:50:10 +0100158 if (strlen(opt.password_file)) {
Paul Bakkerdb2509c2012-09-27 12:44:31 +0000159 FILE *f;
160
Gilles Peskine449bd832023-01-11 14:50:10 +0100161 mbedtls_printf("\n . Loading the password file ...");
162 if ((f = fopen(opt.password_file, "rb")) == NULL) {
163 mbedtls_printf(" failed\n ! fopen returned NULL\n");
Ron Eldor6a9257b2017-08-24 14:20:17 +0300164 goto cleanup;
Paul Bakkerdb2509c2012-09-27 12:44:31 +0000165 }
Gilles Peskine449bd832023-01-11 14:50:10 +0100166 if (fgets(buf, sizeof(buf), f) == NULL) {
167 fclose(f);
168 mbedtls_printf("Error: fgets() failed to retrieve password\n");
Ron Eldor6a9257b2017-08-24 14:20:17 +0300169 goto cleanup;
Paul Bakker8a0c0a92014-04-17 16:08:20 +0200170 }
Gilles Peskine449bd832023-01-11 14:50:10 +0100171 fclose(f);
Paul Bakkerdb2509c2012-09-27 12:44:31 +0000172
Gilles Peskine449bd832023-01-11 14:50:10 +0100173 i = (int) strlen(buf);
174 if (buf[i - 1] == '\n') {
175 buf[i - 1] = '\0';
176 }
177 if (buf[i - 2] == '\r') {
178 buf[i - 2] = '\0';
179 }
Paul Bakkerdb2509c2012-09-27 12:44:31 +0000180 opt.password = buf;
181 }
182
Paul Bakkered56b222011-07-13 11:26:43 +0000183 /*
184 * 1.1. Load the key
185 */
Gilles Peskine449bd832023-01-11 14:50:10 +0100186 mbedtls_printf("\n . Loading the private key ...");
187 fflush(stdout);
Paul Bakkered56b222011-07-13 11:26:43 +0000188
Gilles Peskine449bd832023-01-11 14:50:10 +0100189 if ((ret = mbedtls_ctr_drbg_seed(&ctr_drbg, mbedtls_entropy_func, &entropy,
190 (const unsigned char *) pers,
191 strlen(pers))) != 0) {
192 mbedtls_printf(" failed\n ! mbedtls_ctr_drbg_seed returned -0x%04x\n",
193 (unsigned int) -ret);
Manuel Pégourié-Gonnard1503a9a2021-06-16 10:35:56 +0200194 goto cleanup;
195 }
196
Gilles Peskine449bd832023-01-11 14:50:10 +0100197 ret = mbedtls_pk_parse_keyfile(&pk, opt.filename, opt.password,
198 mbedtls_ctr_drbg_random, &ctr_drbg);
Paul Bakkered56b222011-07-13 11:26:43 +0000199
Gilles Peskine449bd832023-01-11 14:50:10 +0100200 if (ret != 0) {
201 mbedtls_printf(" failed\n ! mbedtls_pk_parse_keyfile returned -0x%04x\n",
202 (unsigned int) -ret);
Ron Eldor6a9257b2017-08-24 14:20:17 +0300203 goto cleanup;
Paul Bakkered56b222011-07-13 11:26:43 +0000204 }
205
Gilles Peskine449bd832023-01-11 14:50:10 +0100206 mbedtls_printf(" ok\n");
Paul Bakkered56b222011-07-13 11:26:43 +0000207
208 /*
209 * 1.2 Print the key
210 */
Gilles Peskine449bd832023-01-11 14:50:10 +0100211 mbedtls_printf(" . Key information ...\n");
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200212#if defined(MBEDTLS_RSA_C)
Gilles Peskine449bd832023-01-11 14:50:10 +0100213 if (mbedtls_pk_get_type(&pk) == MBEDTLS_PK_RSA) {
214 mbedtls_rsa_context *rsa = mbedtls_pk_rsa(pk);
Hanno Becker54ebf992017-08-23 06:45:38 +0100215
Gilles Peskine449bd832023-01-11 14:50:10 +0100216 if ((ret = mbedtls_rsa_export(rsa, &N, &P, &Q, &D, &E)) != 0 ||
217 (ret = mbedtls_rsa_export_crt(rsa, &DP, &DQ, &QP)) != 0) {
218 mbedtls_printf(" failed\n ! could not export RSA parameters\n\n");
Ron Eldora5221472018-06-27 08:49:00 +0300219 goto cleanup;
Hanno Becker54ebf992017-08-23 06:45:38 +0100220 }
221
Gilles Peskine449bd832023-01-11 14:50:10 +0100222 MBEDTLS_MPI_CHK(mbedtls_mpi_write_file("N: ", &N, 16, NULL));
223 MBEDTLS_MPI_CHK(mbedtls_mpi_write_file("E: ", &E, 16, NULL));
224 MBEDTLS_MPI_CHK(mbedtls_mpi_write_file("D: ", &D, 16, NULL));
225 MBEDTLS_MPI_CHK(mbedtls_mpi_write_file("P: ", &P, 16, NULL));
226 MBEDTLS_MPI_CHK(mbedtls_mpi_write_file("Q: ", &Q, 16, NULL));
227 MBEDTLS_MPI_CHK(mbedtls_mpi_write_file("DP: ", &DP, 16, NULL));
228 MBEDTLS_MPI_CHK(mbedtls_mpi_write_file("DQ: ", &DQ, 16, NULL));
229 MBEDTLS_MPI_CHK(mbedtls_mpi_write_file("QP: ", &QP, 16, NULL));
230 } else
Paul Bakker15254952013-09-17 11:24:56 +0200231#endif
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200232#if defined(MBEDTLS_ECP_C)
Gilles Peskine449bd832023-01-11 14:50:10 +0100233 if (mbedtls_pk_get_type(&pk) == MBEDTLS_PK_ECKEY) {
234 mbedtls_ecp_keypair *ecp = mbedtls_pk_ec(pk);
235 MBEDTLS_MPI_CHK(mbedtls_mpi_write_file("Q(X): ",
236 &ecp->MBEDTLS_PRIVATE(Q).MBEDTLS_PRIVATE(X), 16,
237 NULL));
238 MBEDTLS_MPI_CHK(mbedtls_mpi_write_file("Q(Y): ",
239 &ecp->MBEDTLS_PRIVATE(Q).MBEDTLS_PRIVATE(Y), 16,
240 NULL));
241 MBEDTLS_MPI_CHK(mbedtls_mpi_write_file("Q(Z): ",
242 &ecp->MBEDTLS_PRIVATE(Q).MBEDTLS_PRIVATE(Z), 16,
243 NULL));
244 MBEDTLS_MPI_CHK(mbedtls_mpi_write_file("D : ", &ecp->MBEDTLS_PRIVATE(d), 16, NULL));
245 } else
Paul Bakker15254952013-09-17 11:24:56 +0200246#endif
247 {
Gilles Peskine449bd832023-01-11 14:50:10 +0100248 mbedtls_printf("Do not know how to print key information for this type\n");
Ron Eldor6a9257b2017-08-24 14:20:17 +0300249 goto cleanup;
Paul Bakker15254952013-09-17 11:24:56 +0200250 }
Gilles Peskine449bd832023-01-11 14:50:10 +0100251 } else if (opt.mode == MODE_PUBLIC) {
Paul Bakkered56b222011-07-13 11:26:43 +0000252 /*
253 * 1.1. Load the key
254 */
Gilles Peskine449bd832023-01-11 14:50:10 +0100255 mbedtls_printf("\n . Loading the public key ...");
256 fflush(stdout);
Paul Bakkered56b222011-07-13 11:26:43 +0000257
Gilles Peskine449bd832023-01-11 14:50:10 +0100258 ret = mbedtls_pk_parse_public_keyfile(&pk, opt.filename);
Paul Bakkered56b222011-07-13 11:26:43 +0000259
Gilles Peskine449bd832023-01-11 14:50:10 +0100260 if (ret != 0) {
261 mbedtls_printf(" failed\n ! mbedtls_pk_parse_public_keyfile returned -0x%04x\n",
262 (unsigned int) -ret);
Ron Eldor6a9257b2017-08-24 14:20:17 +0300263 goto cleanup;
Paul Bakkered56b222011-07-13 11:26:43 +0000264 }
265
Gilles Peskine449bd832023-01-11 14:50:10 +0100266 mbedtls_printf(" ok\n");
Paul Bakkered56b222011-07-13 11:26:43 +0000267
Gilles Peskine449bd832023-01-11 14:50:10 +0100268 mbedtls_printf(" . Key information ...\n");
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200269#if defined(MBEDTLS_RSA_C)
Gilles Peskine449bd832023-01-11 14:50:10 +0100270 if (mbedtls_pk_get_type(&pk) == MBEDTLS_PK_RSA) {
271 mbedtls_rsa_context *rsa = mbedtls_pk_rsa(pk);
Hanno Becker54ebf992017-08-23 06:45:38 +0100272
Gilles Peskine449bd832023-01-11 14:50:10 +0100273 if ((ret = mbedtls_rsa_export(rsa, &N, NULL, NULL,
274 NULL, &E)) != 0) {
275 mbedtls_printf(" failed\n ! could not export RSA parameters\n\n");
Ron Eldora5221472018-06-27 08:49:00 +0300276 goto cleanup;
Hanno Becker54ebf992017-08-23 06:45:38 +0100277 }
Gilles Peskine449bd832023-01-11 14:50:10 +0100278 MBEDTLS_MPI_CHK(mbedtls_mpi_write_file("N: ", &N, 16, NULL));
279 MBEDTLS_MPI_CHK(mbedtls_mpi_write_file("E: ", &E, 16, NULL));
280 } else
Paul Bakker15254952013-09-17 11:24:56 +0200281#endif
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200282#if defined(MBEDTLS_ECP_C)
Gilles Peskine449bd832023-01-11 14:50:10 +0100283 if (mbedtls_pk_get_type(&pk) == MBEDTLS_PK_ECKEY) {
284 mbedtls_ecp_keypair *ecp = mbedtls_pk_ec(pk);
285 MBEDTLS_MPI_CHK(mbedtls_mpi_write_file("Q(X): ",
286 &ecp->MBEDTLS_PRIVATE(Q).MBEDTLS_PRIVATE(X), 16,
287 NULL));
288 MBEDTLS_MPI_CHK(mbedtls_mpi_write_file("Q(Y): ",
289 &ecp->MBEDTLS_PRIVATE(Q).MBEDTLS_PRIVATE(Y), 16,
290 NULL));
291 MBEDTLS_MPI_CHK(mbedtls_mpi_write_file("Q(Z): ",
292 &ecp->MBEDTLS_PRIVATE(Q).MBEDTLS_PRIVATE(Z), 16,
293 NULL));
294 } else
Paul Bakker15254952013-09-17 11:24:56 +0200295#endif
296 {
Gilles Peskine449bd832023-01-11 14:50:10 +0100297 mbedtls_printf("Do not know how to print key information for this type\n");
Ron Eldor6a9257b2017-08-24 14:20:17 +0300298 goto cleanup;
Paul Bakker15254952013-09-17 11:24:56 +0200299 }
Gilles Peskine449bd832023-01-11 14:50:10 +0100300 } else {
Paul Bakkered56b222011-07-13 11:26:43 +0000301 goto usage;
Gilles Peskine449bd832023-01-11 14:50:10 +0100302 }
Paul Bakkered56b222011-07-13 11:26:43 +0000303
Andres Amaya Garcia0faf1a52018-04-29 20:02:18 +0100304 exit_code = MBEDTLS_EXIT_SUCCESS;
305
Ron Eldor6a9257b2017-08-24 14:20:17 +0300306cleanup:
Paul Bakkered56b222011-07-13 11:26:43 +0000307
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200308#if defined(MBEDTLS_ERROR_C)
Gilles Peskine449bd832023-01-11 14:50:10 +0100309 if (exit_code != MBEDTLS_EXIT_SUCCESS) {
310 mbedtls_strerror(ret, buf, sizeof(buf));
311 mbedtls_printf(" ! Last error was: %s\n", buf);
Hanno Becker54ebf992017-08-23 06:45:38 +0100312 }
Manuel Pégourié-Gonnard92e5b592013-09-18 18:57:10 +0200313#endif
314
Gilles Peskine449bd832023-01-11 14:50:10 +0100315 mbedtls_ctr_drbg_free(&ctr_drbg);
316 mbedtls_entropy_free(&entropy);
Gilles Peskine449bd832023-01-11 14:50:10 +0100317 mbedtls_pk_free(&pk);
Przemek Stekiel758aef62023-04-19 13:47:43 +0200318#if defined(MBEDTLS_USE_PSA_CRYPTO)
Przemek Stekiel2c1ef092023-04-19 09:38:12 +0200319 mbedtls_psa_crypto_free();
Przemek Stekiel758aef62023-04-19 13:47:43 +0200320#endif /* MBEDTLS_USE_PSA_CRYPTO */
Gilles Peskine449bd832023-01-11 14:50:10 +0100321 mbedtls_mpi_free(&N); mbedtls_mpi_free(&P); mbedtls_mpi_free(&Q);
322 mbedtls_mpi_free(&D); mbedtls_mpi_free(&E); mbedtls_mpi_free(&DP);
323 mbedtls_mpi_free(&DQ); mbedtls_mpi_free(&QP);
Paul Bakkered56b222011-07-13 11:26:43 +0000324
Gilles Peskine449bd832023-01-11 14:50:10 +0100325 mbedtls_exit(exit_code);
Paul Bakkered56b222011-07-13 11:26:43 +0000326}
Manuel Pégourié-Gonnard1503a9a2021-06-16 10:35:56 +0200327#endif /* MBEDTLS_BIGNUM_C && MBEDTLS_PK_PARSE_C && MBEDTLS_FS_IO &&
328 MBEDTLS_ENTROPY_C && MBEDTLS_CTR_DRBG_C */