From nobody Sat Feb 7 07:31:22 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+39687+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+39687+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1556326450; cv=none; d=zoho.com; s=zohoarc; b=OGVV0DpzHpfC4P0yWnQxNncQYa5L1jWKR+6wYylf/Medh/hFOxj6JyaTtmKcV7l0OYdG7bXlTqIfFO023pbOqDMKXgEp+szp3StPrcKclBUjBIOg1Ul7D9GtkEh0KBL2ceeyRpqDOoCsNSkcWD4+rAbU9jiIl/S3YtK6CcygDLo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1556326450; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=vMqAgTPH7E8DmYgcrl9kg82Ttj5F5bYoTvdATr0px+A=; b=ZJHfw+7yzZE4WoreZ0Cn65UsXZJesGnaYCZ3CNIPjyb30dV+2Mwf95kuwXs8v6h9nHnJ92htgj2OammAYtzibfkhidbu+r2S7iUwYwugqbnPChJh6fEKAodiQ/Be8b5Ltv50h9kK6dSbiv+4IVCJZvjnGw5Rt2w+GB+/9DWtoWM= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+39687+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1556326450609339.25245301666064; Fri, 26 Apr 2019 17:54:10 -0700 (PDT) Return-Path: X-Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by groups.io with SMTP; Fri, 26 Apr 2019 17:54:09 -0700 X-Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 31A576EB97; Sat, 27 Apr 2019 00:54:09 +0000 (UTC) X-Received: from lacos-laptop-7.usersys.redhat.com (ovpn-121-104.rdu2.redhat.com [10.10.121.104]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4F67C5D70A; Sat, 27 Apr 2019 00:54:07 +0000 (UTC) From: "Laszlo Ersek" To: edk2-devel-groups-io Cc: Anthony Perard , Ard Biesheuvel , Jordan Justen , Julien Grall Subject: [edk2-devel] [PATCH 12/16] OvmfPkg/EnrollDefaultKeys: describe functions with leading comment blocks Date: Sat, 27 Apr 2019 02:53:24 +0200 Message-Id: <20190427005328.27005-13-lersek@redhat.com> In-Reply-To: <20190427005328.27005-1-lersek@redhat.com> References: <20190427005328.27005-1-lersek@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Sat, 27 Apr 2019 00:54:09 +0000 (UTC) Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,lersek@redhat.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1556326450; bh=zIx6/4tKx/4UuIRdlMdEysj00OgeGXpJF1aGU36GbWg=; h=Cc:Date:From:Reply-To:Subject:To; b=dpr2wh/zYgZrRJmJpjgnYmS+o1jXTtlz4IyC1TYgmrZEarBunT0JaXcdBoSXuA0jzls lFN9ptbQ9ROvQ0A+J/Lfi3SjJnUA76DSRW5KvXojJim1MQdW0mdzflm3krWlYvpcxzP5+ oex+ozcCz449BAPFPssuRMWKC1APfEiyA7c= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" The GetExact(), GetSettings(), PrintSettings(), and ShellAppMain() functions lack leading comment blocks. Supply those. While at it, make sure that every such comment block is preceded by two blank lines. Cc: Anthony Perard Cc: Ard Biesheuvel Cc: Jordan Justen Cc: Julien Grall Bugzilla: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1747 Signed-off-by: Laszlo Ersek Reviewed-by: Philippe Mathieu-Daude --- OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.c | 73 ++++++++++++++++++++ 1 file changed, 73 insertions(+) diff --git a/OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.c b/OvmfPkg/Enroll= DefaultKeys/EnrollDefaultKeys.c index e4f6a50e008b..07297c631f38 100644 --- a/OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.c +++ b/OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.c @@ -13,16 +13,17 @@ #include // ASSERT() #include // FreePool() #include // ShellAppMain() #include // AsciiPrint() #include // gRT =20 #include "EnrollDefaultKeys.h" =20 + /** Enroll a set of certificates in a global variable, overwriting it. =20 The variable will be rewritten with NV+BS+RT+AT attributes. =20 @param[in] VariableName The name of the variable to overwrite. =20 @param[in] VendorGuid The namespace (ie. vendor GUID) of the variable= to @@ -188,16 +189,54 @@ Out: if (EFI_ERROR (Status)) { AsciiPrint ("error: %a(\"%s\", %g): %r\n", __FUNCTION__, VariableName, VendorGuid, Status); } return Status; } =20 =20 +/** + Read a UEFI variable into a caller-allocated buffer, enforcing an exact = size. + + @param[in] VariableName The name of the variable to read; passed to + gRT->GetVariable(). + + @param[in] VendorGuid The vendor (namespace) GUID of the variable to = read; + passed to gRT->GetVariable(). + + @param[out] Data The caller-allocated buffer that is supposed to + receive the variable's contents. On error, the + contents of Data are indeterminate. + + @param[in] DataSize The size in bytes that the caller requires the = UEFI + variable to have. The caller is responsible for + providing room for DataSize bytes in Data. + + @param[in] AllowMissing If FALSE, the variable is required to exist. If + TRUE, the variable is permitted to be missing. + + @retval EFI_SUCCESS The UEFI variable exists, has the required= size + (DataSize), and has been read into Data. + + @retval EFI_SUCCESS The UEFI variable doesn't exist, and + AllowMissing is TRUE. DataSize bytes in Da= ta + have been zeroed out. + + @retval EFI_NOT_FOUND The UEFI variable doesn't exist, and + AllowMissing is FALSE. + + @retval EFI_BUFFER_TOO_SMALL The UEFI variable exists, but its size is + greater than DataSize. + + @retval EFI_PROTOCOL_ERROR The UEFI variable exists, but its size is + smaller than DataSize. + + @return Error codes propagated from gRT->GetVariab= le(). +**/ STATIC EFI_STATUS GetExact ( IN CHAR16 *VariableName, IN EFI_GUID *VendorGuid, OUT VOID *Data, IN UINTN DataSize, IN BOOLEAN AllowMissing @@ -223,16 +262,41 @@ GetExact ( AsciiPrint ("error: GetVariable(\"%s\", %g): expected size 0x%Lx, " "got 0x%Lx\n", VariableName, VendorGuid, (UINT64)DataSize, (UINT64)S= ize); return EFI_PROTOCOL_ERROR; } =20 return EFI_SUCCESS; } =20 + +/** + Populate a SETTINGS structure from the underlying UEFI variables. + + The following UEFI variables are standard variables: + - L"SetupMode" (EFI_SETUP_MODE_NAME) + - L"SecureBoot" (EFI_SECURE_BOOT_MODE_NAME) + - L"VendorKeys" (EFI_VENDOR_KEYS_VARIABLE_NAME) + + The following UEFI variables are edk2 extensions: + - L"SecureBootEnable" (EFI_SECURE_BOOT_ENABLE_NAME) + - L"CustomMode" (EFI_CUSTOM_MODE_NAME) + + The L"SecureBootEnable" UEFI variable is permitted to be missing, in whi= ch + case the corresponding field in the SETTINGS object will be zeroed out. = The + rest of the covered UEFI variables are required to exist; otherwise, the + function will fail. + + @param[out] Settings The SETTINGS object to fill. + + @retval EFI_SUCCESS Settings has been populated. + + @return Error codes propagated from the GetExact() function= . The + contents of Settings are indeterminate. +**/ STATIC EFI_STATUS GetSettings ( OUT SETTINGS *Settings ) { EFI_STATUS Status; =20 @@ -261,28 +325,37 @@ GetSettings ( return Status; } =20 Status =3D GetExact (EFI_VENDOR_KEYS_VARIABLE_NAME, &gEfiGlobalVariableG= uid, &Settings->VendorKeys, sizeof Settings->VendorKeys, FALSE); return Status; } =20 + +/** + Print the contents of a SETTINGS structure to the UEFI console. + + @param[in] Settings The SETTINGS object to print the contents of. +**/ STATIC VOID PrintSettings ( IN CONST SETTINGS *Settings ) { AsciiPrint ("info: SetupMode=3D%d SecureBoot=3D%d SecureBootEnable=3D%d " "CustomMode=3D%d VendorKeys=3D%d\n", Settings->SetupMode, Settings->Se= cureBoot, Settings->SecureBootEnable, Settings->CustomMode, Settings->VendorKeys= ); } =20 =20 +/** + Entry point function of this shell application. +**/ INTN EFIAPI ShellAppMain ( IN UINTN Argc, IN CHAR16 **Argv ) { EFI_STATUS Status; --=20 2.19.1.3.g30247aa5d201 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#39687): https://edk2.groups.io/g/devel/message/39687 Mute This Topic: https://groups.io/mt/31359384/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-