summaryrefslogtreecommitdiffstats
path: root/apps/pkcs12.c
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2016-03-21 18:08:57 +0100
committerRichard Levitte <levitte@openssl.org>2016-03-31 13:32:01 +0200
commit923b1857decf4440b13b82f2aa7cf1189327d1a3 (patch)
tree6b6a6387610cdad0b7a1bdbb0b23da12ac80bc94 /apps/pkcs12.c
parent4de9913b8c2a11f17258a2ad5e357046fd221360 (diff)
Fix "no-ui" configuration
Reviewed-by: Matt Caswell <matt@openssl.org>
Diffstat (limited to 'apps/pkcs12.c')
-rw-r--r--apps/pkcs12.c53
1 files changed, 39 insertions, 14 deletions
diff --git a/apps/pkcs12.c b/apps/pkcs12.c
index 6657c4fcee..ff3cb8845b 100644
--- a/apps/pkcs12.c
+++ b/apps/pkcs12.c
@@ -176,7 +176,8 @@ int pkcs12_main(int argc, char **argv)
int cert_pbe = NID_pbe_WithSHA1And3_Key_TripleDES_CBC;
# endif
int key_pbe = NID_pbe_WithSHA1And3_Key_TripleDES_CBC;
- int ret = 1, macver = 1, noprompt = 0, add_lmk = 0, private = 0;
+ int ret = 1, macver = 1, add_lmk = 0, private = 0;
+ int noprompt = 0;
char *passinarg = NULL, *passoutarg = NULL, *passarg = NULL;
char *passin = NULL, *passout = NULL, *inrand = NULL, *macalg = NULL;
char *cpass = NULL, *mpass = NULL, *CApath = NULL, *CAfile = NULL;
@@ -367,9 +368,16 @@ int pkcs12_main(int argc, char **argv)
}
if (twopass) {
- if (EVP_read_pw_string
- (macpass, sizeof macpass, "Enter MAC Password:", export_cert)) {
- BIO_printf(bio_err, "Can't read Password\n");
+ if (1) {
+#ifndef OPENSSL_NO_UI
+ if (EVP_read_pw_string
+ (macpass, sizeof macpass, "Enter MAC Password:", export_cert)) {
+ BIO_printf(bio_err, "Can't read Password\n");
+ goto end;
+ }
+ } else {
+#endif
+ BIO_printf(bio_err, "Unsupported option -twopass\n");
goto end;
}
}
@@ -477,12 +485,21 @@ int pkcs12_main(int argc, char **argv)
if (add_lmk && key)
EVP_PKEY_add1_attr_by_NID(key, NID_LocalKeySet, 0, NULL, -1);
- if (!noprompt &&
- EVP_read_pw_string(pass, sizeof pass, "Enter Export Password:",
- 1)) {
- BIO_printf(bio_err, "Can't read Password\n");
- goto export_end;
+ if (!noprompt) {
+ if (1) {
+#ifndef OPENSSL_NO_UI
+ if (EVP_read_pw_string(pass, sizeof pass, "Enter Export Password:",
+ 1)) {
+ BIO_printf(bio_err, "Can't read Password\n");
+ goto export_end;
+ }
+ } else {
+#endif
+ BIO_printf(bio_err, "Password required\n");
+ goto export_end;
+ }
}
+
if (!twopass)
OPENSSL_strlcpy(macpass, pass, sizeof macpass);
@@ -534,11 +551,19 @@ int pkcs12_main(int argc, char **argv)
goto end;
}
- if (!noprompt
- && EVP_read_pw_string(pass, sizeof pass, "Enter Import Password:",
- 0)) {
- BIO_printf(bio_err, "Can't read Password\n");
- goto end;
+ if (!noprompt) {
+ if (1) {
+#ifndef OPENSSL_NO_UI
+ if (EVP_read_pw_string(pass, sizeof pass, "Enter Import Password:",
+ 0)) {
+ BIO_printf(bio_err, "Can't read Password\n");
+ goto end;
+ }
+ } else {
+#endif
+ BIO_printf(bio_err, "Password required\n");
+ goto end;
+ }
}
if (!twopass)