bootctl-install: Fix OpenSSL UI

Follow up for a86a366eb0.
This commit is contained in:
DaanDeMeyer
2025-12-24 16:11:50 +01:00
committed by Daan De Meyer
parent ceaa36c21e
commit 11f47cb700

View 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