From: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
To: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Cc: U-Boot Mailing List <u-boot@lists.denx.de>,
Alexander Graf <agraf@csgraf.de>,
Masahisa Kojima <masahisa.kojima@linaro.org>,
AKASHI Takahiro <takahiro.akashi@linaro.org>,
Sughosh Ganu <sughosh.ganu@linaro.org>
Subject: Re: [PATCH v3 3/4] efi_loader: simplify efi_sigstore_parse_sigdb()
Date: Wed, 6 Oct 2021 15:15:47 +0200 [thread overview]
Message-ID: <ab5f5e8b-e8ac-dcf5-5187-0be591cd94e5@canonical.com> (raw)
In-Reply-To: <CAC_iWjLLwFKvDAm1msMixN_wOQ2ZTWXAx8dUMAU1GPQyZEzHpw@mail.gmail.com>
On 10/6/21 10:02, Ilias Apalodimas wrote:
> On Wed, 6 Oct 2021 at 10:21, Heinrich Schuchardt
> <heinrich.schuchardt@canonical.com> wrote:
>>
>>
>>
>> On 10/6/21 08:29, Ilias Apalodimas wrote:
>>> 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 <heinrich.schuchardt@canonical.com>
>>>> ---
>>>> 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?
>>
>> efi_sigstore_parse_sigdb() is only called with fixed values of 'name'.
>> So how should this occur?
>
> Bugs that slip through maybe? I generally prefer being more pedantic
> with security related code
PK and KEK use efi_global_variable_guid and will be used as argument for
efi_sigstore_parse_sigdb(). Your proposed check would break the code.
Best regards
Heinrich
>
> Regards
> /Ilias
>>
>> Best regards
>>
>> Heinrich
>>
>>>
>>>>
>>>> /* 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
>>>
next prev parent reply other threads:[~2021-10-06 13:16 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-03 9:23 [PATCH v3 0/4] efi_loader: centralize known vendor GUIDs Heinrich Schuchardt
2021-10-03 9:23 ` [PATCH v3 1/4] efi_loader: treat UEFI variable name as const Heinrich Schuchardt
2021-10-06 6:27 ` Ilias Apalodimas
2021-10-03 9:23 ` [PATCH v3 2/4] efi_loader: function to get GUID for variable name Heinrich Schuchardt
2021-10-06 6:25 ` Ilias Apalodimas
2021-10-03 9:23 ` [PATCH v3 3/4] efi_loader: simplify efi_sigstore_parse_sigdb() Heinrich Schuchardt
2021-10-06 6:29 ` Ilias Apalodimas
2021-10-06 7:21 ` Heinrich Schuchardt
2021-10-06 8:02 ` Ilias Apalodimas
2021-10-06 13:15 ` Heinrich Schuchardt
2021-10-06 13:15 ` Heinrich Schuchardt [this message]
2021-10-06 14:05 ` Ilias Apalodimas
2021-10-07 5:54 ` Heinrich Schuchardt
2021-10-07 10:43 ` Ilias Apalodimas
2021-10-03 9:23 ` [PATCH v3 4/4] efi_loader: simplify tcg2_measure_secure_boot_variable() Heinrich Schuchardt
2021-10-06 6:26 ` Ilias Apalodimas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ab5f5e8b-e8ac-dcf5-5187-0be591cd94e5@canonical.com \
--to=heinrich.schuchardt@canonical.com \
--cc=agraf@csgraf.de \
--cc=ilias.apalodimas@linaro.org \
--cc=masahisa.kojima@linaro.org \
--cc=sughosh.ganu@linaro.org \
--cc=takahiro.akashi@linaro.org \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox