summaryrefslogtreecommitdiff
path: root/src/lib/libssl/src/apps/dsa.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libssl/src/apps/dsa.c')
-rw-r--r--src/lib/libssl/src/apps/dsa.c36
1 files changed, 15 insertions, 21 deletions
diff --git a/src/lib/libssl/src/apps/dsa.c b/src/lib/libssl/src/apps/dsa.c
index 49ca9003ac..9da1a41645 100644
--- a/src/lib/libssl/src/apps/dsa.c
+++ b/src/lib/libssl/src/apps/dsa.c
@@ -56,7 +56,7 @@
56 * [including the GNU Public Licence.] 56 * [including the GNU Public Licence.]
57 */ 57 */
58 58
59#ifndef NO_DSA 59#ifndef OPENSSL_NO_DSA
60#include <stdio.h> 60#include <stdio.h>
61#include <stdlib.h> 61#include <stdlib.h>
62#include <string.h> 62#include <string.h>
@@ -68,7 +68,6 @@
68#include <openssl/evp.h> 68#include <openssl/evp.h>
69#include <openssl/x509.h> 69#include <openssl/x509.h>
70#include <openssl/pem.h> 70#include <openssl/pem.h>
71#include <openssl/engine.h>
72 71
73#undef PROG 72#undef PROG
74#define PROG dsa_main 73#define PROG dsa_main
@@ -80,6 +79,9 @@
80 * -des - encrypt output if PEM format with DES in cbc mode 79 * -des - encrypt output if PEM format with DES in cbc mode
81 * -des3 - encrypt output if PEM format 80 * -des3 - encrypt output if PEM format
82 * -idea - encrypt output if PEM format 81 * -idea - encrypt output if PEM format
82 * -aes128 - encrypt output if PEM format
83 * -aes192 - encrypt output if PEM format
84 * -aes256 - encrypt output if PEM format
83 * -text - print a text version 85 * -text - print a text version
84 * -modulus - print the DSA public key 86 * -modulus - print the DSA public key
85 */ 87 */
@@ -107,6 +109,9 @@ int MAIN(int argc, char **argv)
107 if ((bio_err=BIO_new(BIO_s_file())) != NULL) 109 if ((bio_err=BIO_new(BIO_s_file())) != NULL)
108 BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT); 110 BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
109 111
112 if (!load_config(bio_err, NULL))
113 goto end;
114
110 engine=NULL; 115 engine=NULL;
111 infile=NULL; 116 infile=NULL;
112 outfile=NULL; 117 outfile=NULL;
@@ -187,9 +192,13 @@ bad:
187 BIO_printf(bio_err," -engine e use engine e, possibly a hardware device.\n"); 192 BIO_printf(bio_err," -engine e use engine e, possibly a hardware device.\n");
188 BIO_printf(bio_err," -des encrypt PEM output with cbc des\n"); 193 BIO_printf(bio_err," -des encrypt PEM output with cbc des\n");
189 BIO_printf(bio_err," -des3 encrypt PEM output with ede cbc des using 168 bit key\n"); 194 BIO_printf(bio_err," -des3 encrypt PEM output with ede cbc des using 168 bit key\n");
190#ifndef NO_IDEA 195#ifndef OPENSSL_NO_IDEA
191 BIO_printf(bio_err," -idea encrypt PEM output with cbc idea\n"); 196 BIO_printf(bio_err," -idea encrypt PEM output with cbc idea\n");
192#endif 197#endif
198#ifndef OPENSSL_NO_AES
199 BIO_printf(bio_err," -aes128, -aes192, -aes256\n");
200 BIO_printf(bio_err," encrypt PEM output with cbc aes\n");
201#endif
193 BIO_printf(bio_err," -text print the key in text\n"); 202 BIO_printf(bio_err," -text print the key in text\n");
194 BIO_printf(bio_err," -noout don't print key out\n"); 203 BIO_printf(bio_err," -noout don't print key out\n");
195 BIO_printf(bio_err," -modulus print the DSA public value\n"); 204 BIO_printf(bio_err," -modulus print the DSA public value\n");
@@ -198,23 +207,7 @@ bad:
198 207
199 ERR_load_crypto_strings(); 208 ERR_load_crypto_strings();
200 209
201 if (engine != NULL) 210 e = setup_engine(bio_err, engine, 0);
202 {
203 if((e = ENGINE_by_id(engine)) == NULL)
204 {
205 BIO_printf(bio_err,"invalid engine \"%s\"\n",
206 engine);
207 goto end;
208 }
209 if(!ENGINE_set_default(e, ENGINE_METHOD_ALL))
210 {
211 BIO_printf(bio_err,"can't use that engine\n");
212 goto end;
213 }
214 BIO_printf(bio_err,"engine \"%s\" set.\n", engine);
215 /* Free our "structural" reference. */
216 ENGINE_free(e);
217 }
218 211
219 if(!app_passwd(bio_err, passargin, passargout, &passin, &passout)) { 212 if(!app_passwd(bio_err, passargin, passargout, &passin, &passout)) {
220 BIO_printf(bio_err, "Error getting passwords\n"); 213 BIO_printf(bio_err, "Error getting passwords\n");
@@ -262,7 +255,7 @@ bad:
262 if (outfile == NULL) 255 if (outfile == NULL)
263 { 256 {
264 BIO_set_fp(out,stdout,BIO_NOCLOSE); 257 BIO_set_fp(out,stdout,BIO_NOCLOSE);
265#ifdef VMS 258#ifdef OPENSSL_SYS_VMS
266 { 259 {
267 BIO *tmpbio = BIO_new(BIO_f_linebuffer()); 260 BIO *tmpbio = BIO_new(BIO_f_linebuffer());
268 out = BIO_push(tmpbio, out); 261 out = BIO_push(tmpbio, out);
@@ -320,6 +313,7 @@ end:
320 if(dsa != NULL) DSA_free(dsa); 313 if(dsa != NULL) DSA_free(dsa);
321 if(passin) OPENSSL_free(passin); 314 if(passin) OPENSSL_free(passin);
322 if(passout) OPENSSL_free(passout); 315 if(passout) OPENSSL_free(passout);
316 apps_shutdown();
323 EXIT(ret); 317 EXIT(ret);
324 } 318 }
325#endif 319#endif