SlideShare ist ein Scribd-Unternehmen logo
1 von 15
Downloaden Sie, um offline zu lesen
Digital Signatures
and the
Beginning of the World
David Brown
ENGINEERS
AND DEVICES
WORKING
TOGETHER
Introduction
● About MCUboot, an IoT bootloader
○ Systems with 0.5-1 MB flash, and 16-256K RAM
○ Constrained, small, yet connected to the world
● Bootloader is the beginning of trust
○ Without it, no trust
○ Needs to verify the next image should be run and is untampered
● Digital Signatures
○ Public Key cryptography
○ Public Key in bootloader
○ Private key used offline to sign images
● What have we learned with MCUboot
ENGINEERS AND DEVICES
WORKING TOGETHER
Digital Signatures
ENGINEERS
AND DEVICES
WORKING
TOGETHER
Signature Algorithms
● RSA
○ Old, well understood
○ Problems are understood and not too hard to get verification right
○ Many attacks, such as cache and timing, apply to the signing of
messages, not verification, makes our job easier
○ Keys and signatures are huge:
RSA-2048 are 256 bytes for signature, ~270 for public key
● Elliptic Curves
○ More complex math
○ Much shorter keys/sigs, e.g. ~91 bytes for public key, as little as ~32
bytes for signature
○ How to choose curves (and who do you trust)
○ We support NIST P-224 and P-256 curves with ECDSA
○ Soon, will be adding Ed25519
ENGINEERS
AND DEVICES
WORKING
TOGETHER
Curve Problems
● Elliptic Curve cryptography is sensitive to the choice of
curve chosen
● Many use NIST-defined curves, these have magic
numbers, and many are suspicious these can be
subverted
● Implementations tend to be tied to a specific curve
(general EC code is typically 1/10 the speed)
● Looking into Ed25519 to avoid these issues
ENGINEERS
AND DEVICES
WORKING
TOGETHER
Storage Formats
● A signature is generally a few large numbers
○ ECDSA
■ two large numbers
■ Standard defines an encoding
■ End result is wrapped in ASN.1 DER encoded block
○ RSA:
■ Single large number
■ Standards define ASN.1 DER encoded block holding it
○ Ed25519
■ Just 64 bytes, doesn’t need encoding or wrapping
● RSA weaknesses
○ “signing” incorrect things can leak information about private key (see
references at end)
○ PKCS #1 v1.5 defines a block to prevent this
○ PSS scheme wraps hash to be signed in complex block to prevent
this, PSS is possibly more secure
ENGINEERS
AND DEVICES
WORKING
TOGETHER
Implementations
● 1. Never design your own cryptography
● 2. Never implement your own cryptography
● As such, we use some existing implementations
○ mbed TLS https://tls.mbed.org/
○ TinyCrypt https://github.com/01org/tinycrypt
○ NaCL and TweetNaCL https://nacl.cr.yp.to/ and
https://tweetnacl.cr.yp.to/
ENGINEERS
AND DEVICES
WORKING
TOGETHER
mbed TLS
● Pros
○ Reasonably complete TLS/DTLS
○ Includes numerous crypto primitives, sufficient to implement RSA
and some ECDSA
○ Contains a small, simple, ASN.1 DER decoder
○ MCUboot uses it for RSA and ECDSA, with the P-224 curve
● Cons
○ Some parts are a bit large (think goal of 16K of codespace total for
bootloader)
○ bignum math requires malloc/free
ENGINEERS
AND DEVICES
WORKING
TOGETHER
TinyCrypt
● Very small “focused” crypto library
● Has a small set of primitives and some building blocks
● Has most of the parts needed for ECDSA with P-256
● We use for this signature
● Still need the ASN.1 decoder from mbed TLS
ENGINEERS
AND DEVICES
WORKING
TOGETHER
NaCL, and TweetNaCL
● Similar implementations of Ed25519
● NaCL Ed25519 is about 100KB of Code
● TweetNaCL for Ed255 is about 3KB of Code
● Yes, 3K
● But, NaCL is about 35 times faster
● Signature verification with TweetNaCL is about 1-2
seconds
ENGINEERS
AND DEVICES
WORKING
TOGETHER
Ed25519 “problems”
● Defined to hash message with a nonce prefix
● Both implementations require a RAM buffer slightly larger
than image to sign or verify
● This doesn’t work with small RAM
● It is possible to sign a hash rather than the message
● Defeats some of the protections in place
● Could be fixed, is an implementation issue, not a
protocol/algorithm issue
ENGINEERS
AND DEVICES
WORKING
TOGETHER
MCUboot
● Choices
● Configure which signing algorithm is used, brings in
appropriate crypto libraries
● Different tradeoffs for different devices
○ RSA has large keys, but is fast
○ ECDSA has small keys with cost of time
○ Ed25519 is “best of both worlds”, as long as you have lots of ROM
available. Otherwise, it is only useful with 1-2 seconds to boot are
acceptable
ENGINEERS
AND DEVICES
WORKING
TOGETHER
imgtool.py
● Most docs about keys end up with list of crypto ‘openssl’
commands
● Commands for RSA, and ECDSA are quite different
● OpenSSL doesn’t support Ed25519
● We wrote ‘imgtool.py’
○ key generation
○ extracting public key for MCUboot
○ signing images
ENGINEERS
AND DEVICES
WORKING
TOGETHER
Some references
● https://mcuboot.com/
● https://github.com/runtimeco/mcuboot
● RSA weakness with chosen plaintext
http://www.dtc.umn.edu/~odlyzko/doc/index.calculation.r
sa.pdf
● Blog about this:
https://www.davidb.org/post/key-formats/
Thank You
#SFO17
BUD17 keynotes and videos on: connect.linaro.org
For further information: www.linaro.org

Weitere ähnliche Inhalte

Mehr von Linaro

Yutaka Ishikawa - Post-K and Arm HPC Ecosystem - Linaro Arm HPC Workshop Sant...
Yutaka Ishikawa - Post-K and Arm HPC Ecosystem - Linaro Arm HPC Workshop Sant...Yutaka Ishikawa - Post-K and Arm HPC Ecosystem - Linaro Arm HPC Workshop Sant...
Yutaka Ishikawa - Post-K and Arm HPC Ecosystem - Linaro Arm HPC Workshop Sant...Linaro
 
Andrew J Younge - Vanguard Astra - Petascale Arm Platform for U.S. DOE/ASC Su...
Andrew J Younge - Vanguard Astra - Petascale Arm Platform for U.S. DOE/ASC Su...Andrew J Younge - Vanguard Astra - Petascale Arm Platform for U.S. DOE/ASC Su...
Andrew J Younge - Vanguard Astra - Petascale Arm Platform for U.S. DOE/ASC Su...Linaro
 
HKG18-501 - EAS on Common Kernel 4.14 and getting (much) closer to mainline
HKG18-501 - EAS on Common Kernel 4.14 and getting (much) closer to mainlineHKG18-501 - EAS on Common Kernel 4.14 and getting (much) closer to mainline
HKG18-501 - EAS on Common Kernel 4.14 and getting (much) closer to mainlineLinaro
 
HKG18-100K1 - George Grey: Opening Keynote
HKG18-100K1 - George Grey: Opening KeynoteHKG18-100K1 - George Grey: Opening Keynote
HKG18-100K1 - George Grey: Opening KeynoteLinaro
 
HKG18-318 - OpenAMP Workshop
HKG18-318 - OpenAMP WorkshopHKG18-318 - OpenAMP Workshop
HKG18-318 - OpenAMP WorkshopLinaro
 
HKG18-501 - EAS on Common Kernel 4.14 and getting (much) closer to mainline
HKG18-501 - EAS on Common Kernel 4.14 and getting (much) closer to mainlineHKG18-501 - EAS on Common Kernel 4.14 and getting (much) closer to mainline
HKG18-501 - EAS on Common Kernel 4.14 and getting (much) closer to mainlineLinaro
 
HKG18-315 - Why the ecosystem is a wonderful thing, warts and all
HKG18-315 - Why the ecosystem is a wonderful thing, warts and allHKG18-315 - Why the ecosystem is a wonderful thing, warts and all
HKG18-315 - Why the ecosystem is a wonderful thing, warts and allLinaro
 
HKG18- 115 - Partitioning ARM Systems with the Jailhouse Hypervisor
HKG18- 115 - Partitioning ARM Systems with the Jailhouse HypervisorHKG18- 115 - Partitioning ARM Systems with the Jailhouse Hypervisor
HKG18- 115 - Partitioning ARM Systems with the Jailhouse HypervisorLinaro
 
HKG18-TR08 - Upstreaming SVE in QEMU
HKG18-TR08 - Upstreaming SVE in QEMUHKG18-TR08 - Upstreaming SVE in QEMU
HKG18-TR08 - Upstreaming SVE in QEMULinaro
 
HKG18-113- Secure Data Path work with i.MX8M
HKG18-113- Secure Data Path work with i.MX8MHKG18-113- Secure Data Path work with i.MX8M
HKG18-113- Secure Data Path work with i.MX8MLinaro
 
HKG18-120 - Devicetree Schema Documentation and Validation
HKG18-120 - Devicetree Schema Documentation and Validation HKG18-120 - Devicetree Schema Documentation and Validation
HKG18-120 - Devicetree Schema Documentation and Validation Linaro
 
HKG18-223 - Trusted FirmwareM: Trusted boot
HKG18-223 - Trusted FirmwareM: Trusted bootHKG18-223 - Trusted FirmwareM: Trusted boot
HKG18-223 - Trusted FirmwareM: Trusted bootLinaro
 
HKG18-500K1 - Keynote: Dileep Bhandarkar - Emerging Computing Trends in the D...
HKG18-500K1 - Keynote: Dileep Bhandarkar - Emerging Computing Trends in the D...HKG18-500K1 - Keynote: Dileep Bhandarkar - Emerging Computing Trends in the D...
HKG18-500K1 - Keynote: Dileep Bhandarkar - Emerging Computing Trends in the D...Linaro
 
HKG18-317 - Arm Server Ready Program
HKG18-317 - Arm Server Ready ProgramHKG18-317 - Arm Server Ready Program
HKG18-317 - Arm Server Ready ProgramLinaro
 
HKG18-312 - CMSIS-NN
HKG18-312 - CMSIS-NNHKG18-312 - CMSIS-NN
HKG18-312 - CMSIS-NNLinaro
 
HKG18-301 - Dramatically Accelerate 96Board Software via an FPGA with Integra...
HKG18-301 - Dramatically Accelerate 96Board Software via an FPGA with Integra...HKG18-301 - Dramatically Accelerate 96Board Software via an FPGA with Integra...
HKG18-301 - Dramatically Accelerate 96Board Software via an FPGA with Integra...Linaro
 
HKG18-300K2 - Keynote: Tomas Evensen - All Programmable SoCs? – Platforms to ...
HKG18-300K2 - Keynote: Tomas Evensen - All Programmable SoCs? – Platforms to ...HKG18-300K2 - Keynote: Tomas Evensen - All Programmable SoCs? – Platforms to ...
HKG18-300K2 - Keynote: Tomas Evensen - All Programmable SoCs? – Platforms to ...Linaro
 
HKG18-212 - Trusted Firmware M: Introduction
HKG18-212 - Trusted Firmware M: IntroductionHKG18-212 - Trusted Firmware M: Introduction
HKG18-212 - Trusted Firmware M: IntroductionLinaro
 
HKG18-116 - RAS Solutions for Arm64 Servers
HKG18-116 - RAS Solutions for Arm64 ServersHKG18-116 - RAS Solutions for Arm64 Servers
HKG18-116 - RAS Solutions for Arm64 ServersLinaro
 
HKG18-TR14 - Postmortem Debugging with Coresight
HKG18-TR14 - Postmortem Debugging with CoresightHKG18-TR14 - Postmortem Debugging with Coresight
HKG18-TR14 - Postmortem Debugging with CoresightLinaro
 

Mehr von Linaro (20)

Yutaka Ishikawa - Post-K and Arm HPC Ecosystem - Linaro Arm HPC Workshop Sant...
Yutaka Ishikawa - Post-K and Arm HPC Ecosystem - Linaro Arm HPC Workshop Sant...Yutaka Ishikawa - Post-K and Arm HPC Ecosystem - Linaro Arm HPC Workshop Sant...
Yutaka Ishikawa - Post-K and Arm HPC Ecosystem - Linaro Arm HPC Workshop Sant...
 
Andrew J Younge - Vanguard Astra - Petascale Arm Platform for U.S. DOE/ASC Su...
Andrew J Younge - Vanguard Astra - Petascale Arm Platform for U.S. DOE/ASC Su...Andrew J Younge - Vanguard Astra - Petascale Arm Platform for U.S. DOE/ASC Su...
Andrew J Younge - Vanguard Astra - Petascale Arm Platform for U.S. DOE/ASC Su...
 
HKG18-501 - EAS on Common Kernel 4.14 and getting (much) closer to mainline
HKG18-501 - EAS on Common Kernel 4.14 and getting (much) closer to mainlineHKG18-501 - EAS on Common Kernel 4.14 and getting (much) closer to mainline
HKG18-501 - EAS on Common Kernel 4.14 and getting (much) closer to mainline
 
HKG18-100K1 - George Grey: Opening Keynote
HKG18-100K1 - George Grey: Opening KeynoteHKG18-100K1 - George Grey: Opening Keynote
HKG18-100K1 - George Grey: Opening Keynote
 
HKG18-318 - OpenAMP Workshop
HKG18-318 - OpenAMP WorkshopHKG18-318 - OpenAMP Workshop
HKG18-318 - OpenAMP Workshop
 
HKG18-501 - EAS on Common Kernel 4.14 and getting (much) closer to mainline
HKG18-501 - EAS on Common Kernel 4.14 and getting (much) closer to mainlineHKG18-501 - EAS on Common Kernel 4.14 and getting (much) closer to mainline
HKG18-501 - EAS on Common Kernel 4.14 and getting (much) closer to mainline
 
HKG18-315 - Why the ecosystem is a wonderful thing, warts and all
HKG18-315 - Why the ecosystem is a wonderful thing, warts and allHKG18-315 - Why the ecosystem is a wonderful thing, warts and all
HKG18-315 - Why the ecosystem is a wonderful thing, warts and all
 
HKG18- 115 - Partitioning ARM Systems with the Jailhouse Hypervisor
HKG18- 115 - Partitioning ARM Systems with the Jailhouse HypervisorHKG18- 115 - Partitioning ARM Systems with the Jailhouse Hypervisor
HKG18- 115 - Partitioning ARM Systems with the Jailhouse Hypervisor
 
HKG18-TR08 - Upstreaming SVE in QEMU
HKG18-TR08 - Upstreaming SVE in QEMUHKG18-TR08 - Upstreaming SVE in QEMU
HKG18-TR08 - Upstreaming SVE in QEMU
 
HKG18-113- Secure Data Path work with i.MX8M
HKG18-113- Secure Data Path work with i.MX8MHKG18-113- Secure Data Path work with i.MX8M
HKG18-113- Secure Data Path work with i.MX8M
 
HKG18-120 - Devicetree Schema Documentation and Validation
HKG18-120 - Devicetree Schema Documentation and Validation HKG18-120 - Devicetree Schema Documentation and Validation
HKG18-120 - Devicetree Schema Documentation and Validation
 
HKG18-223 - Trusted FirmwareM: Trusted boot
HKG18-223 - Trusted FirmwareM: Trusted bootHKG18-223 - Trusted FirmwareM: Trusted boot
HKG18-223 - Trusted FirmwareM: Trusted boot
 
HKG18-500K1 - Keynote: Dileep Bhandarkar - Emerging Computing Trends in the D...
HKG18-500K1 - Keynote: Dileep Bhandarkar - Emerging Computing Trends in the D...HKG18-500K1 - Keynote: Dileep Bhandarkar - Emerging Computing Trends in the D...
HKG18-500K1 - Keynote: Dileep Bhandarkar - Emerging Computing Trends in the D...
 
HKG18-317 - Arm Server Ready Program
HKG18-317 - Arm Server Ready ProgramHKG18-317 - Arm Server Ready Program
HKG18-317 - Arm Server Ready Program
 
HKG18-312 - CMSIS-NN
HKG18-312 - CMSIS-NNHKG18-312 - CMSIS-NN
HKG18-312 - CMSIS-NN
 
HKG18-301 - Dramatically Accelerate 96Board Software via an FPGA with Integra...
HKG18-301 - Dramatically Accelerate 96Board Software via an FPGA with Integra...HKG18-301 - Dramatically Accelerate 96Board Software via an FPGA with Integra...
HKG18-301 - Dramatically Accelerate 96Board Software via an FPGA with Integra...
 
HKG18-300K2 - Keynote: Tomas Evensen - All Programmable SoCs? – Platforms to ...
HKG18-300K2 - Keynote: Tomas Evensen - All Programmable SoCs? – Platforms to ...HKG18-300K2 - Keynote: Tomas Evensen - All Programmable SoCs? – Platforms to ...
HKG18-300K2 - Keynote: Tomas Evensen - All Programmable SoCs? – Platforms to ...
 
HKG18-212 - Trusted Firmware M: Introduction
HKG18-212 - Trusted Firmware M: IntroductionHKG18-212 - Trusted Firmware M: Introduction
HKG18-212 - Trusted Firmware M: Introduction
 
HKG18-116 - RAS Solutions for Arm64 Servers
HKG18-116 - RAS Solutions for Arm64 ServersHKG18-116 - RAS Solutions for Arm64 Servers
HKG18-116 - RAS Solutions for Arm64 Servers
 
HKG18-TR14 - Postmortem Debugging with Coresight
HKG18-TR14 - Postmortem Debugging with CoresightHKG18-TR14 - Postmortem Debugging with Coresight
HKG18-TR14 - Postmortem Debugging with Coresight
 

Kürzlich hochgeladen

Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 

Kürzlich hochgeladen (20)

Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 

Digital signatures and the beginning of the world - SFO17-306

  • 1. Digital Signatures and the Beginning of the World David Brown
  • 2. ENGINEERS AND DEVICES WORKING TOGETHER Introduction ● About MCUboot, an IoT bootloader ○ Systems with 0.5-1 MB flash, and 16-256K RAM ○ Constrained, small, yet connected to the world ● Bootloader is the beginning of trust ○ Without it, no trust ○ Needs to verify the next image should be run and is untampered ● Digital Signatures ○ Public Key cryptography ○ Public Key in bootloader ○ Private key used offline to sign images ● What have we learned with MCUboot
  • 3. ENGINEERS AND DEVICES WORKING TOGETHER Digital Signatures
  • 4. ENGINEERS AND DEVICES WORKING TOGETHER Signature Algorithms ● RSA ○ Old, well understood ○ Problems are understood and not too hard to get verification right ○ Many attacks, such as cache and timing, apply to the signing of messages, not verification, makes our job easier ○ Keys and signatures are huge: RSA-2048 are 256 bytes for signature, ~270 for public key ● Elliptic Curves ○ More complex math ○ Much shorter keys/sigs, e.g. ~91 bytes for public key, as little as ~32 bytes for signature ○ How to choose curves (and who do you trust) ○ We support NIST P-224 and P-256 curves with ECDSA ○ Soon, will be adding Ed25519
  • 5. ENGINEERS AND DEVICES WORKING TOGETHER Curve Problems ● Elliptic Curve cryptography is sensitive to the choice of curve chosen ● Many use NIST-defined curves, these have magic numbers, and many are suspicious these can be subverted ● Implementations tend to be tied to a specific curve (general EC code is typically 1/10 the speed) ● Looking into Ed25519 to avoid these issues
  • 6. ENGINEERS AND DEVICES WORKING TOGETHER Storage Formats ● A signature is generally a few large numbers ○ ECDSA ■ two large numbers ■ Standard defines an encoding ■ End result is wrapped in ASN.1 DER encoded block ○ RSA: ■ Single large number ■ Standards define ASN.1 DER encoded block holding it ○ Ed25519 ■ Just 64 bytes, doesn’t need encoding or wrapping ● RSA weaknesses ○ “signing” incorrect things can leak information about private key (see references at end) ○ PKCS #1 v1.5 defines a block to prevent this ○ PSS scheme wraps hash to be signed in complex block to prevent this, PSS is possibly more secure
  • 7. ENGINEERS AND DEVICES WORKING TOGETHER Implementations ● 1. Never design your own cryptography ● 2. Never implement your own cryptography ● As such, we use some existing implementations ○ mbed TLS https://tls.mbed.org/ ○ TinyCrypt https://github.com/01org/tinycrypt ○ NaCL and TweetNaCL https://nacl.cr.yp.to/ and https://tweetnacl.cr.yp.to/
  • 8. ENGINEERS AND DEVICES WORKING TOGETHER mbed TLS ● Pros ○ Reasonably complete TLS/DTLS ○ Includes numerous crypto primitives, sufficient to implement RSA and some ECDSA ○ Contains a small, simple, ASN.1 DER decoder ○ MCUboot uses it for RSA and ECDSA, with the P-224 curve ● Cons ○ Some parts are a bit large (think goal of 16K of codespace total for bootloader) ○ bignum math requires malloc/free
  • 9. ENGINEERS AND DEVICES WORKING TOGETHER TinyCrypt ● Very small “focused” crypto library ● Has a small set of primitives and some building blocks ● Has most of the parts needed for ECDSA with P-256 ● We use for this signature ● Still need the ASN.1 decoder from mbed TLS
  • 10. ENGINEERS AND DEVICES WORKING TOGETHER NaCL, and TweetNaCL ● Similar implementations of Ed25519 ● NaCL Ed25519 is about 100KB of Code ● TweetNaCL for Ed255 is about 3KB of Code ● Yes, 3K ● But, NaCL is about 35 times faster ● Signature verification with TweetNaCL is about 1-2 seconds
  • 11. ENGINEERS AND DEVICES WORKING TOGETHER Ed25519 “problems” ● Defined to hash message with a nonce prefix ● Both implementations require a RAM buffer slightly larger than image to sign or verify ● This doesn’t work with small RAM ● It is possible to sign a hash rather than the message ● Defeats some of the protections in place ● Could be fixed, is an implementation issue, not a protocol/algorithm issue
  • 12. ENGINEERS AND DEVICES WORKING TOGETHER MCUboot ● Choices ● Configure which signing algorithm is used, brings in appropriate crypto libraries ● Different tradeoffs for different devices ○ RSA has large keys, but is fast ○ ECDSA has small keys with cost of time ○ Ed25519 is “best of both worlds”, as long as you have lots of ROM available. Otherwise, it is only useful with 1-2 seconds to boot are acceptable
  • 13. ENGINEERS AND DEVICES WORKING TOGETHER imgtool.py ● Most docs about keys end up with list of crypto ‘openssl’ commands ● Commands for RSA, and ECDSA are quite different ● OpenSSL doesn’t support Ed25519 ● We wrote ‘imgtool.py’ ○ key generation ○ extracting public key for MCUboot ○ signing images
  • 14. ENGINEERS AND DEVICES WORKING TOGETHER Some references ● https://mcuboot.com/ ● https://github.com/runtimeco/mcuboot ● RSA weakness with chosen plaintext http://www.dtc.umn.edu/~odlyzko/doc/index.calculation.r sa.pdf ● Blog about this: https://www.davidb.org/post/key-formats/
  • 15. Thank You #SFO17 BUD17 keynotes and videos on: connect.linaro.org For further information: www.linaro.org