UI_UTIL_read_pw() misinterpreted the values returned from UI functions.
[openssl.git] / crypto / ui / ui_util.c
index fc8b691a87590998c706e629a9a7c267e1bcec24..46bc8c1a9a08f48496b7de645717fcb0e7d306e0 100644 (file)
@@ -55,9 +55,6 @@
 
 #include <string.h>
 #include <openssl/ui.h>
-#ifdef OPENSSL_SYS_WINCE
-#include <stdio_extras.h>      /* BUFSIZ */
-#endif
 
 int UI_UTIL_read_pw_string(char *buf,int length,const char *prompt,int verify)
        {
@@ -81,12 +78,14 @@ int UI_UTIL_read_pw(char *buf,char *buff,int size,const char *prompt,int verify)
        if (ui)
                {
                ok = UI_add_input_string(ui,prompt,0,buf,0,size-1);
-               if (ok == 0 && verify)
+               if (ok >= 0 && verify)
                        ok = UI_add_verify_string(ui,prompt,0,buff,0,size-1,
                                buf);
-               if (ok == 0)
+               if (ok >= 0)
                        ok=UI_process(ui);
                UI_free(ui);
                }
+       if (ok > 0)
+               ok = 0;
        return(ok);
        }