From patchwork Fri Jan 4 14:43:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 154781 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp690879ljp; Fri, 4 Jan 2019 06:44:11 -0800 (PST) X-Google-Smtp-Source: ALg8bN5g5V+2ngcDsK+WcwTsHRylbG1MsVZfShXImEiT8ppt8xwoqfqFXWegJhxGBY1fz+uejyc1 X-Received: by 2002:a17:902:e08b:: with SMTP id cb11mr51668220plb.263.1546613051048; Fri, 04 Jan 2019 06:44:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546613051; cv=none; d=google.com; s=arc-20160816; b=FP4oTSUyglUExG3o2Ju8ROI/0XqE2jw5u1ke7+cmWzsmV4f6fm2qUN2RTxrXOUtqcb N4eSZ0TJmSfu6JE2b9b9oJVdJWctl3dOE+1PZZ/fyjeBhhB00+yv5VcX4m1kEYBPvnwH OPxfqQVPolvAiyVka/QuHN3hH9Hw2ce3cwTIBwv1kYuGT2TWVs1P0Aagmj4Ppg5oPoK2 OVSKyCbqtsAzuF0TkidXG5XCB1yUSQRHKIyHggvnVueTz3n02p9UCzjuDRF/SWfHOABY iySz8h+0MtLEd+ikWFjFQDKzHpI4nG52HtAicYspkF4vWtOkQ2BzpTkEwS6uUOKIYg3F j7bw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to; bh=AktPB3to5ptJn9f3oZGOPRF5lFbbpOuaVSHGBWdgbs4=; b=Yh/iNVi82dLgkhRIFFxVYRk62LS7uEnAlXcfMvXLlypUmPKAmSvkeGs3AGTZfzcW8/ rUjdUkFO4iajxq1BgYpjubpGNBOy+ucBKBpYVF9eM+YAJGB5EvYGon6YqQlhWJv/w7bj cjuycVGZMDd0t8fuSi3te6kH6wImWIkMczBNuwFzg+iqvOZT6YtiemAgy4ydDGOu0Jt1 ifssi3ZpDcJTQ2vBp7TKfqZrToT3/366cE6kugj7H7lsPFiBGmdExAWb7MNsAJMqwJ5+ S+uBZzCMCMbtJ1BsQIik5kF9y+uIQLHKC8UKOl7YnlbjSedwuGxBJu176sJ4jn8ENsL+ GKnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=YbDjylEh; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [198.145.21.10]) by mx.google.com with ESMTPS id v32si4381417plb.369.2019.01.04.06.44.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 04 Jan 2019 06:44:11 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) client-ip=198.145.21.10; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=YbDjylEh; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id D8E21211AEA4C; Fri, 4 Jan 2019 06:43:56 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:4864:20::543; helo=mail-ed1-x543.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-ed1-x543.google.com (mail-ed1-x543.google.com [IPv6:2a00:1450:4864:20::543]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id EE02A211AE8D3 for ; Fri, 4 Jan 2019 06:43:54 -0800 (PST) Received: by mail-ed1-x543.google.com with SMTP id f23so32001227edb.3 for ; Fri, 04 Jan 2019 06:43:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=tcMf9iNtRly3sh0adNMk2olFv+8H0TKeSDntYfwJpaw=; b=YbDjylEhnD+MoMBtgPmaVlki9aYm9HH3Ck4LqT7sMJf1fKv3v7SQZF6u04qaBS/vk8 hj2q+9DZ/NCE1MAp1vJE9vZvbVZk54m4Ylny9YwfUAqqAW4U6j1h3dCZKGP5Kw8XtgRY 3CR20MLm2bkOZaovhgVIVZ8b2aiqunBWQLkF4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=tcMf9iNtRly3sh0adNMk2olFv+8H0TKeSDntYfwJpaw=; b=sS0qL7iHFb44mD31aeQTwuNhrCK5fneIu4L1h/GqGe+RuSvpUgHHGoS2L3Uy5ZQ2r/ aOApET4TdFjDSM94X9RbQoAAzvUm8yBj6GxHWR6AVJRvy1qWRXt8MYZ41aCcIK8Lq31G raPYsbBoxK5nutWvJB07pQv7GhsAwmxul8eKuD1Pxam0EiXSUABo3ajbeoCKKMzm+5Wt G+iRkMWxGwDPqksozHiProTxQi08+zV22IuKExWQNiJVnx8MsLla1STeKmnvOKC5/Qpl YUALxZ57r5ZXMzm2wV5xavdb9fzwTIGTP4Vu80XTpC5uhWe/vYSWITSGp0hLjETp+pLE B77w== X-Gm-Message-State: AA+aEWZtUms9fHXWrL8/VBjd6deiU5cIjkvitx+0bLWIqcn6ryFCC4I0 yH7lCh/9XFwuxC3E0iBTQyb/4gIu6VKR/w== X-Received: by 2002:a17:906:7057:: with SMTP id r23-v6mr39251296ejj.113.1546613033202; Fri, 04 Jan 2019 06:43:53 -0800 (PST) Received: from dogfood.home ([2a01:cb1d:112:6f00:183a:9013:d5a3:37a8]) by smtp.gmail.com with ESMTPSA id q16sm21608226eds.60.2019.01.04.06.43.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 04 Jan 2019 06:43:52 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Fri, 4 Jan 2019 15:43:36 +0100 Message-Id: <20190104144336.8941-8-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190104144336.8941-1-ard.biesheuvel@linaro.org> References: <20190104144336.8941-1-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH edk2-platforms 7/7] Platform/DeveloperBox: add MM based UEFI secure boot support X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" This implements support for UEFI secure boot on DeveloperBox using the standalone MM framework. This moves all of the software handling of the UEFI authenticated variable store into the standalone MM context residing in a secure partition. Note that SynQuacer as configured today is not a truly secure platform, since the NOR flash registers are accessible to the non-secure world. However, from a software point of view, all of the required pieces are in place. (In particular, it is no longer possible for the OS to stub out authentication checks in the validation code residing in RuntimeServicesCode regions) Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel --- Platform/Socionext/DeveloperBox/DeveloperBox.dsc | 23 +++++++++++++++++++- Platform/Socionext/DeveloperBox/DeveloperBox.fdf | 13 +++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) -- 2.17.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel diff --git a/Platform/Socionext/DeveloperBox/DeveloperBox.dsc b/Platform/Socionext/DeveloperBox/DeveloperBox.dsc index 666bd2716336..d244048c5a6b 100644 --- a/Platform/Socionext/DeveloperBox/DeveloperBox.dsc +++ b/Platform/Socionext/DeveloperBox/DeveloperBox.dsc @@ -28,6 +28,8 @@ [Defines] FLASH_DEFINITION = Platform/Socionext/DeveloperBox/DeveloperBox.fdf BUILD_NUMBER = 1 + DEFINE SECURE_BOOT_ENABLE = FALSE + !include Platform/Socionext/DeveloperBox/DeveloperBox.dsc.inc [BuildOptions.common.EDKII.DXE_CORE,BuildOptions.common.EDKII.DXE_DRIVER,BuildOptions.common.EDKII.UEFI_DRIVER,BuildOptions.common.EDKII.UEFI_APPLICATION] @@ -165,6 +167,13 @@ [PcdsFixedAtBuild] g96BoardsTokenSpaceGuid.PcdGpioPinK|24 g96BoardsTokenSpaceGuid.PcdGpioPinL|25 + gArmTokenSpaceGuid.PcdMmBufferBase|0xFFC00000 + gArmTokenSpaceGuid.PcdMmBufferSize|0x00200000 + + gEfiSecurityPkgTokenSpaceGuid.PcdOptionRomImageVerificationPolicy|0x04 + gEfiSecurityPkgTokenSpaceGuid.PcdFixedMediaImageVerificationPolicy|0x04 + gEfiSecurityPkgTokenSpaceGuid.PcdRemovableMediaImageVerificationPolicy|0x04 + [PcdsDynamicExDefault.common.DEFAULT] gEfiSignedCapsulePkgTokenSpaceGuid.PcdEdkiiSystemFirmwareImageDescriptor|{0x0}|VOID*|0x100 gEfiSignedCapsulePkgTokenSpaceGuid.PcdEdkiiSystemFirmwareFileGuid|{0xf7, 0x89, 0x9b, 0xe9, 0x20, 0xc1, 0x25, 0x4b, 0x4d, 0xb1, 0x83, 0x94, 0xed, 0xb0, 0xb4, 0xf5} @@ -223,7 +232,13 @@ [Components.common] } MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf - MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf + MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf { +!if $(SECURE_BOOT_ENABLE) == TRUE + + NULL|SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.inf +!endif + } + ArmPkg/Drivers/TimerDxe/TimerDxe.inf ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.inf MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf @@ -251,6 +266,7 @@ [Components.common] # Variable services # Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/Fip006Dxe.inf +!if $(SECURE_BOOT_ENABLE) == FALSE MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf { @@ -260,6 +276,11 @@ [Components.common] TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurementLibNull.inf VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf } +!else + ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.inf + MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.inf + SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigDxe.inf +!endif # # UEFI application (Shell Embedded Boot Loader) diff --git a/Platform/Socionext/DeveloperBox/DeveloperBox.fdf b/Platform/Socionext/DeveloperBox/DeveloperBox.fdf index 4a234a36525e..7be40380efb4 100644 --- a/Platform/Socionext/DeveloperBox/DeveloperBox.fdf +++ b/Platform/Socionext/DeveloperBox/DeveloperBox.fdf @@ -51,7 +51,11 @@ [FD.SPI_NOR_IMAGE] ################################################################################ 0x00000000|0x00078000 +!if $(SECURE_BOOT_ENABLE) == FALSE FILE = Platform/Socionext/DeveloperBox/fip_all_arm_tf.bin +!else +FILE = Platform/Socionext/DeveloperBox/fip_all_arm_tf_mm.bin +!endif 0x00078000|0x00008000 FILE = $(OUTPUT_DIRECTORY)/$(TARGET)_$(TOOL_CHAIN_TAG)/$(ARCH)/Silicon/Socionext/SynQuacer/Stage2Tables/Stage2Tables/OUTPUT/Stage2Tables.bin @@ -122,9 +126,15 @@ [FV.FvMain] # # Variable services # +!if $(SECURE_BOOT_ENABLE) == FALSE INF Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/Fip006Dxe.inf INF MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf INF MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf +!else + INF ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.inf + INF MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.inf + INF SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigDxe.inf +!endif # # UEFI applications @@ -328,6 +338,9 @@ [FV.CapsuleDispatchFv] READ_LOCK_CAP = TRUE READ_LOCK_STATUS = TRUE +!if $(SECURE_BOOT_ENABLE) == TRUE + INF Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/Fip006Dxe.inf +!endif INF SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareUpdateDxe.inf [FV.SystemFirmwareUpdateCargo]