tf-m secure storageconnect.linaro.org.s3.amazonaws.com/hkg18/... · connected devices have secrets!...

40
© 2017 Arm Limited Linaro Connect – Hong Kong March 2018 TF-M Secure Storage CE - Open Source Software Ashutosh Singh

Upload: others

Post on 17-Jul-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: TF-M Secure Storageconnect.linaro.org.s3.amazonaws.com/hkg18/... · Connected devices have secrets! • RoT keys, Communications keys, hashes, certificates • Vendor secrets (provisioning

©2017ArmLimited

LinaroConnect–HongKongMarch2018

TF-MSecureStorage

CE-OpenSourceSoftware

AshutoshSingh

Page 2: TF-M Secure Storageconnect.linaro.org.s3.amazonaws.com/hkg18/... · Connected devices have secrets! • RoT keys, Communications keys, hashes, certificates • Vendor secrets (provisioning

©2017ArmLimited2

QuickIntroductiontoTF-M

IntroductiontoServices

SecureStorageOverview

SecureStorageDesign

Exampleuse-case

SecureStorageOutlook

Agenda

Pleasefeelfreetointerruptduringthepresentation!

Page 3: TF-M Secure Storageconnect.linaro.org.s3.amazonaws.com/hkg18/... · Connected devices have secrets! • RoT keys, Communications keys, hashes, certificates • Vendor secrets (provisioning

©2017ArmLimited

TrustedFirmwareMoverview

Page 4: TF-M Secure Storageconnect.linaro.org.s3.amazonaws.com/hkg18/... · Connected devices have secrets! • RoT keys, Communications keys, hashes, certificates • Vendor secrets (provisioning

©2017ArmLimited4

Introduction

PlatformSecurityarchitecture(PSA)publiclaunchinlate2017

TFMengineeringworkstartedearly2017,PSA–evenearlier

PSA:setofspecs&implementation–whichisTF-M

Page 5: TF-M Secure Storageconnect.linaro.org.s3.amazonaws.com/hkg18/... · Connected devices have secrets! • RoT keys, Communications keys, hashes, certificates • Vendor secrets (provisioning

©2017ArmLimited5

Non-securePartition

Applicationfirmware

OSlibraries

OSkernel

SecurePartition

Securefunction

Securefunction

TrustedPartition

TrustedFunction

TrustedFunction

TF-MCore

SecurecallAPIandrouting

PartitionManager

SecureDebug

Isolationboundary

SecureProcessingEnvironment(Sbinary)

SecurePartition

SecureIRQ

Crashhandling

SecureDrivers

Non-secureProcessingEnvironment

(NSbinary)

TFMNSAPI

Partition-privatecode

Securefunction

Scheduling

Secureisolation

TF-MFramework

•  Securebootloader

•  Securesysteminit

•  SecurePartitionManagement(SPM)

•  Securefunctioncallrouting

•  IsolationwithinSPE

•  Trustedservices,functions

•  NSPEAPI

•  Buildenvironment

•  Testsuite

•  ...

Page 6: TF-M Secure Storageconnect.linaro.org.s3.amazonaws.com/hkg18/... · Connected devices have secrets! • RoT keys, Communications keys, hashes, certificates • Vendor secrets (provisioning

©2017ArmLimited6

Non-securePartition

Applicationfirmware

OSlibraries

OSkernel

SecurePartition

Securefunction

Securefunction

TrustedPartition

TrustedFunction

TrustedFunction

TF-MCore

SecurecallAPIandrouting

PartitionManager

SecureDebug

Isolationboundary

SecureProcessingEnvironment(Sbinary)

SecurePartition

SecureIRQ

Crashhandling

SecureDrivers

Non-secureProcessingEnvironment

(NSbinary)

TFMNSAPI

Partition-privatecode

Securefunction

Scheduling

Secureisolation

TF-MTerminologySecurePartitionManager(SPM)

•  Providestheboot,isolationandIPCservicestotheSPE

Partition

•  Theunitofexecution

SecureFunction

•  AsetofrelatedAPIsinvokedthroughsecureIPC

Trustedfunction

•  ASecureFunctionthatprovidesaRootofTrustservice

Page 7: TF-M Secure Storageconnect.linaro.org.s3.amazonaws.com/hkg18/... · Connected devices have secrets! • RoT keys, Communications keys, hashes, certificates • Vendor secrets (provisioning

©2017ArmLimited

IntroductiontoTF-MServices

Page 8: TF-M Secure Storageconnect.linaro.org.s3.amazonaws.com/hkg18/... · Connected devices have secrets! • RoT keys, Communications keys, hashes, certificates • Vendor secrets (provisioning

©2017ArmLimited8

SecurePartition/Function/Service

Secureendpointofthesystem

Userauthenticationandaccesspolicybasedservice

Sandboxedtoallowmutualdistrustandlimitthreatvectors

InvokedfromSPEaswellNSPEentities

Independentinteractionwithmultipleentities

MultipleFunctions(SF)insamePartition(SP)

Non-securepartition

Applicationfirmware

OSlibraries

OSkernel

CryptoSecurepartitionSecurefunction

Securefunction

Trustedpartition

Trustedfunction

Trustedfunction

SecurePartitionManager

SecureIPC Secureisolation Securedebug

Isolationboundary

SecureProcessingEnvironmentNon-secure

ProcessingEnvironment

SSTSecurepartitionSecurefunction

Securefunction

Page 9: TF-M Secure Storageconnect.linaro.org.s3.amazonaws.com/hkg18/... · Connected devices have secrets! • RoT keys, Communications keys, hashes, certificates • Vendor secrets (provisioning

©2017ArmLimited

TF-MSecureStorage

Page 10: TF-M Secure Storageconnect.linaro.org.s3.amazonaws.com/hkg18/... · Connected devices have secrets! • RoT keys, Communications keys, hashes, certificates • Vendor secrets (provisioning

©2017ArmLimited10

SecureStorageIntroduction

Connecteddeviceshavesecrets!

•  RoTkeys,Communicationskeys,hashes,certificates

•  Vendorsecrets(provisioningkeys,featurecertificates)•  Criticalfordevicesecurityandoperability•  Needfor-

•  Restrictedaccesstoplaintextsecrets

•  Tamperresistance/detection

•  Reliability

Page 11: TF-M Secure Storageconnect.linaro.org.s3.amazonaws.com/hkg18/... · Connected devices have secrets! • RoT keys, Communications keys, hashes, certificates • Vendor secrets (provisioning

©2017ArmLimited11

SecureStorageIntroduction•  Confidentiality

•  AEADEncryption

•  PolicyBasedAccessControl

•  RedefineAccessGranularity(Read/Write/Reference)

•  Integrity•  AEADAuthentication

•  Availability•  AtomicUpdateOperations

•  PowerFailureSafeDesign

•  Scalability

Confidentiality

AvailabilityIntegrity

Scalability

Page 12: TF-M Secure Storageconnect.linaro.org.s3.amazonaws.com/hkg18/... · Connected devices have secrets! • RoT keys, Communications keys, hashes, certificates • Vendor secrets (provisioning

©2017ArmLimited12

SSTSystemView

Non-securepartition

Applicationfirmware

OSlibraries

OSkernel

CryptoSecurepartition

CryptoSF

CryptoSF

Trustedpartition

Trustedfunction

Trustedfunction

SecurePartitionManager

SecureIPC Secureisolation Securedebug

Isolationboundary

Non-SecureProcessingEnvironment

SSTCAPI

SecureProcessingEnvironment

SST

Key Cert Hash

FileSystem(orproxy)

Cryptographicbinding

AccessPolicyManagement

Policydatabase

HUKderivedkey

….

Page 13: TF-M Secure Storageconnect.linaro.org.s3.amazonaws.com/hkg18/... · Connected devices have secrets! • RoT keys, Communications keys, hashes, certificates • Vendor secrets (provisioning

©2017ArmLimited13

FirstRelease

•  Policybasedaccess•  Compiled-inpolicytable

•  SingleKeyOperation•  AES-GCMForAEAD

•  Atomicaccess,powerfailuresafe

•  CustomFileSystem

SST

Key Cert Hash

FileSystem(orproxy)

Cryptographicbinding

AccessPolicyManagement

Policydatabase

HUKderivedkey

….

Page 14: TF-M Secure Storageconnect.linaro.org.s3.amazonaws.com/hkg18/... · Connected devices have secrets! • RoT keys, Communications keys, hashes, certificates • Vendor secrets (provisioning

©2017ArmLimited

TF-MSecureStorageAccessPolicyManagement

Page 15: TF-M Secure Storageconnect.linaro.org.s3.amazonaws.com/hkg18/... · Connected devices have secrets! • RoT keys, Communications keys, hashes, certificates • Vendor secrets (provisioning

©2017ArmLimited15

AccessPolicyManagement•  Gatekeeperforalltheaccesses•  Placeholderforfutureadditions

•  lifecyclemanagement•  secureassetmanagement

•  Compiletimepolicydefinition

•  Use-case1:DirectAccessfrom(SPEorNSPE)Client•  Read/Write/Deleterequest•  Accesspermissionlookupinpolicydatabase

SST

Key Cert Hash

FileSystem(orproxy)

Cryptographicbinding

AccessPolicyManagement Policydatabase

HUKderivedkey

….

Page 16: TF-M Secure Storageconnect.linaro.org.s3.amazonaws.com/hkg18/... · Connected devices have secrets! • RoT keys, Communications keys, hashes, certificates • Vendor secrets (provisioning

©2017ArmLimited16

AccessPolicyManagement•  Use-case2:Referenced

Access•  Onlyreadinindirectaccess•  ClientasksCryptoto

performacryptographicoperationwiththekeyreference(UUID)

•  CryptomakesareadrequestonNSPEcaller’sbehalf

•  ‘Reference’permissionlookupfortheoriginalNSPEclient

•  OnlySPEcallerallowedtomakereferencedreadonother’sbehalf

Non-securepartition

APP2

OSlibraries

OSkernel

Crypto

CryptoSF

CryptoSF

Trustedpartition

Trustedfunction

Trustedfunction

SecurePartitionManager

SecureIPCSecureisolation Securedebug

Non-SecureProcessingEnvironment

SSTCAPI

SecureProcessingEnvironment

SST

Key1 Cert

Hash

FileSystem(orproxy)

Cryptographicbinding

AccessPolicyManagement

Policydatabase

HUKderivedkey

….

APP1

Page 17: TF-M Secure Storageconnect.linaro.org.s3.amazonaws.com/hkg18/... · Connected devices have secrets! • RoT keys, Communications keys, hashes, certificates • Vendor secrets (provisioning

©2017ArmLimited

TF-MSecureStorageFileSystem

Page 18: TF-M Secure Storageconnect.linaro.org.s3.amazonaws.com/hkg18/... · Connected devices have secrets! • RoT keys, Communications keys, hashes, certificates • Vendor secrets (provisioning

©2017ArmLimited18

SSTFileSystem–FlashLayoutSST

Key Cert Hash

FileSystem(orproxy)

Cryptographicbinding

AccessPolicyManagement

Policydatabase

HUKderivedkey

….

MetaBlock

ScratchMetaBlock

DataBlock

DataBlock

ScratchDataBlock

DataBlock •  SetofBlocksear-

marked•  Firsttwoformetadata

block•  Restaredatablocks•  Scratchmetablockand

scratchdatablock

Page 19: TF-M Secure Storageconnect.linaro.org.s3.amazonaws.com/hkg18/... · Connected devices have secrets! • RoT keys, Communications keys, hashes, certificates • Vendor secrets (provisioning

©2017ArmLimited19

SST

Key Cert Hash

FileSystem(orproxy)

Cryptographicbinding

AccessPolicyManagement

Policydatabase

HUKderivedkey

….

SSTFileSystem–FlashLayoutContdMetadataBlock

Metaheader

Blockmetadata• Block0Meta• Block1meta• ....

ObjectMetadata• Object0meta• Objectxxmeta

UNUSEDSPACE

Objectxxdata

DataBlock0

Objectxx

Objectyy

Objectzz

Objectaa

Objectbb

UNUSEDSPACE

DataBlock1

Objectcc

Objectdd

Objectee

Objectff

Objectgg

UNUSEDSPACE

•  Metaheader•  Metadataauthentication•  Atomicupdates

•  BlockMetadata•  Logicalblocktophysicalblockinfo•  Infoaboutfreespaceineachblock

•  ObjectMetadata•  Infoaboutanobject’swhereabouts•  Objectauthenticationdata

Page 20: TF-M Secure Storageconnect.linaro.org.s3.amazonaws.com/hkg18/... · Connected devices have secrets! • RoT keys, Communications keys, hashes, certificates • Vendor secrets (provisioning

©2017ArmLimited

TF-MSecureStorageFlows

Page 21: TF-M Secure Storageconnect.linaro.org.s3.amazonaws.com/hkg18/... · Connected devices have secrets! • RoT keys, Communications keys, hashes, certificates • Vendor secrets (provisioning

©2017ArmLimited21

KeyDerivationSST

Key Cert Hash

FileSystem(orproxy)

Cryptographicbinding

AccessPolicyManagement

Policydatabase

HUKderivedkey

….

HardwareUnique

Key(HUK)

KDF

KeyDerivation

Label

SSTKey •  SimpleKeyDerScheme

•  HUK–needstobeuniqueperdevice

•  Implementationstubbed

•  _to_evolve_

Page 22: TF-M Secure Storageconnect.linaro.org.s3.amazonaws.com/hkg18/... · Connected devices have secrets! • RoT keys, Communications keys, hashes, certificates • Vendor secrets (provisioning

©2017ArmLimited22

AuthenticateEncryptionWithAssociatedDataSST

Key Cert Hash

FileSystem(orproxy)

Cryptographicbinding

AccessPolicyManagement

Policydatabase

HUKderivedkey

….

Encryption

AuthenticatedData

Data(Plain-text)

AES-GCM

Key

IV

AuthTag

ObjectData(Encrypted)

AuthenticatedDecryption

AuthenticatedData

Data(Encrypted)

AES-GCM

Key

AuthenticationResult

Data(Plain-Text)

AuthTagIV

Page 23: TF-M Secure Storageconnect.linaro.org.s3.amazonaws.com/hkg18/... · Connected devices have secrets! • RoT keys, Communications keys, hashes, certificates • Vendor secrets (provisioning

©2017ArmLimited23

ObjectEncryption/DecryptionSST

Key Cert Hash

FileSystem(orproxy)

Cryptographicbinding

AccessPolicyManagement

Policydatabase

HUKderivedkey

….

ObjectEncryption

ObjectMetadata

ObjectData(Plain-text)

AES-GCM

SSTKey

IV

MAC(AuthTag)

ObjectData(Encrypted)

ObjectDecryption

ObjectMetadata

ObjectData(Encrypted)

AES-GCM

SSTKey

AuthenticationResult

ObjectData(Plain-Text)

MAC IV

Page 24: TF-M Secure Storageconnect.linaro.org.s3.amazonaws.com/hkg18/... · Connected devices have secrets! • RoT keys, Communications keys, hashes, certificates • Vendor secrets (provisioning

©2017ArmLimited24

SST

Key Cert Hash

FileSystem(orproxy)

Cryptographicbinding

AccessPolicyManagement

Policydatabase

HUKderivedkey

….

Boot-MetadataBlockAuthentication

MetaBlockAuthentication

Metadataheader

BlockMetadata AES-GCMAuth

SSTKey

AuthenticationResult

MAC IV

ObjectMetadata

Page 25: TF-M Secure Storageconnect.linaro.org.s3.amazonaws.com/hkg18/... · Connected devices have secrets! • RoT keys, Communications keys, hashes, certificates • Vendor secrets (provisioning

©2017ArmLimited25

SST

Key Cert Hash

FileSystem(orproxy)

Cryptographicbinding

AccessPolicyManagement

Policydatabase

HUKderivedkey

….

WriteOperation(Simplified)

WriteRequest EncryptContent WritetoScratchDataBlock

UpdateScratchMetadataBlock

UpdateScratchMetadataheader(IV,SwapCount,

MAC)

EraseActiveMetadata

EraseActivedatablock Done

Page 26: TF-M Secure Storageconnect.linaro.org.s3.amazonaws.com/hkg18/... · Connected devices have secrets! • RoT keys, Communications keys, hashes, certificates • Vendor secrets (provisioning

©2017ArmLimited26

MetaBlockAuthentication

SST

Key Cert Hash

FileSystem(orproxy)

Cryptographicbinding

AccessPolicyManagement

Policydatabase

HUKderivedkey

….

WriteOperation(..NotSimplified)

ObjectData Encrypt

ScratchDataBlock

ObjectData

ObjectData

ObjectData

ScratchMetaBlock

MAC

SwapCounter

IV

LBlockMetaLBlockMeta

ObjectMetaObjectMetaObjectMeta

ActiveMetaBlock

MAC

SwapCounter

IV

LBlockMetaLBlockMeta

ObjectMetaObjectMetaObjectMeta

ActiveDataBlock

ObjectData

ObjectData

ObjectDataIncrementSwapCounterGenerate/Store

MACforMetadata

EraseActiveMetablock

EraseActiveDataBlock

SwapActive/scrathblocks

Page 27: TF-M Secure Storageconnect.linaro.org.s3.amazonaws.com/hkg18/... · Connected devices have secrets! • RoT keys, Communications keys, hashes, certificates • Vendor secrets (provisioning

©2017ArmLimited27

APIs

tfm_sst_get_handle(uint16_tasset_uuid,uint32_t*hdl);

tfm_sst_create(uint16_tasset_uuid);

tfm_sst_get_attributes(uint32_tasset_handle,structtfm_sst_attribs_t*attrib_struct);

tfm_sst_read(uint32_tasset_handle,structtfm_sst_buf_t*data);

tfm_sst_write(uint32_tasset_handle,structtfm_sst_buf_t*data);

tfm_sst_delete(uint32_tasset_handle);

Page 28: TF-M Secure Storageconnect.linaro.org.s3.amazonaws.com/hkg18/... · Connected devices have secrets! • RoT keys, Communications keys, hashes, certificates • Vendor secrets (provisioning

©2017ArmLimited28

ReferenceUse-case

Non-securepartition

Applicationfirmware

IPStack

OSkernel

CryptoSecurepartitionSecurefunction

Securefunction

Trustedpartition

Trustedfunction

Trustedfunction

SecurePartitionManager

SecureIPC Secureisolation Securedebug

Isolationboundary

SecureProcessingEnvironmentNon-secure

ProcessingEnvironment

SSTSecurepartition

TLSKey/Cert

TLS

Page 29: TF-M Secure Storageconnect.linaro.org.s3.amazonaws.com/hkg18/... · Connected devices have secrets! • RoT keys, Communications keys, hashes, certificates • Vendor secrets (provisioning

©2017ArmLimited

SecureStorageOutlook

Page 30: TF-M Secure Storageconnect.linaro.org.s3.amazonaws.com/hkg18/... · Connected devices have secrets! • RoT keys, Communications keys, hashes, certificates • Vendor secrets (provisioning

©2017ArmLimited30

SecureStorageOutlook

•  Rollbackprotection,re-doIVscheme

•  Keydiversification,passwordbasedaccess,keyhiding•  Securityproperties(keytype,restrictions)•  Lifecyclemanagement

•  Evolutionofuserauthentication•  Handlingvariousstoragedevicetopologies•  CompiletimeFlashLayoutgeneration

•  ToolingWorkOngoingforotherservices(Crypto,AuditLogging)

Page 31: TF-M Secure Storageconnect.linaro.org.s3.amazonaws.com/hkg18/... · Connected devices have secrets! • RoT keys, Communications keys, hashes, certificates • Vendor secrets (provisioning

©2017ArmLimited31

HowtogetinvolvedTF-AandTF-Mmastercodebases•  https://git.trustedfirmware.org/

TF-MTeam@ConnectHKG18•  AbhishekPandit

•  AshutoshSingh

•  TamasBan

•  MiklosBalint

Getintouch•  ComeroundLITEhackingroombetween3-4pmWednesday

•  Scheduleameetingviahkg18.pathable.com

Moreinfoondeveloper.arm.com

Page 32: TF-M Secure Storageconnect.linaro.org.s3.amazonaws.com/hkg18/... · Connected devices have secrets! • RoT keys, Communications keys, hashes, certificates • Vendor secrets (provisioning

©2017ArmLimited32

?

Page 33: TF-M Secure Storageconnect.linaro.org.s3.amazonaws.com/hkg18/... · Connected devices have secrets! • RoT keys, Communications keys, hashes, certificates • Vendor secrets (provisioning

3333

ThankYou!Danke!Merci!谢谢!ありがとう!Gracias!Kiitos!감사합니다धन्यवाद

©2017ArmLimited

Page 34: TF-M Secure Storageconnect.linaro.org.s3.amazonaws.com/hkg18/... · Connected devices have secrets! • RoT keys, Communications keys, hashes, certificates • Vendor secrets (provisioning

©2017ArmLimited34

SecureStorageOutlook(OpenDiscussion)

•  Rollbackprotection•  InternalFlashbaseddesign(tostorerollbackcountersecurely)?

•  OTP/E-FuseBasedDesign(tostorerollbackcountersecurely)?

•  Canitbetiedtofirmwareupdate?

•  Couldwepartitionintorollbackprotectedandnonrollbackprotected?

Page 35: TF-M Secure Storageconnect.linaro.org.s3.amazonaws.com/hkg18/... · Connected devices have secrets! • RoT keys, Communications keys, hashes, certificates • Vendor secrets (provisioning

©2017ArmLimited35

SecureStorageOutlook(OpenDiscussion)

•  Keydiversification,passwordbasedaccess,keyhiding•  KeydiversificationperClient?

•  Token(password)basedkeyderivation?

•  ErasurePolicy?

Page 36: TF-M Secure Storageconnect.linaro.org.s3.amazonaws.com/hkg18/... · Connected devices have secrets! • RoT keys, Communications keys, hashes, certificates • Vendor secrets (provisioning

©2017ArmLimited36

SecureStorageOutlook(OpenDiscussion)

•  Lifecyclemanagement•  SecureTimebasedlifecyclemanagement?

•  Usagecountbasedlifecyclemanagement?

Page 37: TF-M Secure Storageconnect.linaro.org.s3.amazonaws.com/hkg18/... · Connected devices have secrets! • RoT keys, Communications keys, hashes, certificates • Vendor secrets (provisioning

©2017ArmLimited37

SecureStorageOutlook(OpenDiscussion)

•  Evolutionofuserauthentication•  CurrentlypartitionIDbased

•  Doesitneedtobemoresophisticated?(challengeresponsebased?)

Page 38: TF-M Secure Storageconnect.linaro.org.s3.amazonaws.com/hkg18/... · Connected devices have secrets! • RoT keys, Communications keys, hashes, certificates • Vendor secrets (provisioning

©2017ArmLimited38

SecureStorageOutlook(OpenDiscussion)

•  Handlingvariousstoragedevicetopologies•  Dedicatedflashdeviceforsecurestorage?

•  Multi-headedflashdevice?

•  Usingsameflashfornon-secureandsecurestorage?

•  UsingNSPEfilesystem?

Page 39: TF-M Secure Storageconnect.linaro.org.s3.amazonaws.com/hkg18/... · Connected devices have secrets! • RoT keys, Communications keys, hashes, certificates • Vendor secrets (provisioning

©2017ArmLimited39

SecureStorageOutlook(OpenDiscussion)

•  CompileTimeFlashLayout•  Deterministicstoragerequirement

•  Generatetheflash-layout(i.e.whatisstoredwhere)atcompiletime

•  Reducedcodesize/complexityattheruntime

Page 40: TF-M Secure Storageconnect.linaro.org.s3.amazonaws.com/hkg18/... · Connected devices have secrets! • RoT keys, Communications keys, hashes, certificates • Vendor secrets (provisioning

©2017ArmLimited40

SecureStorageOutlook(OpenDiscussion)

•  Tooling•  Toolingtosupporteasydefinitionofpolicytable

•  Provision’ablePolicyDatabase(currentlycompiled-in)