From nobody Fri May 17 06:54:08 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584353618; cv=none; d=zohomail.com; s=zohoarc; b=G8G5elzC61/if80U+/DlbloqlrvFmdtzUaCt0x+i6LFO6Z0HT5oe2ug8RPHZCP8tDXeQkg7N8cPjnzM3b5FtJLyNP+u6HiMj3EglPLXDhP6IzrITmyoAPNIKp9cGMvGJsDTz5rHVRNtYzGbacbcEdFE6ZqwS7hhSqFS1tUBvgpY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584353618; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=YTchg9oRPmarNEtMp7YlXLPODEnEGQE9TOffgWkNx0w=; b=QVhL3fWZLSgtrQmf9JoPhlH1Dz7dGPrgJZQFEpPHhvrlhowd3cH/OPTBXfyvfUdUjfxBwlvQ0B0XLXCTSNt0kzkbN53veuaLV9hd+sJGvySoGpgOduXSnr4tVn5ti2zab+crql+ocUJxkEKORFHlGsWF3hqnh0CG1S1L/hTfJE0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1584353618545816.4245900343165; Mon, 16 Mar 2020 03:13:38 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-418-aNzDzQYVOZWNf-KBZfxmDQ-1; Mon, 16 Mar 2020 06:13:35 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D63B419057A7; Mon, 16 Mar 2020 10:13:28 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A69F95C1B2; Mon, 16 Mar 2020 10:13:28 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 37EE486FED; Mon, 16 Mar 2020 10:13:28 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02GADGv7030211 for ; Mon, 16 Mar 2020 06:13:16 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5364293533; Mon, 16 Mar 2020 10:13:16 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2F1DF9352B; Mon, 16 Mar 2020 10:13:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584353617; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=YTchg9oRPmarNEtMp7YlXLPODEnEGQE9TOffgWkNx0w=; b=BZeQmGwgRyyOc3ESw8VT/vBjhFMAPjYQxs5owIRIgdHWOuOsWGbDAc8zpCrdVQwQrKS5p8 LShFeIIg2TKdfR5n61WZJGYmng/X4M1QOTnPKm/VIsIC3/zUo/93bqVZR5u8MDXPFn3iEH IQl7g0mDWxflhVomT5sNkDLXfmOQtrk= X-MC-Unique: aNzDzQYVOZWNf-KBZfxmDQ-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH v2 1/5] qemuDomainSecretInfo: Register autoptr cleanup function Date: Mon, 16 Mar 2020 11:13:03 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: Peter Krempa X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_domain.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index 835321f54d..ad7ed3b9f0 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -1042,6 +1042,8 @@ bool qemuDomainSupportsEncryptedSecret(qemuDomainObjP= rivatePtr priv); void qemuDomainSecretInfoFree(qemuDomainSecretInfoPtr secinfo) ATTRIBUTE_NONNULL(1); +G_DEFINE_AUTOPTR_CLEANUP_FUNC(qemuDomainSecretInfo, qemuDomainSecretInfoFr= ee); + void qemuDomainSecretInfoDestroy(qemuDomainSecretInfoPtr secinfo); void qemuDomainSecretDiskDestroy(virDomainDiskDefPtr disk) --=20 2.24.1 From nobody Fri May 17 06:54:08 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584353611; cv=none; d=zohomail.com; s=zohoarc; b=ZnhEao7zUBPWfxcTUDBhIMu4pcbE81SfKOmtlWJXw7uzIhNhg4fIO7IwOx8xqSKDiDflxisfihBc4t3eJOmU9nPmOHYCkETbWhzkcTQHyZTt2CjayWk1vsUP4IB0L7CVhz8Am/8ukA+0iaetoXbQGqCVcgTMSVyCUNESURn1ibg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584353611; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=8OCalDOdo7M6XA4GTkA8EyPk2MMFDwbYCA9PnVeTBM8=; b=QqFWmohNE0+ONNLzW2RounloOI1KEKtNwL2C7S9VrWE/Yp1FXXR6EMOIuCYrvx3Y/tEb7PskOVumnyx9AwN91Mt45mf8Q2h1Jey6SgpJl/1PBsEwtPeryyN7Ha/ro9/xVABir3lOe3mPV3HcTasGZedjyBcfSA5kXkfRsP71l+o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1584353611711226.99557481559293; Mon, 16 Mar 2020 03:13:31 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-304-2_WjdphoNmu8GM4erHODow-1; Mon, 16 Mar 2020 06:13:28 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2F69D802B9B; Mon, 16 Mar 2020 10:13:23 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EDC6B60BF3; Mon, 16 Mar 2020 10:13:22 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 2F3C7182B010; Mon, 16 Mar 2020 10:13:21 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02GADJ6c030221 for ; Mon, 16 Mar 2020 06:13:19 -0400 Received: by smtp.corp.redhat.com (Postfix) id C8BBB93533; Mon, 16 Mar 2020 10:13:19 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id AFADC94965; Mon, 16 Mar 2020 10:13:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584353610; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=8OCalDOdo7M6XA4GTkA8EyPk2MMFDwbYCA9PnVeTBM8=; b=OcZ0E+3bwqkwLZjdhfcM1blrQfJCW6E8VJXQf1tr3qn09sTG8i6XitVTahAtRuf+GzSUFf IsLiQbNx0pPADaP59/NZ8PGRjAePYtd4g6xftTHe1bWh/0eFXGIf+Ojo1BlYs7w6Xlg6jW IGYMQ9CA4nwO8PA1fiiT3mbWFwsgKs0= X-MC-Unique: 2_WjdphoNmu8GM4erHODow-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH v2 2/5] qemuDomainSecretAESSetup: Automatically free non-secret locals Date: Mon, 16 Mar 2020 11:13:04 +0100 Message-Id: <98ba8c3f348dcd4a5579ba9fdcedc49258f1defb.1584353498.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: Peter Krempa X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Use g_autofree for the ciphertext and init vector as they are not secret and thus don't have to be cleared and use g_new0 to allocate the iv for parity. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_domain.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 7c962fb062..e33d3099d6 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -1536,11 +1536,11 @@ qemuDomainSecretAESSetup(qemuDomainObjPrivatePtr pr= iv, { g_autoptr(virConnect) conn =3D virGetConnectSecret(); int ret =3D -1; - uint8_t *raw_iv =3D NULL; + g_autofree uint8_t *raw_iv =3D NULL; size_t ivlen =3D QEMU_DOMAIN_AES_IV_LEN; uint8_t *secret =3D NULL; size_t secretlen =3D 0; - uint8_t *ciphertext =3D NULL; + g_autofree uint8_t *ciphertext =3D NULL; size_t ciphertextlen =3D 0; if (!conn) @@ -1550,14 +1550,13 @@ qemuDomainSecretAESSetup(qemuDomainObjPrivatePtr pr= iv, secinfo->s.aes.username =3D g_strdup(username); if (!(secinfo->s.aes.alias =3D qemuDomainGetSecretAESAlias(srcalias, i= sLuks))) - goto cleanup; + return -1; - if (VIR_ALLOC_N(raw_iv, ivlen) < 0) - goto cleanup; + raw_iv =3D g_new0(uint8_t, ivlen); /* Create a random initialization vector */ if (virRandomBytes(raw_iv, ivlen) < 0) - goto cleanup; + return -1; /* Encode the IV and save that since qemu will need it */ secinfo->s.aes.iv =3D g_base64_encode(raw_iv, ivlen); @@ -1583,9 +1582,7 @@ qemuDomainSecretAESSetup(qemuDomainObjPrivatePtr priv, ret =3D 0; cleanup: - VIR_DISPOSE_N(raw_iv, ivlen); VIR_DISPOSE_N(secret, secretlen); - VIR_DISPOSE_N(ciphertext, ciphertextlen); return ret; } --=20 2.24.1 From nobody Fri May 17 06:54:08 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584353614; cv=none; d=zohomail.com; s=zohoarc; b=bHiPTXxQ8gCKEHaBAhgS8vhC6f5zSSbVbP04+gLeD6BI0ZAXdVqnHYiy9+ToBLMepTL7sSj/pxzVPjjJ7wKPfWM6Ja9wAWaXiWPtKkp2fUVc21HZSu/9o4Rpr7/YyArg4NMemIo543QyM67IfaG1KAVw/9SgbY+8ON6fmy8dUAw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584353614; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=+Pny82AB1obWw4jLPzLw/Ys109WYSyPSOPAQbg7Ob/E=; b=HooywF7mQ3fBq31SXo+CYZp9f4ia0cVBs0Z/d2Ecy7AzMwQW/D3W9230om7oSfpBcQgcV3hRToAPW2yWm6dXvd7IANQUt9268d072c+xGeeGfAhP8wpAJCLdavrupAVU0oXLTXWeFbLzpmwENGGaW5uy4II+Snm+Ay17SR/yJcs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1584353614311575.5361560192484; Mon, 16 Mar 2020 03:13:34 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-63-BCDB_JhoNwaLTo_Ny50BUQ-1; Mon, 16 Mar 2020 06:13:31 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 64835100EB90; Mon, 16 Mar 2020 10:13:25 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1D88A29356; Mon, 16 Mar 2020 10:13:25 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 6BB9186FED; Mon, 16 Mar 2020 10:13:24 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02GADMco030232 for ; Mon, 16 Mar 2020 06:13:22 -0400 Received: by smtp.corp.redhat.com (Postfix) id 824121BC6D; Mon, 16 Mar 2020 10:13:22 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id BBA9993517; Mon, 16 Mar 2020 10:13:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584353613; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=+Pny82AB1obWw4jLPzLw/Ys109WYSyPSOPAQbg7Ob/E=; b=gNrkdO9ksRkeEfS65nnR2XdKzJNkcsmFREFs6/PQUUaE0frwpSulzKaMd0+PclsgMUyJN0 9I3dEriH2iar+snOLesGvCcLBua/KdZdjPQGRJXNCShoAdAX+zo9jpeKFs3I9n18gLWkHQ ovjH2vYN9aXBKsbGP+EvMM94ncadcfM= X-MC-Unique: BCDB_JhoNwaLTo_Ny50BUQ-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH v2 3/5] qemuDomainSecretAESSetup: Allocate and return 'secinfo' here Date: Mon, 16 Mar 2020 11:13:05 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: Peter Krempa X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Rather than passing in an empty qemuDomainSecretInfoPtr allocate it in this function and return it. This is done by absorbing the check from qemuDomainSecretInfoNew and removing the internals of qemuDomainSecretInfoNew. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_domain.c | 53 ++++++++++++++++++------------------------ 1 file changed, 22 insertions(+), 31 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index e33d3099d6..e83301d84e 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -1521,21 +1521,20 @@ qemuDomainSecretPlainSetup(qemuDomainSecretInfoPtr = secinfo, * @seclookupdef: Pointer to seclookupdef data * @isLuks: True/False for is for luks (alias generation) * - * Taking a secinfo, fill in the AES specific information using the + * Encrypts a secret looked up via @seclookupdef for use with qemu. * - * Returns 0 on success, -1 on failure with error message + * Returns qemuDomainSecretInfoPtr filled with the necessary information. */ -static int +static qemuDomainSecretInfoPtr qemuDomainSecretAESSetup(qemuDomainObjPrivatePtr priv, - qemuDomainSecretInfoPtr secinfo, const char *srcalias, virSecretUsageType usageType, const char *username, virSecretLookupTypeDefPtr seclookupdef, bool isLuks) { + g_autoptr(qemuDomainSecretInfo) secinfo =3D NULL; g_autoptr(virConnect) conn =3D virGetConnectSecret(); - int ret =3D -1; g_autofree uint8_t *raw_iv =3D NULL; size_t ivlen =3D QEMU_DOMAIN_AES_IV_LEN; uint8_t *secret =3D NULL; @@ -1544,19 +1543,27 @@ qemuDomainSecretAESSetup(qemuDomainObjPrivatePtr pr= iv, size_t ciphertextlen =3D 0; if (!conn) - return -1; + return NULL; + + if (!qemuDomainSupportsEncryptedSecret(priv)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("encrypted secrets are not supported")); + return NULL; + } + + secinfo =3D g_new0(qemuDomainSecretInfo, 1); secinfo->type =3D VIR_DOMAIN_SECRET_INFO_TYPE_AES; secinfo->s.aes.username =3D g_strdup(username); if (!(secinfo->s.aes.alias =3D qemuDomainGetSecretAESAlias(srcalias, i= sLuks))) - return -1; + return NULL; raw_iv =3D g_new0(uint8_t, ivlen); /* Create a random initialization vector */ if (virRandomBytes(raw_iv, ivlen) < 0) - return -1; + return NULL; /* Encode the IV and save that since qemu will need it */ secinfo->s.aes.iv =3D g_base64_encode(raw_iv, ivlen); @@ -1564,13 +1571,13 @@ qemuDomainSecretAESSetup(qemuDomainObjPrivatePtr pr= iv, /* Grab the unencoded secret */ if (virSecretGetSecretString(conn, seclookupdef, usageType, &secret, &secretlen) < 0) - goto cleanup; + goto error; if (virCryptoEncryptData(VIR_CRYPTO_CIPHER_AES256CBC, priv->masterKey, QEMU_DOMAIN_MASTER_KEY_LEN, raw_iv, ivlen, secret, secretlen, &ciphertext, &ciphertextlen) < 0) - goto cleanup; + goto error; /* Clear out the secret */ memset(secret, 0, secretlen); @@ -1579,11 +1586,11 @@ qemuDomainSecretAESSetup(qemuDomainObjPrivatePtr pr= iv, secinfo->s.aes.ciphertext =3D g_base64_encode(ciphertext, ciphertextlen); - ret =3D 0; + return g_steal_pointer(&secinfo); - cleanup: + error: VIR_DISPOSE_N(secret, secretlen); - return ret; + return NULL; } @@ -1655,24 +1662,8 @@ qemuDomainSecretInfoNew(qemuDomainObjPrivatePtr priv, virSecretLookupTypeDefPtr lookupDef, bool isLuks) { - qemuDomainSecretInfoPtr secinfo =3D NULL; - - if (!qemuDomainSupportsEncryptedSecret(priv)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("encrypted secrets are not supported")); - return NULL; - } - - if (VIR_ALLOC(secinfo) < 0) - return NULL; - - if (qemuDomainSecretAESSetup(priv, secinfo, srcAlias, usageType, usern= ame, - lookupDef, isLuks) < 0) { - g_clear_pointer(&secinfo, qemuDomainSecretInfoFree); - return NULL; - } - - return secinfo; + return qemuDomainSecretAESSetup(priv, srcAlias, usageType, username, + lookupDef, isLuks); } --=20 2.24.1 From nobody Fri May 17 06:54:08 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584353620; cv=none; d=zohomail.com; s=zohoarc; b=FWcH8FrFp5DPIfUvAzBci5QcS7qycmSRhZtV53jyaUHcNuEQqbYsHv1sOCGrSKU5FVRhEii2CBq3lxGQug1jG+qwwdd8xRO+bn6WV8hdANPjQ9gYrv+1Xr+fhpa5VjMbzYF8QEZRdW+XwoMBcC9ijIt0P7vVcpqEuBRXAi4SZyc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584353620; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=UiD+ZB7yhDMzyfvhWC3i5OgSJd5x2Iy22DznT9B31zk=; b=ehDeF57dDCb4tA0Ez2pN6hpg6McEII/tuaWYlddFer/ceCnGy5xGsbDHW1x/WOZQF1SKWOlDvvSF0RpkiymO7gVoe9zZYl3woUUy1OxLJMfHNZso7f9Dqvl2kRh/6/LWvufdlarauBV3crGewhdHGEqwI+Q/ED4IHQJM0zi6irk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1584353620404189.50069429496705; Mon, 16 Mar 2020 03:13:40 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-392-VnZljBpZOzisFzc1fs4Ejw-1; Mon, 16 Mar 2020 06:13:36 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 124C91906810; Mon, 16 Mar 2020 10:13:31 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CF58B272A5; Mon, 16 Mar 2020 10:13:30 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 8080F86FED; Mon, 16 Mar 2020 10:13:30 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02GADSBc030242 for ; Mon, 16 Mar 2020 06:13:28 -0400 Received: by smtp.corp.redhat.com (Postfix) id 597599352B; Mon, 16 Mar 2020 10:13:28 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 497871BC6D; Mon, 16 Mar 2020 10:13:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584353619; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=UiD+ZB7yhDMzyfvhWC3i5OgSJd5x2Iy22DznT9B31zk=; b=KgbzDhfgmzzmFFAO9iwtNk66RKe6WAqjUcFIqqFR1q8gvaB1gz2K9eBfHseh7fC5/tEpX/ YtpYyn5JKy7sUDkQZcL7aQ3P0wCs2SC5ODEUT3pKL3UhZeE/YovCgd5IF03KlSCyrgYNhA fq9SLsZyi4bXkO+SWQv/byso8A4RN9Y= X-MC-Unique: VnZljBpZOzisFzc1fs4Ejw-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH v2 4/5] qemuDomainSecretAESSetup: Split out lookup of secret data Date: Mon, 16 Mar 2020 11:13:06 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: Peter Krempa X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Split out the lookup of the secret from the secret driver into qemuDomainSecretAESSetupFromSecret so that we can also instantiate secret objects in qemu with data from other sources. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_domain.c | 87 ++++++++++++++++++++++++++---------------- 1 file changed, 54 insertions(+), 33 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index e83301d84e..ba80bb67d2 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -1514,37 +1514,28 @@ qemuDomainSecretPlainSetup(qemuDomainSecretInfoPtr = secinfo, /* qemuDomainSecretAESSetup: * @priv: pointer to domain private object - * @secinfo: Pointer to secret info - * @srcalias: Alias of the disk/hostdev used to generate the secret alias - * @usageType: The virSecretUsageType - * @username: username to use for authentication (may be NULL) - * @seclookupdef: Pointer to seclookupdef data - * @isLuks: True/False for is for luks (alias generation) + * @alias: alias of the secret + * @username: username to use (may be NULL) + * @secret: secret data + * @secretlen: length of @secret * - * Encrypts a secret looked up via @seclookupdef for use with qemu. + * Encrypts @secret for use with qemu. * * Returns qemuDomainSecretInfoPtr filled with the necessary information. */ static qemuDomainSecretInfoPtr qemuDomainSecretAESSetup(qemuDomainObjPrivatePtr priv, - const char *srcalias, - virSecretUsageType usageType, + const char *alias, const char *username, - virSecretLookupTypeDefPtr seclookupdef, - bool isLuks) + uint8_t *secret, + size_t secretlen) { g_autoptr(qemuDomainSecretInfo) secinfo =3D NULL; - g_autoptr(virConnect) conn =3D virGetConnectSecret(); g_autofree uint8_t *raw_iv =3D NULL; size_t ivlen =3D QEMU_DOMAIN_AES_IV_LEN; - uint8_t *secret =3D NULL; - size_t secretlen =3D 0; g_autofree uint8_t *ciphertext =3D NULL; size_t ciphertextlen =3D 0; - if (!conn) - return NULL; - if (!qemuDomainSupportsEncryptedSecret(priv)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("encrypted secrets are not supported")); @@ -1554,11 +1545,9 @@ qemuDomainSecretAESSetup(qemuDomainObjPrivatePtr pri= v, secinfo =3D g_new0(qemuDomainSecretInfo, 1); secinfo->type =3D VIR_DOMAIN_SECRET_INFO_TYPE_AES; + secinfo->s.aes.alias =3D g_strdup(alias); secinfo->s.aes.username =3D g_strdup(username); - if (!(secinfo->s.aes.alias =3D qemuDomainGetSecretAESAlias(srcalias, i= sLuks))) - return NULL; - raw_iv =3D g_new0(uint8_t, ivlen); /* Create a random initialization vector */ @@ -1568,29 +1557,61 @@ qemuDomainSecretAESSetup(qemuDomainObjPrivatePtr pr= iv, /* Encode the IV and save that since qemu will need it */ secinfo->s.aes.iv =3D g_base64_encode(raw_iv, ivlen); - /* Grab the unencoded secret */ - if (virSecretGetSecretString(conn, seclookupdef, usageType, - &secret, &secretlen) < 0) - goto error; - if (virCryptoEncryptData(VIR_CRYPTO_CIPHER_AES256CBC, priv->masterKey, QEMU_DOMAIN_MASTER_KEY_LEN, raw_iv, ivlen, secret, secretlen, &ciphertext, &ciphertextlen) < 0) - goto error; - - /* Clear out the secret */ - memset(secret, 0, secretlen); + return NULL; /* Now encode the ciphertext and store to be passed to qemu */ secinfo->s.aes.ciphertext =3D g_base64_encode(ciphertext, ciphertextlen); return g_steal_pointer(&secinfo); +} + + +/** + * qemuDomainSecretAESSetupFromSecret: + * @priv: pointer to domain private object + * @srcalias: Alias of the disk/hostdev used to generate the secret alias + * @usageType: The virSecretUsageType + * @username: username to use for authentication (may be NULL) + * @seclookupdef: Pointer to seclookupdef data + * @isLuks: True/False for is for luks (alias generation) + * + * Looks up a secret in the secret driver based on @usageType and @seclook= updef + * and builds qemuDomainSecretInfoPtr from it. + */ +static qemuDomainSecretInfoPtr +qemuDomainSecretAESSetupFromSecret(qemuDomainObjPrivatePtr priv, + const char *srcalias, + virSecretUsageType usageType, + const char *username, + virSecretLookupTypeDefPtr seclookupdef, + bool isLuks) +{ + g_autoptr(virConnect) conn =3D virGetConnectSecret(); + qemuDomainSecretInfoPtr secinfo; + g_autofree char *alias =3D NULL; + uint8_t *secret =3D NULL; + size_t secretlen =3D 0; + + if (!conn) + return NULL; + + if (!(alias =3D qemuDomainGetSecretAESAlias(srcalias, isLuks))) + return NULL; + + if (virSecretGetSecretString(conn, seclookupdef, usageType, + &secret, &secretlen) < 0) + return NULL; + + secinfo =3D qemuDomainSecretAESSetup(priv, alias, username, secret, se= cretlen); - error: VIR_DISPOSE_N(secret, secretlen); - return NULL; + + return secinfo; } @@ -1662,8 +1683,8 @@ qemuDomainSecretInfoNew(qemuDomainObjPrivatePtr priv, virSecretLookupTypeDefPtr lookupDef, bool isLuks) { - return qemuDomainSecretAESSetup(priv, srcAlias, usageType, username, - lookupDef, isLuks); + return qemuDomainSecretAESSetupFromSecret(priv, srcAlias, usageType, u= sername, + lookupDef, isLuks); } --=20 2.24.1 From nobody Fri May 17 06:54:08 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584353627; cv=none; d=zohomail.com; s=zohoarc; b=hxGcPR27+ARgerhyeoduwZsj0pwoGrsYyVOhncqXMBYw8sfZiRLe6S7ibQiL43Ojm3Fgs0kj7PiiiQg61NpMnShdK3R9ALIxe3FOMzKXb0GMOYJFNpf2XJOgO8Gx675PVxbuevuAiakCCWWr14i3qF8qSzzb3cA8K9xNNPe9ruM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584353627; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=taRoL0HUFoA01KeItERnyhFVxoFZc6ptPXTrDjX7X5A=; b=Ma+Kri/aAccelPaVCfUgTZ2xDVGDEAKiGUh6ergbgwhDxI+6tnmI3z11PVcGfaBcJGr4tpAjME4I4voRurLx+1mp5h8ybATcHSD6il9rWRRseV+VYl5pbgCqJiF8+akIElKaTJDdx1Wko/bb0TxEOrpLOzwJqlwcXCh8QpFvYRk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1584353627767624.2985000212498; Mon, 16 Mar 2020 03:13:47 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-195-HhNgKFGqN9-RpQ1iWxR2yg-1; Mon, 16 Mar 2020 06:13:44 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E87E81083E9B; Mon, 16 Mar 2020 10:13:38 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B495F907FB; Mon, 16 Mar 2020 10:13:38 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 613D3182B00E; Mon, 16 Mar 2020 10:13:38 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02GADasU030256 for ; Mon, 16 Mar 2020 06:13:36 -0400 Received: by smtp.corp.redhat.com (Postfix) id E719293535; Mon, 16 Mar 2020 10:13:36 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8DB4392D0C; Mon, 16 Mar 2020 10:13:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584353626; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=taRoL0HUFoA01KeItERnyhFVxoFZc6ptPXTrDjX7X5A=; b=V/PAA6PTqryOwRKPQeiFHRGZSJCv+XsLqnneAdAVo609F4KD/tY8DZxXMoUKb6RMVZf4p1 q9ZJ1CKc9HnEwdexdSqVXLVmpT67Eym308GsDWeLEnmvB7eYcvet8eGtSmZiuTlm0hgVK8 y51zV9sjKfbMKJkVMvOL3Qle3xnrfLA= X-MC-Unique: HhNgKFGqN9-RpQ1iWxR2yg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH v2 5/5] Remove qemuDomainSecretInfoNew Date: Mon, 16 Mar 2020 11:13:07 +0100 Message-Id: <725954384db5cd03c3208f8862fe8de5fb62e6b0.1584353498.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: Peter Krempa X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Replace it by a direct call to qemuDomainSecretAESSetupFromSecret. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_domain.c | 53 +++++++++++------------------------------- 1 file changed, 13 insertions(+), 40 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index ba80bb67d2..f74a1b6fb3 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -1661,33 +1661,6 @@ qemuDomainSecretInfoNewPlain(virSecretUsageType usag= eType, } -/* qemuDomainSecretInfoNew: - * @priv: pointer to domain private object - * @srcAlias: Alias base to use for TLS object - * @usageType: Secret usage type - * @username: username - * @looupDef: lookup def describing secret - * @isLuks: boolean for luks lookup - * - * Helper function to create a secinfo to be used for secinfo consumers. T= his - * sets up encrypted data to be used with qemu's 'secret' object. - * - * Returns @secinfo on success, NULL on failure. Caller is responsible - * to eventually free @secinfo. - */ -static qemuDomainSecretInfoPtr -qemuDomainSecretInfoNew(qemuDomainObjPrivatePtr priv, - const char *srcAlias, - virSecretUsageType usageType, - const char *username, - virSecretLookupTypeDefPtr lookupDef, - bool isLuks) -{ - return qemuDomainSecretAESSetupFromSecret(priv, srcAlias, usageType, u= sername, - lookupDef, isLuks); -} - - /** * qemuDomainSecretInfoTLSNew: * @priv: pointer to domain private object @@ -1714,9 +1687,9 @@ qemuDomainSecretInfoTLSNew(qemuDomainObjPrivatePtr pr= iv, } seclookupdef.type =3D VIR_SECRET_LOOKUP_TYPE_UUID; - return qemuDomainSecretInfoNew(priv, srcAlias, - VIR_SECRET_USAGE_TYPE_TLS, NULL, - &seclookupdef, false); + return qemuDomainSecretAESSetupFromSecret(priv, srcAlias, + VIR_SECRET_USAGE_TYPE_TLS, + NULL, &seclookupdef, false); } @@ -1806,11 +1779,11 @@ qemuDomainSecretStorageSourcePrepare(qemuDomainObjP= rivatePtr priv, src->auth->use= rname, &src->auth->se= clookupdef); } else { - srcPriv->secinfo =3D qemuDomainSecretInfoNew(priv, authalias, - usageType, - src->auth->username, - &src->auth->seclook= updef, - false); + srcPriv->secinfo =3D qemuDomainSecretAESSetupFromSecret(priv, = authalias, + usageTyp= e, + src->aut= h->username, + &src->au= th->seclookupdef, + false); } if (!srcPriv->secinfo) @@ -1818,11 +1791,11 @@ qemuDomainSecretStorageSourcePrepare(qemuDomainObjP= rivatePtr priv, } if (hasEnc) { - if (!(srcPriv->encinfo =3D - qemuDomainSecretInfoNew(priv, encalias, - VIR_SECRET_USAGE_TYPE_VOLUME, NULL, - &src->encryption->secrets[0]->secloo= kupdef, - true))) + if (!(srcPriv->encinfo =3D qemuDomainSecretAESSetupFromSecret(priv= , encalias, + VIR_SE= CRET_USAGE_TYPE_VOLUME, + NULL, + &src->= encryption->secrets[0]->seclookupdef, + true))) return -1; } --=20 2.24.1