From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5BEF5C433F5 for ; Sun, 3 Oct 2021 09:23:38 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CF11D61B2B for ; Sun, 3 Oct 2021 09:23:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org CF11D61B2B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=canonical.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D24A4832CE; Sun, 3 Oct 2021 11:23:33 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=canonical.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.b="R7GeLsf4"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1AA4183314; Sun, 3 Oct 2021 11:23:31 +0200 (CEST) Received: from smtp-relay-canonical-1.canonical.com (smtp-relay-canonical-1.canonical.com [185.125.188.121]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 4EB71832CE for ; Sun, 3 Oct 2021 11:23:27 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=canonical.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=heinrich.schuchardt@canonical.com Received: from LT2ubnt.fritz.box (ip-88-152-144-157.hsi03.unitymediagroup.de [88.152.144.157]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-1.canonical.com (Postfix) with ESMTPSA id 6BB3F41A6C; Sun, 3 Oct 2021 09:23:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1633253005; bh=TCUoesan3/AwAcrT6y+4Th3vMqFMAzOndCYNwSL8QMU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=R7GeLsf4BhZvwhIjWjA60nVjoO/Nhq1HQ81x7+P8cbqKvPRfONg4FAay3lNzv5vqK larYEQvs1whVfIkdBNl+Hv0WIaQeDvcfmftSko0DSUV7/brpQaUM3iyAks4oBB5vFe SQmvtDchplMGiRAcSZWf090WqGrw24k0KZyL6j2gqVkbJ2c4cxSEIP9Nb+XZAa7G+Z EoVY9jUlJQAz6ZOQSs5ygbdFkRN4KB2jKAGU6A9+E0ZJGmhYMtOLZclxmQOn/NRol9 Ab8fSuTpVT9nZ0QVxzdefupQlVV+otLbOm6QaM05lNy2iUruZ/r/wKMKaHB6IjZskT +v9jYMxfUgF1Q== From: Heinrich Schuchardt To: u-boot@lists.denx.de Cc: Alexander Graf , Ilias Apalodimas , Masahisa Kojima , AKASHI Takahiro , Sughosh Ganu , Heinrich Schuchardt Subject: [PATCH v3 3/4] efi_loader: simplify efi_sigstore_parse_sigdb() Date: Sun, 3 Oct 2021 11:23:19 +0200 Message-Id: <20211003092320.4671-4-heinrich.schuchardt@canonical.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211003092320.4671-1-heinrich.schuchardt@canonical.com> References: <20211003092320.4671-1-heinrich.schuchardt@canonical.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean Simplify efi_sigstore_parse_sigdb() by using existing functions. Signed-off-by: Heinrich Schuchardt --- v3: Keep error handling in efi_sigstore_parse_sigdb() v2: remove a superfluous check --- lib/efi_loader/efi_signature.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/lib/efi_loader/efi_signature.c b/lib/efi_loader/efi_signature.c index bdd09881fc..97f6dfacd9 100644 --- a/lib/efi_loader/efi_signature.c +++ b/lib/efi_loader/efi_signature.c @@ -746,18 +746,11 @@ struct efi_signature_store *efi_sigstore_parse_sigdb(u16 *name) efi_uintn_t db_size; efi_status_t ret; - if (!u16_strcmp(name, L"PK") || !u16_strcmp(name, L"KEK")) { - vendor = &efi_global_variable_guid; - } else if (!u16_strcmp(name, L"db") || !u16_strcmp(name, L"dbx")) { - vendor = &efi_guid_image_security_database; - } else { - EFI_PRINT("unknown signature database, %ls\n", name); - return NULL; - } + vendor = efi_auth_var_get_guid(name); /* retrieve variable data */ db_size = 0; - ret = EFI_CALL(efi_get_variable(name, vendor, NULL, &db_size, NULL)); + ret = efi_get_variable_int(name, vendor, NULL, &db_size, NULL); if (ret == EFI_NOT_FOUND) { EFI_PRINT("variable, %ls, not found\n", name); sigstore = calloc(sizeof(*sigstore), 1); -- 2.32.0