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 E1D91C433EF for ; Wed, 6 Oct 2021 06:29:22 +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 3494C60EC0 for ; Wed, 6 Oct 2021 06:29:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 3494C60EC0 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org 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 32676831BB; Wed, 6 Oct 2021 08:29:20 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org 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=linaro.org header.i=@linaro.org header.b="iHrmagVo"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8CCB2831D8; Wed, 6 Oct 2021 08:29:18 +0200 (CEST) Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 75180831B2 for ; Wed, 6 Oct 2021 08:29:15 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=ilias.apalodimas@linaro.org Received: by mail-wr1-x429.google.com with SMTP id s15so5311243wrv.11 for ; Tue, 05 Oct 2021 23:29:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=D4jy5hwGKTNBY+5x8D2oa30qeXwBxMlBwnTkcldkWtE=; b=iHrmagVowBO7JV3KY7XBKaHtsUWUcrzI2Xbdi8Lu6i98b8jf8+PflAPVxI/q9j1ug/ Ar9ijiCgtBnUZMGZoaZTXf1RGIearLWX3E0WwtcRA3s8F9Il1elJRhDiUQN9BkxuSzvN EGEHpGh8ByQ9jVCwwF8PRw1zdgG4vcYL5qmGHQ9rtj/+uV0v3xrV3e+Mcd94dYh+pb7g 9/0wn/+22ft66CgwUeFvtOPO/OYdaOslSQOp+SrE/5p/LSx1XbS6GinugJ0ilJSDRCfF EBO2yDZ71BbRbdoJwjsY7JC+ut3limjvRLzAPVdcANTa8zohvfJaF/N9siw5BaKkYe84 tzpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=D4jy5hwGKTNBY+5x8D2oa30qeXwBxMlBwnTkcldkWtE=; b=iudvfqsUnkf7FscNi8oi8juuSpxxSaWs+hw4JCjx3X1s3ldAFfOHCNT+Ma3Gy7thP6 ZjD6bzqJ4z8PStz9AsxgMDjStKUFRMnjHlPZYLgK4dMuluJJrHbiyrh031zdkpVQ1yxQ +bHn+VXdqUViuMfi6I1u5HSz6XhDVamDeh7pSDpW2Lz7rQjdUosWquYMpKNa5fbGw2Mf KYs+A9C0aEKDETM5+TnZFwm/mbh8ZVjHs/vrM+04k4IN4Q2BlIlkp8LpGzQTVnL5UzQ0 9QcMf3FSD+AbvO78fYnF4VQhcOVR6DYkqy7w2gU/UKXWQNVl7Ypo0iFnspf4rVde+HRW hUaw== X-Gm-Message-State: AOAM533CpHnd2gAv5aHX9tO/f4ESufUvBOV4osSfeOVy3WUifjw3oVkt QztyQJHVw9KKz0/mbC5AoDexAA== X-Google-Smtp-Source: ABdhPJxtFP9dStcBZ7YioohA5U9z7XtA5/ysPfwGb/3QRzEw2SlLzrb5VaaYnQanLHB0xFW770QOKA== X-Received: by 2002:a05:600c:210d:: with SMTP id u13mr7931800wml.146.1633501755034; Tue, 05 Oct 2021 23:29:15 -0700 (PDT) Received: from apalos.home (ppp-94-66-220-209.home.otenet.gr. [94.66.220.209]) by smtp.gmail.com with ESMTPSA id 1sm4065490wmb.24.2021.10.05.23.29.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Oct 2021 23:29:14 -0700 (PDT) Date: Wed, 6 Oct 2021 09:29:12 +0300 From: Ilias Apalodimas To: Heinrich Schuchardt Cc: u-boot@lists.denx.de, Alexander Graf , Masahisa Kojima , AKASHI Takahiro , Sughosh Ganu Subject: Re: [PATCH v3 3/4] efi_loader: simplify efi_sigstore_parse_sigdb() Message-ID: References: <20211003092320.4671-1-heinrich.schuchardt@canonical.com> <20211003092320.4671-4-heinrich.schuchardt@canonical.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211003092320.4671-4-heinrich.schuchardt@canonical.com> 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 On Sun, Oct 03, 2021 at 11:23:19AM +0200, Heinrich Schuchardt wrote: > 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); Should we return NULL if we get back the default guid? > > /* 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 > Regards /Ilias