1
1
/*
2
- * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
2
+ * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved.
3
3
*
4
4
* Licensed under the OpenSSL license (the "License"). You may not use
5
5
* this file except in compliance with the License. You can obtain a copy
8
8
*/
9
9
10
10
#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>
28
24
29
25
typedef enum OPTION_choice {
30
26
OPT_ERR = -1 , OPT_EOF = 0 , OPT_HELP ,
@@ -49,14 +45,14 @@ const OPTIONS dsa_options[] = {
49
45
{"passin" , OPT_PASSIN , 's' , "Input file pass phrase source" },
50
46
{"passout" , OPT_PASSOUT , 's' , "Output file pass phrase source" },
51
47
{"" , OPT_CIPHER , '-' , "Any supported cipher" },
52
- # ifndef OPENSSL_NO_RC4
48
+ #ifndef OPENSSL_NO_RC4
53
49
{"pvk-strong" , OPT_PVK_STRONG , '-' , "Enable 'Strong' PVK encoding level (default)" },
54
50
{"pvk-weak" , OPT_PVK_WEAK , '-' , "Enable 'Weak' PVK encoding level" },
55
51
{"pvk-none" , OPT_PVK_NONE , '-' , "Don't enforce PVK encoding" },
56
- # endif
57
- # ifndef OPENSSL_NO_ENGINE
52
+ #endif
53
+ #ifndef OPENSSL_NO_ENGINE
58
54
{"engine" , OPT_ENGINE , 's' , "Use engine e, possibly a hardware device" },
59
- # endif
55
+ #endif
60
56
{NULL }
61
57
};
62
58
@@ -71,9 +67,9 @@ int dsa_main(int argc, char **argv)
71
67
OPTION_CHOICE o ;
72
68
int informat = FORMAT_PEM , outformat = FORMAT_PEM , text = 0 , noout = 0 ;
73
69
int i , modulus = 0 , pubin = 0 , pubout = 0 , ret = 1 ;
74
- # ifndef OPENSSL_NO_RC4
70
+ #ifndef OPENSSL_NO_RC4
75
71
int pvk_encr = 2 ;
76
- # endif
72
+ #endif
77
73
int private = 0 ;
78
74
79
75
prog = opt_init (argc , argv , dsa_options );
@@ -214,7 +210,7 @@ int dsa_main(int argc, char **argv)
214
210
i = PEM_write_bio_DSAPrivateKey (out , dsa , enc ,
215
211
NULL , 0 , NULL , passout );
216
212
}
217
- # ifndef OPENSSL_NO_RSA
213
+ #ifndef OPENSSL_NO_RSA
218
214
} else if (outformat == FORMAT_MSBLOB || outformat == FORMAT_PVK ) {
219
215
EVP_PKEY * pk ;
220
216
pk = EVP_PKEY_new ();
@@ -229,21 +225,21 @@ int dsa_main(int argc, char **argv)
229
225
goto end ;
230
226
}
231
227
assert (private );
232
- # ifdef OPENSSL_NO_RC4
228
+ # ifdef OPENSSL_NO_RC4
233
229
BIO_printf (bio_err , "PVK format not supported\n" );
234
230
EVP_PKEY_free (pk );
235
231
goto end ;
236
- # else
232
+ # else
237
233
i = i2b_PVK_bio (out , pk , pvk_encr , 0 , passout );
238
- # endif
234
+ # endif
239
235
} else if (pubin || pubout ) {
240
236
i = i2b_PublicKey_bio (out , pk );
241
237
} else {
242
238
assert (private );
243
239
i = i2b_PrivateKey_bio (out , pk );
244
240
}
245
241
EVP_PKEY_free (pk );
246
- # endif
242
+ #endif
247
243
} else {
248
244
BIO_printf (bio_err , "bad output format specified for outfile\n" );
249
245
goto end ;
@@ -262,4 +258,3 @@ int dsa_main(int argc, char **argv)
262
258
OPENSSL_free (passout );
263
259
return ret ;
264
260
}
265
- #endif
0 commit comments