From patchwork Mon Dec 25 05:26:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Yong Huang X-Patchwork-Id: 1880034 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=smartx-com.20230601.gappssmtp.com header.i=@smartx-com.20230601.gappssmtp.com header.a=rsa-sha256 header.s=20230601 header.b=Bs7SehCn; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Sz61q6TMfz20RL for ; Mon, 25 Dec 2023 16:30:37 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rHdWq-000515-Bz; Mon, 25 Dec 2023 00:29:28 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rHdWo-00050S-3v for qemu-devel@nongnu.org; Mon, 25 Dec 2023 00:29:26 -0500 Received: from mail-oi1-x22b.google.com ([2607:f8b0:4864:20::22b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rHdWm-0007HU-NS for qemu-devel@nongnu.org; Mon, 25 Dec 2023 00:29:25 -0500 Received: by mail-oi1-x22b.google.com with SMTP id 5614622812f47-3ba52d0f9feso2842025b6e.0 for ; Sun, 24 Dec 2023 21:27:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=smartx-com.20230601.gappssmtp.com; s=20230601; t=1703482043; x=1704086843; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=R3WxEzglk8uoFov+TGXHb/niKmhlgSt8io2ZCxKmYxI=; b=Bs7SehCnxRBeV2tRxh+Z5xMDTfEki0yR+qEG5KyDNm2NVYKFS0KZKVePFgYJRp87yb EEa8URHjXpW2WgcVKR1LVU0boie/TH5VsK4vqtLUJiQGjXQ1bt+qZp2HXP4XHT4N0vmi 3Hn3+RLPrkTIIiYBGVDvFQkkwPMxDG3sjpKUY6nKAnP8Vs83AKFZb6QJjaWPEhsC2VrQ kcIEa1FuxymUPaBhWI/TqjirPLD/jK5IyfAqxHoSWPOQqeZcMrwaLF0mkKUavhQgIQbW byZVr4MEd+nQ5P/0SFoZJ1lOLeYPkRHkCbwdnAy6P9YTCkaWzS2VgrQ3V7pGmXFpoAzX phcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703482043; x=1704086843; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=R3WxEzglk8uoFov+TGXHb/niKmhlgSt8io2ZCxKmYxI=; b=phoxsuxyDe8WMqijVY9AnnJTdKPTaFTFWGHRe+YN3Xxd9bF2q30WC5lWn/1kLpHQlz jSwlpzggie5IFEY+zUGJIkfCe68TkdNG7smCAONdvKwVWfp6jySJL89BdbWCAG8Zewn7 KPAoqPgUUlNe0LsUGdKZ7w9AKCj6Lg+hC/+T4yUGKU5WGj/5Y5+IHMvwcEBPvLhA44uF kTl0CxDpAxN8BCqtf01DVZvXWUW1BuUhIlCuM3Fa82nPD6Ica3G2nd+TbSoCb9ds7MWS ZfvhkPO1d+ULQbqEJ0yg+j74wEdECrz/mZ4wPgPEDYZU/99gAXX28QwkM/v3rdyj9YY0 Ua2g== X-Gm-Message-State: AOJu0Yz/mu5zs569GJw2kDqgWLGnORrwyoFi1z88FzxYSp7owaptuoB9 oiznzdIbcFn96OrI46fRKtAVRLFxEOhexYVDX1zlA0EGc4nGAg== X-Google-Smtp-Source: AGHT+IGObvQGA/FjvNuLDp8F9M+flWpqSWsYErTJcf2NXrBbZ10T2NGAFz6890VrWB6rMQ+iZ2opmQ== X-Received: by 2002:a05:6808:1493:b0:3bb:9636:1c04 with SMTP id e19-20020a056808149300b003bb96361c04mr4303647oiw.22.1703482042531; Sun, 24 Dec 2023 21:27:22 -0800 (PST) Received: from localhost.localdomain ([118.114.58.28]) by smtp.gmail.com with ESMTPSA id f7-20020aa79d87000000b006d991505b4csm4555800pfq.76.2023.12.24.21.27.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Dec 2023 21:27:22 -0800 (PST) From: Hyman Huang To: qemu-devel Cc: Kevin Wolf , =?utf-8?q?Daniel_P_=2E_Berrang=C3=A9?= , Hanna Reitz , Eric Blake , Markus Armbruster , Hyman Huang Subject: [v3 01/10] crypto: Introduce option and structure for detached LUKS header Date: Mon, 25 Dec 2023 13:26:51 +0800 Message-Id: X-Mailer: git-send-email 2.39.1 In-Reply-To: References: MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::22b; envelope-from=yong.huang@smartx.com; helo=mail-oi1-x22b.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Add the "header" option for the LUKS format. This field would be used to identify the blockdev's position where a detachable LUKS header is stored. In addition, introduce header field in struct BlockCrypto Signed-off-by: Hyman Huang Reviewed-by: Daniel P. Berrangé Message-Id: <5b99f60c7317092a563d7ca3fb4b414197015eb2.1701879996.git.yong.huang@smartx.com> --- block/crypto.c | 1 + qapi/block-core.json | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/block/crypto.c b/block/crypto.c index 921933a5e5..f82b13d32b 100644 --- a/block/crypto.c +++ b/block/crypto.c @@ -39,6 +39,7 @@ typedef struct BlockCrypto BlockCrypto; struct BlockCrypto { QCryptoBlock *block; bool updating_keys; + BdrvChild *header; /* Reference to the detached LUKS header */ }; diff --git a/qapi/block-core.json b/qapi/block-core.json index ca390c5700..10be08d08f 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -3352,11 +3352,15 @@ # decryption key (since 2.6). Mandatory except when doing a # metadata-only probe of the image. # +# @header: optional reference to the location of a blockdev +# storing a detached LUKS header. (since 9.0) +# # Since: 2.9 ## { 'struct': 'BlockdevOptionsLUKS', 'base': 'BlockdevOptionsGenericFormat', - 'data': { '*key-secret': 'str' } } + 'data': { '*key-secret': 'str', + '*header': 'BlockdevRef'} } ## # @BlockdevOptionsGenericCOWFormat: