ARM_TrustZone_Technology_Training

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

0ARMTrustZoneTechnology1WhatisTrustZone?2Providingexecutionisolationinastandardprocessor“TrustZone”defineTrustZone:可信区域3“TrustZone”application¾APforsmartphone¾Wearabledevices¾IoT4WhyisTrustZone?5highersoftwareperformanceinsecureworldandlesssiliconareaComparetoadedicatedsecurityprocessor:6TrustZoneisaFramework‹把TrustZone软件组件移植加入到当前的系统的OS,达成安全?‹给系统替换一个支持TrustZone的处理器,移植好当前的OS,达成安全?‹把系统里CPU换成了支持TrustZone的处理器核,加上TrustZone软件组件,移植好OS,系统安全?正确的做法必须通盘考虑整个系统,明确保护需求,需要防备什么样的危险‹Softwarevshardwareattacks‹On-SoCvsOff-SoCsecretstorage如何达成系统安全?7NormalSoftwareSystem8TrustZone能提供什么?9TrustZone形成两个虚拟处理器¾一个提供给各类OS¾一个提供给基于严格可控代码的secureworld两个worlds之间是基于硬件的强化隔离¾片上和片外的硬件会针对处理器的不同安全状态做出相应的响应¾JTAG调试模式下也能避免各个world间的信息泄露TrustZone的secureworld呈现出来的硬件视图和normalworld几乎一样TrustZone的虚拟世界10软件的视角11„TrustZone技术严格限制了对关键硬件模块的访问权限„安全软件的开发可以:¾全速访问所有的存储空间¾全速访问所有的外设模块¾完全使用处理器的昀大处理能力¾world切换不会带来cache刷新导致的开销硬件的视角12Howtodoitinhardware?13SoC系统上的TrustZone14zTZPC:TrustZone保护控制器(TrustZoneProtectionController)zTZIC:TrustZone中断控制zTZIMW:TrustZone内部存储器访问控制器(TrustZoneInternalMemoryWrapper),或TZMAzTZEMW:TrustZone外部存储器访问控制器(TrustZoneExternalMemoryWrapper),或TZASCTrustZone系统架构组件其他需要改造的系统组件:系统总线AXI、AXI与APB桥(AXI2APBBridge)、AXI与AHB桥(AXI2AHBBridge、AHB2AXIBridge)、L2cache、DMAC15基于AXI2APB桥的子系统安全架构Non-securesetForRTCNon-securesetForTimerssecuresetForTZPC16AHB协议不支持安全管理机制,只能靠AXI2AHB、AHB2AXI桥来控制,但ARM提供的组件有些限制:•TheAXI-to-AHBbridgeallowsthewholeoftheAHBslavedomaintobemadeeitherSecureorNon-secure.•TheAHB-to-AXIbridgeallowsthewholeoftheAHBmasterdomaintobemadeeitherSecureorNon-secure.如果AHB子系统混合有Secure和Non-secure的从设备或主设备,则需要重新规划子系统,让各自归到同一层总线内、同一AHB桥后基于AXI与AHB桥的子系统安全架构17Whatmakeitwork?18S比特和Monitor处理器运行模式S比特,可以将安全状态和普通状态明确的区分开,指明当前系统是否在安全状态下。这个S比特存在于Cache、MMU、系统总线、DMA等等,不仅可以影响CPU内核和内存子系统,甚至还可以影响片内外设的工作。Monitor模式被用来控制系统的安全状态,以及指令、数据的访问权限。Monitor模式通过修改S比特来实现在安全状态和普通状态之间的切换。作为保卫系统安全性的网关,Monitor模式还要负责保存当前的上下文状态,如果需要,还要在状态切换时清空寄存器。19Monitor工作模式和寄存器视图20Monitor模式的物理寄存器设置21系统后门的管控Howtocontrolthebackdoor?22Debug被划分为三个层面:z任意区域,任意调试z非安全区域的调试开发z前面两者之间的可配置调试,适用于非安全特权用户、普通用户、安全用户等这种灵活性可以在阻止系统安全区域被访问的情况下提供normalworld的开发调试,甚至可以允许部分安全区域被调试访问。Debug安全机制23两类Debug‹InvasivedebugInvasivedebugisdebugwherethesystemcanbebothobservedandcontrolledlikeallofthedebuginthissectionthatenablesyoutohalttheprocessorandexamineandmodifyregistersandmemory.SPIDENandSUIDENcontrolinvasivedebugpermissions.‹Non-invasivedebugNon-invasiveisdebugwherethesystemcanonlybeobservedbutnotaffected.SPNIDENandSUNIDENcontrolnon-invasivedebugpermissions.24Debug安全机制实现MustcontrolaccesstotheSPIDENandSPNIDENpins,astheyrepresentasignificantsecurityrisk.Forexample,itmustnotbepossibletosetthesepinsthroughtheboundaryscaninafinaldevice.ThisiscontrolledbytheSPIDENandSPNIDENinputsignalsandthetwobitsSUIDENandSUNIDENintheSecureDebugEnableRegisterinthesystemcontrolcoprocessorARMsystemdebugsolutionisCoreSight™.TheCoreSightcomponentsincludeanumberofcontrolsignals:SPIDEN,SPNIDENandDBGEN25Howtodoitinsoftware?26SecurebootAtFirst,Weneedasecureboot.27Cryptographiccheckinsecureboot昀常见的基于公钥的RSA-PSS数字签名算法厂商掌握私钥,用户设备保存公钥,boot各环节要通过数字签名校验,确认合法性和完整性,才能将控制权移交。用户公钥不需保密,但不可被攻击者篡改,需要保存在secureworld。28MonitormodesoftwareThesecondistodesignamonitormodesoftware.29MonitormodesoftwareMonitor模式软件用于secureworld和normalworld的切换,保存和恢复world专属信息:zAllgeneralpurposeARMregisters.zAnycoprocessorregistersifrequired,suchasNEONorVFP.zAnyworld-dependantprocessorconfigurationstateinCP15.30Monitormodeentry系统仅定义数目有限的Monitor模式入口,通过这种控制来增强整个系统的安全性。z硬中断,IRQ、FRQz特殊指令,SMC31硬中断进入Monitormode:ARM有FIQ和IRQ两个中断输入,TrustZone推荐把FIQ作为安全中断(即“直接进入Monitormode”),而把IRQ作为非安全中断。用FIQ产生安全中断,这个中断对非安全环境来说是不可屏蔽的,使分配给FIQ的资源不会被非安全的中断控制和利用。IRQ用于各种非安全中断的事务处理。Monitormodeentry32MonitormodesoftwarelatencyMonitor软件的网关功能会给中断响应带来延迟,相比OS的中断延迟而言,可以接受。ARM1176JZ(F)-S:¾单次切换昀大200cycles,进入secure再退出,两次切换昀大400cyclesCortex-A8:¾单次切换昀大1200cycles,进入secure再退出,两次切换昀大2400cyclesARM1176JZ(F)-S上面运行Linux,系统中断延迟大约5000cycles.33TrustZone的核心价值观?34NottryingtobeacompleteOSbuttoservicetherichOSthroughacommonframework35AnydevelopercancreateacustomSecureworldsoftwareenvironmenttomeettheirrequirementswithTrustZoneframework.Variablesecureworld36不安全的软件系统37安全的软件系统38„ClassicSecurityModel¾Closed&signedexecutionenvironmentfornativecode¾Thiscanberelaxedforinterpretedcode„Manipulateandstoresecretsinsidethisspace,withoutexposuretorichOS„RichOScanbegivenhandle-basedaccess¾Keysandproceduresarenotexposed„RichOScanloadinterpretedapplicationsintosecureworld¾Forcomplexsecretmanipulationsintightlysandboxedenvironment¾TypicallyusedforDRMandfinancialapplicationsTrustZone应用的好处39TrustZone内部的软件安全性„TotallyseparatefrommainOS„Signingkey-basednativecodeauthentication¾LockedtothedevicebyROMandmasterkeys Bothon-SoC¾AllTrustZonenativecodesigned¾Ifintegritycheckfailsthennotloadedanddevicemaynotstart40AarchitectureofSecureOS41ARM对TrustZone的软件开发支持„StandardizedsoftwareAPI,calledtheTrustZoneAPI(TZAPI)„ARMTrustedFirmware42TwoexamplesofusingTZAPI43大多数安全系统都使用简单的架构,简单意味着更少的bug、更小的风险。所以Secureworld往往只使用单处理核,而不管Normalworld是否在使用多处理核并行。TrustZone在多核环境的应用44多核环境的两种切换策略策略一:在多核处理器簇中选择一个固定处理器核作为Secureworld的执行

1 / 57
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功