cryptech - british computer societyossg.bcs.org/wp-content/uploads/140925.cryptech-bcs.pdf• der...

31
CrypTech A More Assured HSM Design and Obsessing About the Tool-Chain

Upload: vunguyet

Post on 26-Mar-2018

223 views

Category:

Documents


8 download

TRANSCRIPT

Page 1: CrypTech - British Computer Societyossg.bcs.org/wp-content/uploads/140925.cryptech-bcs.pdf• der Spiegel’s revelation of the “SpyMall Catalogue” • Compromises of, and trojans

CrypTech A More Assured

HSM Design and Obsessing About the Tool-Chain

Page 2: CrypTech - British Computer Societyossg.bcs.org/wp-content/uploads/140925.cryptech-bcs.pdf• der Spiegel’s revelation of the “SpyMall Catalogue” • Compromises of, and trojans

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.

Creative Commons: Attribution & Share Alike 2 140925 CrypTech

Page 3: CrypTech - British Computer Societyossg.bcs.org/wp-content/uploads/140925.cryptech-bcs.pdf• der Spiegel’s revelation of the “SpyMall Catalogue” • Compromises of, and trojans

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

•  DNSsec •  RPKI •  PGP •  Corporate Authentication •  TOR •  Your use goes here

•  Also, •  Encryption / Decryption •  VPNs •  Source of Randomness

Creative Commons: Attribution & Share Alike 3 140925 CrypTech

Page 4: CrypTech - British Computer Societyossg.bcs.org/wp-content/uploads/140925.cryptech-bcs.pdf• der Spiegel’s revelation of the “SpyMall Catalogue” • Compromises of, and trojans

Creative Commons: Attribution & Share Alike 4 140925 CrypTech

Page 5: CrypTech - British Computer Societyossg.bcs.org/wp-content/uploads/140925.cryptech-bcs.pdf• der Spiegel’s revelation of the “SpyMall Catalogue” • Compromises of, and trojans

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 Creative Commons: Attribution & Share Alike 5 140925 CrypTech

Page 6: CrypTech - British Computer Societyossg.bcs.org/wp-content/uploads/140925.cryptech-bcs.pdf• der Spiegel’s revelation of the “SpyMall Catalogue” • Compromises of, and trojans

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.”

Creative Commons: Attribution & Share Alike 6 140925 CrypTech

Page 7: CrypTech - British Computer Societyossg.bcs.org/wp-content/uploads/140925.cryptech-bcs.pdf• der Spiegel’s revelation of the “SpyMall Catalogue” • Compromises of, and trojans

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

Creative Commons: Attribution & Share Alike 7 140925 CrypTech

Page 8: CrypTech - British Computer Societyossg.bcs.org/wp-content/uploads/140925.cryptech-bcs.pdf• der Spiegel’s revelation of the “SpyMall Catalogue” • Compromises of, and trojans

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

open, transparent manner with traceability for all decisions etc.

•  BSD and CC Licensed

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

•  And diverse, engineering and funding

Creative Commons: Attribution & Share Alike 8 140925 CrypTech

Page 9: CrypTech - British Computer Societyossg.bcs.org/wp-content/uploads/140925.cryptech-bcs.pdf• der Spiegel’s revelation of the “SpyMall Catalogue” • Compromises of, and trojans

Funding (so far) From

Creative Commons: Attribution & Share Alike 9 140925 CrypTech

Page 10: CrypTech - British Computer Societyossg.bcs.org/wp-content/uploads/140925.cryptech-bcs.pdf• der Spiegel’s revelation of the “SpyMall Catalogue” • Compromises of, and trojans

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

Random Number Generation, 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

Creative Commons: Attribution & Share Alike 10 140925 CrypTech

Page 11: CrypTech - British Computer Societyossg.bcs.org/wp-content/uploads/140925.cryptech-bcs.pdf• der Spiegel’s revelation of the “SpyMall Catalogue” • Compromises of, and trojans

FPGA Cat Video

Creative Commons: Attribution & Share Alike 11 140925 CrypTech

Page 12: CrypTech - British Computer Societyossg.bcs.org/wp-content/uploads/140925.cryptech-bcs.pdf• der Spiegel’s revelation of the “SpyMall Catalogue” • Compromises of, and trojans

Novena Spartan ‘Laptop’

Creative Commons: Attribution & Share Alike 12 140925 CrypTech

FPGA

Page 13: CrypTech - British Computer Societyossg.bcs.org/wp-content/uploads/140925.cryptech-bcs.pdf• der Spiegel’s revelation of the “SpyMall Catalogue” • Compromises of, and trojans

Entropy with Pi Pin-Out

Creative Commons: Attribution & Share Alike 13 140925 CrypTech

Page 14: CrypTech - British Computer Societyossg.bcs.org/wp-content/uploads/140925.cryptech-bcs.pdf• der Spiegel’s revelation of the “SpyMall Catalogue” • Compromises of, and trojans

Entropy on Novena

Creative Commons: Attribution & Share Alike 14 140925 CrypTech

FPGA

Page 15: CrypTech - British Computer Societyossg.bcs.org/wp-content/uploads/140925.cryptech-bcs.pdf• der Spiegel’s revelation of the “SpyMall Catalogue” • Compromises of, and trojans

Entropy Provider

Mixer (SHA-512)

CSPRNG (ChaCha)

Control & Test

Seed

Entropy Provider

FPGA

Random values

The TRNG Architecture

External Noise

Source

140925 CrypTech Creative Commons: Attribution & Share Alike 15

P

P

Page 16: CrypTech - British Computer Societyossg.bcs.org/wp-content/uploads/140925.cryptech-bcs.pdf• der Spiegel’s revelation of the “SpyMall Catalogue” • Compromises of, and trojans

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 moving from TM from/to PM

140925 CrypTech Creative Commons: Attribution & Share Alike 17

Page 17: CrypTech - British Computer Societyossg.bcs.org/wp-content/uploads/140925.cryptech-bcs.pdf• der Spiegel’s revelation of the “SpyMall Catalogue” • Compromises of, and trojans

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

140925 CrypTech Creative Commons: Attribution & Share Alike 18

P

Page 18: CrypTech - British Computer Societyossg.bcs.org/wp-content/uploads/140925.cryptech-bcs.pdf• der Spiegel’s revelation of the “SpyMall Catalogue” • Compromises of, and trojans

Mix function

(SHA-512)

Entropy

Entropy

Seed

Inject for functional testing in test mode

Observability & Test of Mixer

140925 CrypTech Creative Commons: Attribution & Share Alike 19

Page 19: CrypTech - British Computer Societyossg.bcs.org/wp-content/uploads/140925.cryptech-bcs.pdf• der Spiegel’s revelation of the “SpyMall Catalogue” • Compromises of, and trojans

Stream cipher

(ChaCha)

Seed Random values

Inject for functional testing in test mode

Observability & Test of CSPRNG

140925 CrypTech Creative Commons: Attribution & Share Alike 20

Page 20: CrypTech - British Computer Societyossg.bcs.org/wp-content/uploads/140925.cryptech-bcs.pdf• der Spiegel’s revelation of the “SpyMall Catalogue” • Compromises of, and trojans

Some of the Fears •  ToolChain Poisoning

•  Device Poisoning

•  Side-Channel Attacks

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

140925 CrypTech 21 Creative Commons: Attribution & Share Alike

Page 21: CrypTech - British Computer Societyossg.bcs.org/wp-content/uploads/140925.cryptech-bcs.pdf• der Spiegel’s revelation of the “SpyMall Catalogue” • Compromises of, and trojans

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

is the NSA, GCHQ, Israelis, Chinese, … 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

Creative Commons: Attribution & Share Alike 22 140925 CrypTech

Page 22: CrypTech - British Computer Societyossg.bcs.org/wp-content/uploads/140925.cryptech-bcs.pdf• der Spiegel’s revelation of the “SpyMall Catalogue” • Compromises of, and trojans

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!

Creative Commons: Attribution & Share Alike 23 140925 CrypTech

Page 23: CrypTech - British Computer Societyossg.bcs.org/wp-content/uploads/140925.cryptech-bcs.pdf• der Spiegel’s revelation of the “SpyMall Catalogue” • Compromises of, and trojans

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!

Creative Commons: Attribution & Share Alike 24 140925 CrypTech

Page 24: CrypTech - British Computer Societyossg.bcs.org/wp-content/uploads/140925.cryptech-bcs.pdf• der Spiegel’s revelation of the “SpyMall Catalogue” • Compromises of, and trojans

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

Creative Commons: Attribution & Share Alike 25 140925 CrypTech

Page 25: CrypTech - British Computer Societyossg.bcs.org/wp-content/uploads/140925.cryptech-bcs.pdf• der Spiegel’s revelation of the “SpyMall Catalogue” • Compromises of, and trojans

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

Creative Commons: Attribution & Share Alike 26 140925 CrypTech

Page 26: CrypTech - British Computer Societyossg.bcs.org/wp-content/uploads/140925.cryptech-bcs.pdf• der Spiegel’s revelation of the “SpyMall Catalogue” • Compromises of, and trojans

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 •  On-board battery/capacitor to buy the

time to wipe if unplugged from power •  Side-Channel attacks are the subject of

entire conferences Creative Commons: Attribution & Share Alike 27 140925 CrypTech

Page 27: CrypTech - British Computer Societyossg.bcs.org/wp-content/uploads/140925.cryptech-bcs.pdf• der Spiegel’s revelation of the “SpyMall Catalogue” • Compromises of, and trojans

Potting Boundary

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.

•  We worry about side channel attacks, i.e. information leakage from how power is used, RF, data-dependent time to do an operation, etc.

•  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.

Creative Commons: Attribution & Share Alike 28 140925 CrypTech

Page 28: CrypTech - British Computer Societyossg.bcs.org/wp-content/uploads/140925.cryptech-bcs.pdf• der Spiegel’s revelation of the “SpyMall Catalogue” • Compromises of, and trojans

Some Phases •  First Year: Basic Design, not all cyphers,

Tool-chain, 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.

Creative Commons: Attribution & Share Alike 29 140925 CrypTech

Page 29: CrypTech - British Computer Societyossg.bcs.org/wp-content/uploads/140925.cryptech-bcs.pdf• der Spiegel’s revelation of the “SpyMall Catalogue” • Compromises of, and trojans

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!

Creative Commons: Attribution & Share Alike 30 140925 CrypTech

Page 30: CrypTech - British Computer Societyossg.bcs.org/wp-content/uploads/140925.cryptech-bcs.pdf• der Spiegel’s revelation of the “SpyMall Catalogue” • Compromises of, and trojans

Creative Commons: Attribution & Share Alike 31 140925 CrypTech

Page 31: CrypTech - British Computer Societyossg.bcs.org/wp-content/uploads/140925.cryptech-bcs.pdf• der Spiegel’s revelation of the “SpyMall Catalogue” • Compromises of, and trojans

https://cryptech.is/

Creative Commons: Attribution & Share Alike 32 140925 CrypTech