From nobody Sun Apr 28 02:25:49 2024 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+46758+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+46758+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1567583560; cv=none; d=zoho.com; s=zohoarc; b=cj+D1UotIkRZmqsLyFiPSDyDuH8c6GkfZt6rf4PCxSE+11NpbYrZ7jMigOa5AWO03zBEG/BOtJuB6FLwvGCfUl3/WI1Od2RfLeYItKlldsp9byVvjkl/pIroni+SuFjGIN14Wen27r9lP2GXtxBolXP/9+JrDOLvLdmheoswPFQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1567583560; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To:ARC-Authentication-Results; bh=iomi2ZOsO1Pmu5NM2afw2pZszXdbNAFrJVvZrRdv9BE=; b=fzG8+Z7IbukU8o/rvc3YQGAR0HaueDoWK4A/w+wmA8+F0sMZeOnH1H9z77MUAAellS22R8aGin8HAg/waw0jSCa9i0SpCT1/RxYKhlUjNHSLQU4AhgwNcaIeBSbQuAie7KHHiwf2dx+6qSJfJ54Y9dWP7pymoCVe9HcVMasYmZ0= 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+46758+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 1567583560394665.9874284256769; Wed, 4 Sep 2019 00:52:40 -0700 (PDT) Return-Path: X-Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by groups.io with SMTP; Wed, 04 Sep 2019 00:52:39 -0700 X-Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3FCE011A07; Wed, 4 Sep 2019 07:52:39 +0000 (UTC) X-Received: from lacos-laptop-7.usersys.redhat.com (ovpn-117-125.ams2.redhat.com [10.36.117.125]) by smtp.corp.redhat.com (Postfix) with ESMTP id A6F066092D; Wed, 4 Sep 2019 07:52:35 +0000 (UTC) From: "Laszlo Ersek" To: edk2-devel-groups-io Cc: Ard Biesheuvel , Jordan Justen , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [edk2-devel] [PATCH v2] OvmfPkg/EnrollDefaultKeys: clean up Base64Decode() retval handling Date: Wed, 4 Sep 2019 09:52:33 +0200 Message-Id: <20190904075233.5005-1-lersek@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 04 Sep 2019 07:52:39 +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=1567583560; bh=HwM4+C9pELCQjuPMhkDy8N6qH2lFgG+F8D2QVKYlk9Q=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=hu+0kCUWTJ8WVNaZQNui1KgOfUXfp3wxHO4/0iuUGElj34aX2eswrviCF7TvHtcws0i M1mI9Y8/rByREA7eQKOYEJV0Gl1p3Gcd+6DPxiKGIL9RZiaODvJ7gpXOM21zhy7C35YJF Sk9HbUfEugJyOF4Xz47OV9FO7Ud2GuhEcYg= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Since commit 35e242b698cd ("MdePkg/BaseLib: rewrite Base64Decode()", 2019-07-16), Base64Decode() guarantees that DestinationSize is larger on output than it was on input if RETURN_BUFFER_TOO_SMALL is returned. Clean up the retval handling for the first Base64Decode() call in EnrollDefaultKeys, which used to work around the ambiguity in the previous Base64Decode() interface contract. Cc: Ard Biesheuvel Cc: Jordan Justen Cc: Philippe Mathieu-Daud=C3=A9 Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1981 Signed-off-by: Laszlo Ersek Reviewed-by: Philippe Mathieu-Daude Acked-by: Ard Biesheuvel --- Notes: v2: =20 - Repo: https://github.com/lersek/edk2.git Branch: enroll_base64_cleanup_bz1981_v2 =20 - pick up Phil's R-b: http://mid.mail-archive.com/d7e733d7-d32f-02ec-98ec-c121d6b406e0@redh= at.com https://edk2.groups.io/g/devel/message/43771 =20 - update BZ reference from TianoCore#1891 to TianoCore#1981 (due to the patch being split off of the original series linked at : ) =20 - refer to the specific commit hash of patch "MdePkg/BaseLib: rewrite Base64Decode()" in the commit message =20 - no code changes OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.c b/OvmfPkg/Enroll= DefaultKeys/EnrollDefaultKeys.c index f45cb799f726..302b80d97720 100644 --- a/OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.c +++ b/OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.c @@ -153,16 +153,10 @@ GetPkKek1 ( DecodedCertSize =3D 0; Status =3D Base64Decode (Base64Cert, Base64CertLen, NULL, &DecodedCertSi= ze); switch (Status) { case EFI_BUFFER_TOO_SMALL: - if (DecodedCertSize > 0) { - break; - } - // - // Fall through: the above Base64Decode() call is ill-specified in Bas= eLib - // if Source decodes to zero bytes (for example if it consists of igno= red - // whitespace only). - // + ASSERT (DecodedCertSize > 0); + break; case EFI_SUCCESS: AsciiPrint ("error: empty certificate after app prefix %g\n", &gOvmfPkKek1AppPrefixGuid); return EFI_PROTOCOL_ERROR; --=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 (#46758): https://edk2.groups.io/g/devel/message/46758 Mute This Topic: https://groups.io/mt/33135849/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-