From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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-Google-Smtp-Source: AFSGD/W2FqpDjMMUNCccapP6rh0XKpQaK0gaSLQaceQXhhIBqbNz8gzIvP+CwagB3XJf4BwAP9kHQA== 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: [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: , X-List-Received-Date: Fri, 04 Jan 2019 14:43:55 -0000 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(-) 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] -- 2.17.1