OP-TEE Using TrustZone to Protect Our Own Secrets ROM-Code - - PowerPoint PPT Presentation

op tee using trustzone to protect our own secrets
SMART_READER_LITE
LIVE PREVIEW

OP-TEE Using TrustZone to Protect Our Own Secrets ROM-Code - - PowerPoint PPT Presentation

OP-TEE Using TrustZone to Protect Our Own Secrets ROM-Code Bootloader OP-TEE Kernel Root File System ELC Europe 2017, 23.10.2017 Marc Kleine-Budde <mkl@pengutronix.de> Slide 1 - http://www.pengutronix.de - 2017-10-23 Overview ARM


slide-1
SLIDE 1

Slide 1 - http://www.pengutronix.de - 2017-10-23

OP-TEE Using TrustZone to Protect Our Own Secrets

ELC Europe 2017, 23.10.2017 Marc Kleine-Budde <mkl@pengutronix.de> ROM-Code Bootloader OP-TEE Root File System Kernel

slide-2
SLIDE 2

Slide 3 - http://www.pengutronix.de - 2017-10-23

Overview

  • ARM architecture overview
  • ARM TrustZone
  • Trusted Execution Environment
  • Open Portable Trusted Execution Environment
slide-3
SLIDE 3

Slide 4 - http://www.pengutronix.de - 2017-10-23

What is a TEE?

  • Trusted Execution Environment
  • small OS-like environment
  • isolated from normal operating system (e.g. Linux) “rich OS”
  • Allows Applications to execute, process, protect and store sensitive data
  • Rich OS is often target of malware and attackers
  • Design applications so that sensitive functions

can be offloaded to the TEE as Trusted Applications.

  • API standardized by GlobalPlatform
  • TEE internal APIs for Trusted Application
  • communication interfaces between

rich OS Applications and Trusted Applications

slide-4
SLIDE 4

Slide 5 - http://www.pengutronix.de - 2017-10-23

What is a TEE? (cont'd)

SE TEE Rich OS SE TEE SE Rich OS Security Functionality

slide-5
SLIDE 5

Slide 6 - http://www.pengutronix.de - 2017-10-23

ARM architecture

usr

App App App

svc

OS ARM SoC

slide-6
SLIDE 6

Slide 7 - http://www.pengutronix.de - 2017-10-23

ARM architecture with TrustZone

usr

App App App

svc

OS ARM SoC Normal world

usr (secure state)

App App Trusted App

svc (secure state)

Trusted OS Secure world

mon (secure state)

Secure Monitor

slide-7
SLIDE 7

Slide 8 - http://www.pengutronix.de - 2017-10-23

ARM architecture with TrustZone (cont'd)

  • Provides a complete “virtual system” for secure computing
  • Divide hardware and software into separate partitions (“worlds”)
  • one is trusted (“secure world”)
  • the other not (“Normal world”)
  • Limited and tightly defined ways to get from one world to the other

secure monitor →

slide-8
SLIDE 8

Slide 9 - http://www.pengutronix.de - 2017-10-23

ARM TrustZone in detail

Source: http://genode.org/documentation/articles/trustzone

slide-9
SLIDE 9

Slide 10 - http://www.pengutronix.de - 2017-10-23

ARM TrustZone in detail (cont'd)

  • Security Extensions to ARM processors
  • Supported by
  • ARM1176
  • Cortex-A series (ARMv7-A, ARMv8-A)
  • ARMv8-M
  • System-wide hardware isolation
  • SRAM
  • DRAM
  • CPU configuration registers
  • peripherals
  • SoC design has impact on practical usefulness of security features
slide-10
SLIDE 10

Slide 11 - http://www.pengutronix.de - 2017-10-23

ARM TrustZone switching worlds

  • Secure World entry
  • Hardware-controlled
  • automatic
  • partly configurable
  • By exception
  • Reset
  • CPU always starts secure
  • Secure Monitor Call
  • SMC #n instruction
  • analogous to Supervisor Call (SVC)
  • always handled in Secure World
  • IRQ, FIQ, Data abort
  • configurable (by secure software)
  • Non-Secure World entry
  • Software-controlled
  • Typically
  • set SCR.NS
  • return from execption

Secure Non-Secure Reset software hardware

slide-11
SLIDE 11

Slide 12 - http://www.pengutronix.de - 2017-10-23

What is OP-TEE?

  • Started as closed source implementation by some

mobile, telco and chip vendors

  • Since 2015 Open Source (BSD license),
  • wned and maintained by Linaro
  • In 2017 the TEE driver went mainline with v4.12
  • Small and simple TEE
  • Relies on rich OS to schedule TEE
  • Based on ARM TrustZone to provide isolation of

the TEE from the rich OS in hardware

  • Runs on ~20 platforms
  • 32 bit: ARMv7-A
  • 64 bit: ARMv8-A
slide-12
SLIDE 12

Slide 13 - http://www.pengutronix.de - 2017-10-23

OP-TEE architecture

usr

Native App svc

ARM SoC

Non-Secure world

mon (secure state) Secure Monitor GlobalPlatform TEE Client API TEE Supplicant Wrapper API (optional) TEE Driver Storage...

usr (secure state)

App App Trusted App

svc (secure state)

TEE core

Secure world

TEE functions/libs (crypto...) HAL GlobalPlatform TEE internal API

  • ptee_client
  • ptee_os
  • ptee_linuxdriver

Source: https://www.linaro.org/blog/core-dump/op-tee-open-source-security-mass-market/

slide-13
SLIDE 13

Slide 14 - http://www.pengutronix.de - 2017-10-23

OP-TEE in detail

  • The OP-TEE consists of three parts
  • Normal World, User Mode
  • TEE client library
  • tee-supplicant
  • file system access
  • access to shared resources
  • Normal World, Priviledged Mode
  • Linux kernel TEE subsystem
  • Linux kernel TEE device driver
  • Secure world, Priviledged Mode
  • Trusted OS (optee_os)
  • TEE contains public key
  • Trusted Applications are singed and can be

loaded from the Normal World into the TEE

slide-14
SLIDE 14

Slide 15 - http://www.pengutronix.de - 2017-10-23

OP-TEE - Trusted Boot ARMv7-A: i.MX6

SoC ROM- Code Fuses Boot Loader OP-TEE incl. Pubkey Signature Pubkey For details on trusted boot see my talk from ELCE 2016.

slide-15
SLIDE 15

Slide 16 - http://www.pengutronix.de - 2017-10-23

OP-TEE - Boot sequence in ARMv7-A: i.MX6

Non-Secure world Secure world

Kernel initialize and run Reset ROM-Code load/check bootloader bootloader (barebox) load/check TEE kernel, DTB, initrd TEE initialize and run request secure service TEE - Perform secure service

Return from exeption SMC #n Return from exeption

slide-16
SLIDE 16

Slide 17 - http://www.pengutronix.de - 2017-10-23

Observations & What's Missing?

  • Better SoC support
  • more SRAM
  • TrustZone support missing in some peripherals
  • TrustZone: From my (limited) point of view:
  • The concept of moving peripherals into Secure World

is “complicated” on todays SoCs.

  • Think about turning off the clock of the Secure World's

I2C, PWM or Ethernet Controller.

  • Support for existing private key storages
  • inside the Linux kernel
  • opengpg/ssh
  • TPM
  • build system feels Android centric
  • make use more use of DT
  • convert config #ifdef to kconfig
slide-17
SLIDE 17

Slide 18 - http://www.pengutronix.de - 2017-10-23

Summary

  • TEE – Trusted Execution Environment
  • Set of APIs to split applications into normal and secure part
  • TrustZone
  • Security extension for ARM processors to partition one SoC

into Normal and Secure World

  • Practical usefulness depends on SoC design
  • OP-TEE – Open Platform TEE
  • Implements TEE on ARM using TrustZone
slide-18
SLIDE 18

Slide 19 - http://www.pengutronix.de - 2017-10-23

Q & A

@marckleinebudde