REENABLE_WARNING;
# endif
+#ifndef OPENSSL_NO_UI_CONSOLE
DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(UI_METHOD*, UI_destroy_method, NULL);
+#endif
/* For each error in the OpenSSL thread error queue, log the provided message and the OpenSSL error
* string. If there are no errors in the OpenSSL thread queue, this logs the message with "No OpenSSL
#endif
}
+#ifndef OPENSSL_NO_UI_CONSOLE
static int openssl_ask_password_ui_read(UI *ui, UI_STRING *uis) {
int r;
return (UI_method_get_reader(UI_OpenSSL()))(ui, uis);
}
}
+#endif
static int openssl_load_private_key_from_file(const char *path, EVP_PKEY **ret) {
_cleanup_(erase_and_freep) char *rawkey = NULL;
static int openssl_ask_password_ui_new(const AskPasswordRequest *request, OpenSSLAskPasswordUI **ret) {
assert(ret);
+#ifndef OPENSSL_NO_UI_CONSOLE
_cleanup_(UI_destroy_methodp) UI_METHOD *method = UI_create_method("systemd-ask-password");
if (!method)
return log_openssl_errors("Failed to initialize openssl user interface");
*ret = TAKE_PTR(ui);
return 0;
+#else
+ return -EOPNOTSUPP;
+#endif
}
static int load_x509_certificate_from_file(const char *path, X509 **ret) {
#endif
OpenSSLAskPasswordUI* openssl_ask_password_ui_free(OpenSSLAskPasswordUI *ui) {
-#if HAVE_OPENSSL
+#if HAVE_OPENSSL && !defined(OPENSSL_NO_UI_CONSOLE)
if (!ui)
return NULL;
# include <openssl/opensslv.h> /* IWYU pragma: export */
# include <openssl/pkcs7.h> /* IWYU pragma: export */
# include <openssl/ssl.h> /* IWYU pragma: export */
-# include <openssl/ui.h> /* IWYU pragma: export */
+# ifndef OPENSSL_NO_UI_CONSOLE
+# include <openssl/ui.h> /* IWYU pragma: export */
+# endif
# include <openssl/x509v3.h> /* IWYU pragma: export */
# ifndef OPENSSL_VERSION_MAJOR
/* OPENSSL_VERSION_MAJOR macro was added in OpenSSL 3. Thus, if it doesn't exist, we must be before OpenSSL 3. */