+ All Categories
Home > Technology > Bluetooth Over-The-Air Firmware Update

Bluetooth Over-The-Air Firmware Update

Date post: 21-Apr-2017
Category:
Upload: ramin-firoozye
View: 55 times
Download: 0 times
Share this document with a friend
34
FIRMWARE UPDATE BLUETOOTH OVER-THE-AIR SVIOS MEETUP - APRIL 2017 - RAMIN FIROOZYE - [email protected] - @RAMINF
Transcript
Page 1: Bluetooth Over-The-Air Firmware Update

FIRMWARE UPDATE

BLUETOOTH OVER-THE-AIR

SVIOS MEETUP - APRIL 2017 - RAMIN FIROOZYE - [email protected] - @RAMINF

Page 2: Bluetooth Over-The-Air Firmware Update

DEVICES ARE GETTING SMARTER

Page 3: Bluetooth Over-The-Air Firmware Update

TYPICAL BLUETOOTH DEVICE =

EMBEDDED CPU + WIRELESS + SOFTWARE

Page 4: Bluetooth Over-The-Air Firmware Update

FIRMWARE IS…▸ Software that runs on an

embedded device CPU▸ App typically written in ‘C’

and compiled into binary▸ First loaded onto device

using a wired connection or ‘programmer’ device

▸ App runs on power on

Page 5: Bluetooth Over-The-Air Firmware Update

TYPICAL CONNECTED DEVICE

HardwareFirmware

PhoneApp

ServerREST API

Page 6: Bluetooth Over-The-Air Firmware Update

IF THERE’S A PROBLEM WITH YOUR PHONE APP…▸ You push out an update to the App Store

▸ But what if there’s a problem with the firmware?

Page 7: Bluetooth Over-The-Air Firmware Update

IF PROBLEM IS WITH FIRMWARE YOU CAN:▸ Ignore it. Maybe no one will notice▸ Ask user to plug into a USB cable and manually

update▸ Factory recall the device then update and send back▸ Send a new device to every new customer

Page 8: Bluetooth Over-The-Air Firmware Update
Page 9: Bluetooth Over-The-Air Firmware Update
Page 10: Bluetooth Over-The-Air Firmware Update

THERE’S AN EASIER WAY▸ Over the Air Updates

▸ OTA▸ DFU▸ OAD

Page 11: Bluetooth Over-The-Air Firmware Update

HOW OTA UPDATES WORK

Firmwarev2.0 binary

UpdateServer

1Version ?

v1.0

App Firmware

2

OK

App Firmware

4

Here’s2.0

I havev1.0?

3

App UpdateServer

Page 12: Bluetooth Over-The-Air Firmware Update

DEVICE NEEDS▸ Enough flash storage to keep 2 or more copies of

firmware

Current

NewFactory (optional but recommended)

Page 13: Bluetooth Over-The-Air Firmware Update

FIRMWARE NEEDS TO HAVE…‣ Way to get firmware version, HW rev, and

type‣ Unique ID (if user has more than one)‣ Switch to/from normal and update mode‣ Detect incomplete/corrupt downloads‣ Recover from bad update (bricking)

Factory (maybe not so optional)

Page 14: Bluetooth Over-The-Air Firmware Update

▸ Manual▸ Always On▸ Software

switch

SWITCHING IN/OUT UPDATE MODE

Normal Mode

Update Mode

EnableUpdate

PowerOn

Page 15: Bluetooth Over-The-Air Firmware Update

HOW TO SWITCH INTO UPDATE WITH BLE▸ Scan/connect normally▸ Standard BLE Service has an ‘update mode’

characteristic▸ Write ‘1’ into characteristic (for example)▸ Firmware reboots, this time running Update BLE

Service▸ Scan for Update service▸ Connect and transfer binary

Page 16: Bluetooth Over-The-Air Firmware Update

HOW TO SWITCH OUT OF UPDATE WITH BLE▸ Wait for download complete▸ Checksum▸ If OK, overwrite old firmware▸ Restart into normal mode with new firmware▸ If not OK, either request retransmit or go back to

normal

Page 17: Bluetooth Over-The-Air Firmware Update

RECOVER FROM BAD FIRMWARE/STATE▸ Make it hard to accidentally

invoke factory reset▸ Overwrite current firmware

from on-board factory version▸ Should not require connection

(may not be there)▸ OK to lose cached data

Page 18: Bluetooth Over-The-Air Firmware Update

ALSO, SECURITY…

Page 19: Bluetooth Over-The-Air Firmware Update

SECURITY THROUGH OBSCURITY DOESN’T WORK

Page 20: Bluetooth Over-The-Air Firmware Update

COMPILED BINARY ISN’T GOOD PROTECTION

IDA Pro Disassembler/Debugger https://www.hex-rays.com/products/ida/

Page 21: Bluetooth Over-The-Air Firmware Update

UPDATES CAN ALSO BE DONE BADLY

Page 22: Bluetooth Over-The-Air Firmware Update

PRO-TIPS

Page 23: Bluetooth Over-The-Air Firmware Update

END-TO-END ENCRYPTION

Firmwarev2.0 binary

UpdateServer

1Version ?

v1.0

App Firmware

2

OK

App Firmware

4

Here’s2.0

I havev1.0?

3

App UpdateServer

Page 24: Bluetooth Over-The-Air Firmware Update

ENCRYPTION BEST-PRACTICES▸ Use asymmetric public-key encryption▸ Use digital signatures to verify devices▸ Choose BLE chip with built-in crypto hardware▸ Do full security audit/code review before launch▸ If feasible, use a ‘secure enclave’ chip to hold private

keys

Page 25: Bluetooth Over-The-Air Firmware Update

PROBLEM WITH ON-CHIP DECRYPTION▸ Need enough flash to keep 3 or more copies of

firmware

Factory (Optional)

New (encrypted)

CurrentNew (decrypted)

(Plus scratch space during decryption)

Page 26: Bluetooth Over-The-Air Firmware Update

ENCRYPTION TRADE-OFF▸ Bill Of Material

Cost▸ Processing Power▸ Added Complexity▸ Development

Time

$$$

Page 27: Bluetooth Over-The-Air Firmware Update

PLAN B: DECRYPT ON PHONE

OK

App Firmware

4

Here’s2.0

I havev1.0?

3

App UpdateServer

Requires pairing

Page 28: Bluetooth Over-The-Air Firmware Update

DECRYPTING ON IPHONE (HOMEWORK)▸ Don’t decrypt until absolutely necessary▸ Go watch WWDC 2015 Video: “Security and Your Apps”▸ https://developer.apple.com/videos/play/wwdc2015/706/▸ If too lazy check out: SecureEnclaveCrypto library on GitHub▸ https://github.com/trailofbits/SecureEnclaveCrypto▸ Set up bonding/pairing between phone and device▸ https://devzone.nordicsemi.com/question/47091/getting-an-io

s-central-app-to-bond/

Page 29: Bluetooth Over-The-Air Firmware Update

BARE MINIMUM FIRMWARE UPDATE SYSTEM▸ Manual deployment checklist ▸ Web download site with SSL (i.e. Amazon S3)▸ Firmware metadata (text file)▸ Simple mobile SDK (REST to server - BLE to device)▸ Firmware with OTA update + software toggle▸ BLE hardware with 2x flash

Page 30: Bluetooth Over-The-Air Firmware Update

A PROPER UPDATE SYSTEM▸ Rapid firmware build and

deploy (with encryption)▸ Back-end update server

(with SSL/TLS and REST API)

▸ Release workflow automation

▸ Mobile app SDK (REST to server - BLE to device)

▸ Push notification (or WebSocket support)

▸ Application UX/UI design templates

▸ Firmware with OTA update + software toggle

▸ Hardware support for OTA (4x flash + crypto + factory reset)

▸ Device segmentation and analytics

▸ End-to-end encryption

Page 31: Bluetooth Over-The-Air Firmware Update

THINK DIFFERENT▸ Treat Firmware Updates like App

Updates▸ Release an MVP device then iterate

quickly with new features▸ Have different firmware for different

markets (or users)▸ Use serial numbers & encryption to

avoid piracy▸ Do not load final firmware at factory

(!?!)

Page 33: Bluetooth Over-The-Air Firmware Update

PLAN AHEAD▸ Don’t leave firmware update support to the last minute▸ Don’t host firmware updates on same back-end as app-server▸ Always have a fallback plan / factory reset▸ Design app UX with firmware update in mind ▸ Test, test, test

Page 34: Bluetooth Over-The-Air Firmware Update

▸ If all this seems too daunting…▸ Get in touch: [email protected]

Q&A

Thank You


Recommended