UI_UTIL_wrap_read_pem_callback(): when |cb| is NULL, use PEM_def_callback
authorRichard Levitte <levitte@openssl.org>
Thu, 14 Nov 2019 11:09:42 +0000 (12:09 +0100)
committerRichard Levitte <levitte@openssl.org>
Fri, 22 Nov 2019 14:19:19 +0000 (15:19 +0100)
Fixes #10444

Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/10447)

crypto/ui/ui_util.c

index b28c133..f64780a 100644 (file)
@@ -8,6 +8,7 @@
  */
 
 #include <string.h>
  */
 
 #include <string.h>
+#include <openssl/pem.h>         /* PEM_def_callback() */
 #include "internal/thread_once.h"
 #include "ui_local.h"
 
 #include "internal/thread_once.h"
 #include "ui_local.h"
 
@@ -156,7 +157,7 @@ UI_METHOD *UI_UTIL_wrap_read_pem_callback(pem_password_cb *cb, int rwflag)
         return NULL;
     }
     data->rwflag = rwflag;
         return NULL;
     }
     data->rwflag = rwflag;
-    data->cb = cb;
+    data->cb = cb != NULL ? cb : PEM_def_callback;
 
     return ui_method;
 }
 
     return ui_method;
 }