]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
bootctl-install: Fix OpenSSL UI
authorDaanDeMeyer <daan.j.demeyer@gmail.com>
Wed, 24 Dec 2025 15:11:50 +0000 (16:11 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 24 Dec 2025 17:04:57 +0000 (18:04 +0100)
Follow up for a86a366eb07294357c34122114a11ee131c25e72.

src/bootctl/bootctl-install.c

index 6cabf3785c419a161ececb2e099d9ea03476f90c..ebaf5720b5a55f4925d8cd14b3a49d9dd3c53af7 100644 (file)
@@ -965,12 +965,14 @@ static int are_we_installed(const char *esp_path) {
 #if HAVE_OPENSSL
 static int load_secure_boot_auto_enroll(
                 X509 **ret_certificate,
-                EVP_PKEY **ret_private_key) {
+                EVP_PKEY **ret_private_key,
+                OpenSSLAskPasswordUI **ret_ui) {
 
         int r;
 
         assert(ret_certificate);
         assert(ret_private_key);
+        assert(ret_ui);
 
         if (!arg_secure_boot_auto_enroll) {
                 *ret_certificate = NULL;
@@ -999,7 +1001,6 @@ static int load_secure_boot_auto_enroll(
                         return log_error_errno(r, "Failed to parse private key path %s: %m", arg_private_key);
         }
 
-        _cleanup_(EVP_PKEY_freep) EVP_PKEY *private_key = NULL;
         r = openssl_load_private_key(
                         arg_private_key_source_type,
                         arg_private_key_source,
@@ -1012,13 +1013,12 @@ static int load_secure_boot_auto_enroll(
                                 .until = USEC_INFINITY,
                                 .hup_fd = -EBADF,
                         },
-                        &private_key,
-                        /* ret_user_interface= */ NULL);
+                        ret_private_key,
+                        ret_ui);
         if (r < 0)
                 return log_error_errno(r, "Failed to load private key from %s: %m", arg_private_key);
 
         *ret_certificate = TAKE_PTR(certificate);
-        *ret_private_key = TAKE_PTR(private_key);
 
         return 0;
 }
@@ -1039,9 +1039,10 @@ int verb_install(int argc, char *argv[], void *userdata) {
         graceful = arg_graceful() == ARG_GRACEFUL_FORCE || (!install && arg_graceful() != ARG_GRACEFUL_NO);
 
 #if HAVE_OPENSSL
+        _cleanup_(openssl_ask_password_ui_freep) OpenSSLAskPasswordUI *ui = NULL;
         _cleanup_(EVP_PKEY_freep) EVP_PKEY *private_key = NULL;
         _cleanup_(X509_freep) X509 *certificate = NULL;
-        r = load_secure_boot_auto_enroll(&certificate, &private_key);
+        r = load_secure_boot_auto_enroll(&certificate, &private_key, &ui);
         if (r < 0)
                 return r;
 #endif