SlideShare uma empresa Scribd logo
1 de 15
Baixar para ler offline
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

Mais conteúdo relacionado

Mais de 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
 

Mais de 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
 

Último

08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 

Último (20)

08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 

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