141002.cryptech-iij.pdf

35
CrypTech Building a More Assured HSM and Obsessing About the Tool-Chain Randy Bush <[email protected]>

Upload: ionut-colcear

Post on 21-Dec-2015

220 views

Category:

Documents


2 download

DESCRIPTION

141002.cryptech-iij.pdf

TRANSCRIPT

Page 1: 141002.cryptech-iij.pdf

CrypTech Building a More Assured

HSM and Obsessing About the Tool-Chain

Randy Bush <[email protected]>

Page 2: 141002.cryptech-iij.pdf

Hardware Security Module From Wikipedia:

A hardware security module (HSM) is a physical computing device that safeguards and manages digital keys for strong authentication and provides crypto processing. These modules traditionally come in the form of a plug-in card or an external device that attaches directly to a computer or network server.

141002 CrypTech @ IIJ 2 Creative Commons: Attribution & Share Alike

Page 3: 141002.cryptech-iij.pdf

HSMs Are Used For •  Principally, Lock-box for Private Keys for

•  DNSsec •  RPKI •  PGP •  Corporate Authentication •  Encryption / Decryption •  VPNs •  Source of Randomness •  Your use goes here

141002 CrypTech @ IIJ 3 Creative Commons: Attribution & Share Alike

Page 4: 141002.cryptech-iij.pdf

The Need •  Every week a new horror about Crypto/Privacy

•  der Spiegel’s revelation of the “SpyMall Catalogue”

•  Compromises of and trojans in most network devices, servers, firewalls, ...

•  We are relying on HSMs designed and made by 42-eyes government contractors

•  Many people are not comfortable with this 141002 CrypTech @ IIJ 4 Creative Commons: Attribution & Share Alike

Page 5: 141002.cryptech-iij.pdf

141002 CrypTech @ IIJ 5 Creative Commons: Attribution & Share Alike

Page 6: 141002.cryptech-iij.pdf

Origins •  This effort was started at the suggestion of

Russ Housley, Jari Arkko, and Stephen Farrell of the IETF, to meet the assurance needs of supporting IETF protocols in an open and transparent manner.

•  But this is NOT an IETF, ISOC, ... project, though both contribute. As the saying goes, “We work for the Internet.”

141002 CrypTech @ IIJ 6 Creative Commons: Attribution & Share Alike

Page 7: 141002.cryptech-iij.pdf

Goals •  An open-source reference design for

HSMs

•  Scalable, first cut in an FPGA and CPU, later allow higher speed options

•  Composable, e.g. “Give me a key store and signer suitable for DNSsec”

•  Reasonable assurance by being open, diverse design team, and an increasingly assured tool-chain

141002 CrypTech @ IIJ 7 Creative Commons: Attribution & Share Alike

Page 8: 141002.cryptech-iij.pdf

Open and Transparent •  The project is being run in a maximally

open, transparent manner with traceability for all decisions etc.

•  We do this in order to build trust in the project itself

•  And diverse, engineering and funding

141002 CrypTech @ IIJ 8 Creative Commons: Attribution & Share Alike

Page 9: 141002.cryptech-iij.pdf

Funding (so far) From

141002 CrypTech @ IIJ 9 Creative Commons: Attribution & Share Alike

A Few Private Donations

Page 10: 141002.cryptech-iij.pdf

FPGA (ASIC) Hashes: SHA*/MD5/GOST Encrypt: AES/Camellia PublicKey RSA/ECC/DSA, Block Crypto Modes

TRNG, BigNum, Modular, Exponentiation

On-Chip Core(s) KeyGen/Store, Hash, Sign, Verify, Encrypt, Decrypt, DH, ECDH,

PKCS#1/5/8, [Un]Load, Stretching, Device Activation/Wipe

Off-ChipSupport Code X.509/PGP/… Packaging, PKCS#7/10/11/15, Backup

Applications DNSSEC, RPKI, PGP, VPN, OTR, random, TCP/AO, …

Security Boundary

& Tamper Power Timing

Layer Cake Model

141002 CrypTech @ IIJ Creative Commons: Attribution & Share Alike 10

Page 11: 141002.cryptech-iij.pdf

FPGA Cat Video

141002 CrypTech @ IIJ 11

Creative Commons: Attribution & Share Alike

Page 12: 141002.cryptech-iij.pdf

A Prototyping Board

141002 CrypTech @ IIJ 12 Creative Commons: Attribution & Share Alike

Page 13: 141002.cryptech-iij.pdf

Novena Spartan ‘Laptop’

141002 CrypTech @ IIJ 13 Creative Commons: Attribution & Share Alike

FPGA

Page 14: 141002.cryptech-iij.pdf

Entropy with Pi Pin-Out

141002 CrypTech @ IIJ 14 Creative Commons: Attribution & Share Alike

Page 15: 141002.cryptech-iij.pdf

Entropy on Novena

Creative Commons: Attribution & Share Alike 15 141002 CrypTech @ IIJ

FPGA

Page 16: 141002.cryptech-iij.pdf

Entropy Porn

141002 CrypTech @ IIJ 16 Creative Commons: Attribution & Share Alike

Page 17: 141002.cryptech-iij.pdf

TRNG Chain

141002 CrypTech @ IIJ 17 Creative Commons: Attribution & Share Alike

Page 18: 141002.cryptech-iij.pdf

Entropy Provider

Mixer (SHA-512)

CSPRNG (ChaCha)

Control & Test

Seed

Entropy Provider

FPGA

Random values

The TRNG Architecture

External Noise

Source

141002 CrypTech @ IIJ Creative Commons: Attribution & Share Alike 18

P

P

Page 19: 141002.cryptech-iij.pdf

Entropy Provider

Mixer (SHA-512)

CSPRNG (ChaCha)

Control & Test

Seed

Entropy Provider

FPGA

Random values

Or Maybe

External Noise

Source

141002 CrypTech @ IIJ Creative Commons: Attribution & Share Alike 19

P

P

Page 20: 141002.cryptech-iij.pdf

Test and Observability •  Two modes

•  Production Mode (PM) and Test Mode (TM)

•  Observability of entropy sources in PM •  Continuous on-line testing in PM •  Injection in stages and complete chain in TM •  Generation of a small number of values in TM •  Allows test of all digital functionality including

continuous tests. •  Full restart when going between TM and PM

141002 CrypTech @ IIJ Creative Commons: Attribution & Share Alike 20

Page 21: 141002.cryptech-iij.pdf

Entropy collect

Post- proc

AIS31

b0rk

On-line tests alarm

Test access to noise and entropy

Entropy to mixer

Noise alarm

•  Extract for off-line comprehensive testing •  Inject for functional testing in test mode

Observability & Test of Entropy Sources

141002 CrypTech @ IIJ Creative Commons: Attribution & Share Alike 21

P

Page 22: 141002.cryptech-iij.pdf

Mix function

(SHA-512)

Entropy

Entropy

Seed

Inject for functional testing in test mode

Observability & Test of Mixer

141002 CrypTech @ IIJ Creative Commons: Attribution & Share Alike 22

Page 23: 141002.cryptech-iij.pdf

Stream cipher

(ChaCha)

Seed Random values

Inject for functional testing in test mode

Observability & Test of CSPRNG

141002 CrypTech @ IIJ Creative Commons: Attribution & Share Alike 23

Page 24: 141002.cryptech-iij.pdf

Some of the Fears •  ToolChain Poisoning

•  Device Poisoning

•  Side-Channel Attacks

•  How can you tell if your vendor actually implemented CrypTech, and correctly?

141002 CrypTech @ IIJ 24 Creative Commons: Attribution & Share Alike

Page 25: 141002.cryptech-iij.pdf

The Tool Chain •  When my laptop’s fan goes on, I think it

is the NSA, GCHQ, Israelis, Chinese, … are fighting to see who will own me

•  We have NO ASSURANCE of our tool set, from CPU to Kernel to Compiler to …

•  When constructing assurance-critical tools, we need to maximize assurance in the tools used to build them

141002 CrypTech @ IIJ 25 Creative Commons: Attribution & Share Alike

Page 26: 141002.cryptech-iij.pdf

The Compiler •  Ken Thompson’s 1984 Turing Award paper

Reflections on Trusting Trust

•  A self-reproducing trap in the C compiler which “would match code in the UNIX "login" command. The replacement code would miscompile the login command so that it would accept either the intended encrypted password or a particular known password.” You have been owned!

141002 CrypTech @ IIJ 26 Creative Commons: Attribution & Share Alike

Page 27: 141002.cryptech-iij.pdf

Double-Diverse Compilation •  In his 2009 PhD dissertation, David

Wheeler explained how to counter the “trusting trust” attack by using the “Diverse Double-Compiling” (DDC) technique

•  We can use this on GCC and clang to get somewhat assured compilers

•  But you still have to inspect the source!

141002 CrypTech @ IIJ 27 Creative Commons: Attribution & Share Alike

Page 28: 141002.cryptech-iij.pdf

Critical Tool-Chain •  C compilers audited and built using DCC •  Audited kernel, libc, … •  Audited whole darn UNIX or Linux •  Audited Verilog compiler •  Audited FPGA download tools •  Audited test tools •  Trojan prevention & detection

141002 CrypTech @ IIJ 28 Creative Commons: Attribution & Share Alike

Page 29: 141002.cryptech-iij.pdf

HDL / Verilog •  But FPGAs/ASICs are programmed in a

Hardware Definition Language, Verilog

•  It is very hard to get an open Verilog compiler

•  Verilog can not compile itself, so DDC is not applicable here, just a DCC C compiler

•  We are working on methods of gaining trust in the FPGA tool chain

141002 CrypTech @ IIJ 29 Creative Commons: Attribution & Share Alike

Page 30: 141002.cryptech-iij.pdf

Side Channel & Tampering •  Exponentiation circuit timing leaks are

exploitable remotely

•  Power leakage is exploitable locally

•  Physical attack detection critical

•  Wipe key store if tampering detected

•  Side-Channel attacks are the subject of entire conferences

141002 CrypTech @ IIJ 30 Creative Commons: Attribution & Share Alike

Page 31: 141002.cryptech-iij.pdf

Potting Boundary

141002 CrypTech @ IIJ 31 Creative Commons: Attribution & Share Alike

FPGA Hashes: SHA*/MD5/GOST Encrypt: AES/Camellia PublicKey RSA/ECC/DSA, Block Crypto Modes

TRNG, BigNum, Modular, Exponentiation

On-Chip Core(s) KeyGen/Store, Hash, Sign, Verify, Encrypt, Decrypt, DH, ECDH,

PKCS#1/5/8, [Un]Load, Stretching, Device Activation/Wipe

Security Boundary

& Tamper Power Timing

•  The FPGA/ASIC and accompanying Core(s) (ARM, whatever) are within the physically protected boundary of the chip carrier potting.

•  On-board battery/capacitor to buy the time to wipe all data if unplugged from power

•  We worry about tampering, what if the chip is opened and attacked? So the potting includes tampering sensors and code to wipe all keys if tampering is detected.

Page 32: 141002.cryptech-iij.pdf

Some Phases •  First Year: Tool-chain, Basic Design, not

all cyphers, not all protocols, prototype implementations on FPGAs and boards

•  Second Year: Better Tool-chain, all needed cyphers, hashes, crypting, … and integration with some apps, DNSsec, RPKI, TLS, PGP, Tor

•  Third Year: Solid packaging, ability to compose designs for use cases, etc.

141002 CrypTech @ IIJ 32 Creative Commons: Attribution & Share Alike

Page 33: 141002.cryptech-iij.pdf

A Few Related Projects •  Truecrypt audit: http://istruecryptauditedyet.com!

•  OpenCores: http://opencores.org!

•  Icarus Verilog: http://iverilog.icarus.com!

•  Valgrind: http://valgrind.org!

•  clang+llvm: http://clang.llvm.org!

141002 CrypTech @ IIJ 33 Creative Commons: Attribution & Share Alike

Page 34: 141002.cryptech-iij.pdf

141002 CrypTech @ IIJ 34 Creative Commons: Attribution & Share Alike

Page 35: 141002.cryptech-iij.pdf

https://cryptech.is/

141002 CrypTech @ IIJ 35 Creative Commons: Attribution & Share Alike