Fix no-ui
authorRichard Levitte <levitte@openssl.org>
Thu, 26 Apr 2018 13:27:54 +0000 (15:27 +0200)
committerRichard Levitte <levitte@openssl.org>
Thu, 26 Apr 2018 13:27:54 +0000 (15:27 +0200)
In a recent commit, a OPENSSL_NO_UI guard was dropped by mistake in
PEM_def_callback(), so this puts it back.  At the same time, that
previous commit got rid of the necessity to have a OPENSSL_NO_STDIO
guard, so we drop that instead.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6096)

crypto/pem/pem_lib.c

index 04d374ba5259166e64f37e8083bb2b2bae922a9f..fdf2b006dca8808d36b40139efe5ab2e61ca7e2c 100644 (file)
@@ -30,8 +30,11 @@ int pem_check_suffix(const char *pem_str, const char *suffix);
 
 int PEM_def_callback(char *buf, int num, int rwflag, void *userdata)
 {
-    int i, min_len;
+    int i;
+#ifndef OPENSSL_NO_UI
+    int min_len;
     const char *prompt;
+#endif
 
     /* We assume that the user passes a default password as userdata */
     if (userdata) {
@@ -41,7 +44,7 @@ int PEM_def_callback(char *buf, int num, int rwflag, void *userdata)
         return i;
     }
 
-#if defined(OPENSSL_NO_STDIO) || defined(OPENSSL_NO_UI)
+#ifdef OPENSSL_NO_UI
     PEMerr(PEM_F_PEM_DEF_CALLBACK, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
     return -1;
 #else