]> git.proxmox.com Git - mirror_edk2.git/commitdiff
OvmfPkg/EnrollDefaultKeys: clean up Base64Decode() retval handling
authorLaszlo Ersek <lersek@redhat.com>
Tue, 2 Jul 2019 00:03:15 +0000 (02:03 +0200)
committerLaszlo Ersek <lersek@redhat.com>
Thu, 5 Sep 2019 17:28:35 +0000 (19:28 +0200)
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 <ard.biesheuvel@linaro.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1981
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.c

index f45cb799f7261ba5b926287a1b4b54f9c07fa7a5..302b80d97720c05305b3ec9853e185b5b09742f3 100644 (file)
@@ -154,14 +154,8 @@ GetPkKek1 (
   Status = Base64Decode (Base64Cert, Base64CertLen, NULL, &DecodedCertSize);\r
   switch (Status) {\r
   case EFI_BUFFER_TOO_SMALL:\r
-    if (DecodedCertSize > 0) {\r
-      break;\r
-    }\r
-    //\r
-    // Fall through: the above Base64Decode() call is ill-specified in BaseLib\r
-    // if Source decodes to zero bytes (for example if it consists of ignored\r
-    // whitespace only).\r
-    //\r
+    ASSERT (DecodedCertSize > 0);\r
+    break;\r
   case EFI_SUCCESS:\r
     AsciiPrint ("error: empty certificate after app prefix %g\n",\r
       &gOvmfPkKek1AppPrefixGuid);\r