11/*
2- * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
2+ * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved.
33 *
44 * Licensed under the OpenSSL license (the "License"). You may not use
55 * this file except in compliance with the License. You can obtain a copy
88 */
99
1010#include <openssl/opensslconf.h>
11- #ifdef OPENSSL_NO_DSA
12- NON_EMPTY_TRANSLATION_UNIT
13- #else
14-
15- # include <stdio.h>
16- # include <stdlib.h>
17- # include <string.h>
18- # include <time.h>
19- # include "apps.h"
20- # include "progs.h"
21- # include <openssl/bio.h>
22- # include <openssl/err.h>
23- # include <openssl/dsa.h>
24- # include <openssl/evp.h>
25- # include <openssl/x509.h>
26- # include <openssl/pem.h>
27- # include <openssl/bn.h>
11+ #include <stdio.h>
12+ #include <stdlib.h>
13+ #include <string.h>
14+ #include <time.h>
15+ #include "apps.h"
16+ #include "progs.h"
17+ #include <openssl/bio.h>
18+ #include <openssl/err.h>
19+ #include <openssl/dsa.h>
20+ #include <openssl/evp.h>
21+ #include <openssl/x509.h>
22+ #include <openssl/pem.h>
23+ #include <openssl/bn.h>
2824
2925typedef enum OPTION_choice {
3026 OPT_ERR = -1 , OPT_EOF = 0 , OPT_HELP ,
@@ -49,14 +45,14 @@ const OPTIONS dsa_options[] = {
4945 {"passin" , OPT_PASSIN , 's' , "Input file pass phrase source" },
5046 {"passout" , OPT_PASSOUT , 's' , "Output file pass phrase source" },
5147 {"" , OPT_CIPHER , '-' , "Any supported cipher" },
52- # ifndef OPENSSL_NO_RC4
48+ #ifndef OPENSSL_NO_RC4
5349 {"pvk-strong" , OPT_PVK_STRONG , '-' , "Enable 'Strong' PVK encoding level (default)" },
5450 {"pvk-weak" , OPT_PVK_WEAK , '-' , "Enable 'Weak' PVK encoding level" },
5551 {"pvk-none" , OPT_PVK_NONE , '-' , "Don't enforce PVK encoding" },
56- # endif
57- # ifndef OPENSSL_NO_ENGINE
52+ #endif
53+ #ifndef OPENSSL_NO_ENGINE
5854 {"engine" , OPT_ENGINE , 's' , "Use engine e, possibly a hardware device" },
59- # endif
55+ #endif
6056 {NULL }
6157};
6258
@@ -71,9 +67,9 @@ int dsa_main(int argc, char **argv)
7167 OPTION_CHOICE o ;
7268 int informat = FORMAT_PEM , outformat = FORMAT_PEM , text = 0 , noout = 0 ;
7369 int i , modulus = 0 , pubin = 0 , pubout = 0 , ret = 1 ;
74- # ifndef OPENSSL_NO_RC4
70+ #ifndef OPENSSL_NO_RC4
7571 int pvk_encr = 2 ;
76- # endif
72+ #endif
7773 int private = 0 ;
7874
7975 prog = opt_init (argc , argv , dsa_options );
@@ -214,7 +210,7 @@ int dsa_main(int argc, char **argv)
214210 i = PEM_write_bio_DSAPrivateKey (out , dsa , enc ,
215211 NULL , 0 , NULL , passout );
216212 }
217- # ifndef OPENSSL_NO_RSA
213+ #ifndef OPENSSL_NO_RSA
218214 } else if (outformat == FORMAT_MSBLOB || outformat == FORMAT_PVK ) {
219215 EVP_PKEY * pk ;
220216 pk = EVP_PKEY_new ();
@@ -229,21 +225,21 @@ int dsa_main(int argc, char **argv)
229225 goto end ;
230226 }
231227 assert (private );
232- # ifdef OPENSSL_NO_RC4
228+ # ifdef OPENSSL_NO_RC4
233229 BIO_printf (bio_err , "PVK format not supported\n" );
234230 EVP_PKEY_free (pk );
235231 goto end ;
236- # else
232+ # else
237233 i = i2b_PVK_bio (out , pk , pvk_encr , 0 , passout );
238- # endif
234+ # endif
239235 } else if (pubin || pubout ) {
240236 i = i2b_PublicKey_bio (out , pk );
241237 } else {
242238 assert (private );
243239 i = i2b_PrivateKey_bio (out , pk );
244240 }
245241 EVP_PKEY_free (pk );
246- # endif
242+ #endif
247243 } else {
248244 BIO_printf (bio_err , "bad output format specified for outfile\n" );
249245 goto end ;
@@ -262,4 +258,3 @@ int dsa_main(int argc, char **argv)
262258 OPENSSL_free (passout );
263259 return ret ;
264260}
265- #endif
0 commit comments