Commit Graph

8 Commits

Author SHA1 Message Date
Bill Richardson
73701c4637 cr50: Rename EXTENSION_EC to EXTENSION_ECC
I keep thinking this refers to "Embedded Controller" instead of
"Elliptic Curve Cryptography". Make it clearer.

There's no functional change, I'm just renaming a constant.

BUG=none
BRANCH=none
TEST=make buildall; run tests on Cr50 dev board

make -C test/tpm_test && sudo ./test/tpm_test/tpmtest.py

Change-Id: Iaf2e2839e88fdbbcb1a712934be56a0dd47e4a70
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/366752
Reviewed-by: Nagendra Modadugu <ngm@google.com>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2016-08-07 23:48:38 -07:00
nagendra modadugu
ee5d09823f CR50: add support for P256-ECIES (hybrid encryption)
Add support for P256 based hybrid encryption, and
corresponding tests.  Where hybrid encryption is:
P256 based DH + AES128 + HMAC-SHA256.

BRANCH=none
BUG=chrome-os-partner:43025,chrome-os-partner:47524
CQ-DEPEND=CL:336091,CL:339561
TEST=ECIES tests in test/tpm/tpmtest.py pass

Change-Id: Ie091e278df72185a6896af0e498925e56404f87e
Signed-off-by: nagendra modadugu <ngm@google.com>
Reviewed-on: https://chromium-review.googlesource.com/337340
Commit-Ready: Nagendra Modadugu <ngm@google.com>
Tested-by: Nagendra Modadugu <ngm@google.com>
Reviewed-by: Marius Schilder <mschilder@chromium.org>
2016-04-19 22:47:36 -07:00
nagendra modadugu
533a536140 CR50: add support for HKDF (RFC 5869)
Add support for SHA256 based HKDF key
derivation as specified in RFC 5869.  This
change includes test vectors from the RFC.

BRANCH=none
BUG=chrome-os-partner:43025,chrome-os-partner:47524
TEST=tests under test/tpm2 pass

Change-Id: I7d0e4e92775b74c41643f45587fc08f56d8916aa
Signed-off-by: nagendra modadugu <ngm@google.com>
Reviewed-on: https://chromium-review.googlesource.com/336091
Commit-Ready: Nagendra Modadugu <ngm@google.com>
Tested-by: Nagendra Modadugu <ngm@google.com>
Reviewed-by: Marius Schilder <mschilder@chromium.org>
2016-04-14 17:28:21 -07:00
Vadim Bendebury
12d032553a cr50: add firmware upgrade test
This extends the test harness with a test verifying firmware upgrade.
The test in fact just determines the area available for upgrade, picks
the appropriate image and sends it to the device, 1K at a time.

The test does not verify that the device in fact switched to the new
image, the test succeeds if the device accepts all update messages.

BRANCH=none
BUG=chrome-os-partner:37774
TEST=verified that all tests still pass:
   $ ./test/tpm_test/tpmtest.py
   Starting MPSSE at 800 kHz
   Connected to device vid:did:rid of 1ae0:0028:00
   SUCCESS: AES:ECB common
   SUCCESS: AES:ECB128 1
   SUCCESS: AES:ECB192 1
   SUCCESS: AES:ECB256 1
   SUCCESS: AES:ECB256 2
   SUCCESS: AES:CTR128I 1
   SUCCESS: AES:CTR256I 1
   SUCCESS: EC-SIGN:NIST-P256:ECDSA
   New max timeout: 1 s
   SUCCESS: EC-KEYGEN:NIST-P256
   SUCCESS: EC-KEYDERIVE:NIST-P256
   SUCCESS: sha1:single:0
   SUCCESS: sha256:single:0
   SUCCESS: sha1:single:3
   SUCCESS: sha256:single:3
   SUCCESS: sha256:finish:1
   SUCCESS: sha1:finish:3
   SUCCESS: sha256:finish:2
   -New max timeout: 3 s
   SUCCESS: RSA-ENC:OAEP:SHA1:768
   SUCCESS: RSA-ENC:OAEP:SHA256:768
   SUCCESS: RSA-ENC:PKCS1-ES:NONE:768
   New max timeout: 49 s
   SUCCESS: RSA-ENC:PKCS1-ES:NONE:2048
   SUCCESS: RSA-SIGN:PKCS1-SSA:SHA1:768
   SUCCESS: RSA-SIGN:PKCS1-SSA:SHA256:768
   SUCCESS: Firmware upgrade

Change-Id: I49052feb8e97a3e281bb20b7fddc359a55e96ae3
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/327416
Reviewed-by: Nagendra Modadugu <ngm@google.com>
2016-02-17 12:01:32 -08:00
Vadim Bendebury
a0ee706819 cr50: test: consolidate test exceptions
There is no point in defining tpm test exception classes per test
type, one common class is enough, especially if the source module of
the exception is reported.

BRANCH=none
BUG=none
TEST=tried running the test without the USB FTDI cable plugged in, got
     the following error message:

     $ ./test/tpm_test/tpmtest.py
     Starting MPSSE at 800 kHz

     Error in tpmtest.py:54:  Failed to connect
     $

Change-Id: I5642aa70c8a581099887b58e3a436d7f8d7608a1
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/327300
Reviewed-by: Nagendra Modadugu <ngm@google.com>
2016-02-11 20:16:13 -08:00
nagendra modadugu
7ac69e594b CR50: Add initial elliptic curve crypto implementation.
This change adds support for NIST-P256 curve operations.

BRANCH=none
BUG=chrome-os-partner:43025,chrome-os-partner:47524
TEST=new tests under test/tpm2/ pass.

Change-Id: I03a35ff3ab8af3c52282d882937880bfa2bdcd32
Signed-off-by: nagendra modadugu <ngm@google.com>
Reviewed-on: https://chromium-review.googlesource.com/324540
Commit-Ready: Nagendra Modadugu <ngm@google.com>
Tested-by: Nagendra Modadugu <ngm@google.com>
Reviewed-by: Marius Schilder <mschilder@chromium.org>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2016-02-08 15:24:29 -08:00
nagendra modadugu
7a254e9851 Initial RSA implementation.
Includes support for encrypt / decrypt,
and sign / verify;  padding schemes OAEP /
PKCS1; supporting bignum library.

RSA key sizes must be a multiple of 32-bits
(with the top bit set).  Keying material,
input and output buffers are required to be
word-aligned.

BRANCH=none
TEST=added encrypt/decrypt sign/verify tests, compatibility with openssl tested
BUG=chrome-os-partner:43025,chrome-os-partner:47524
Change-Id: I6bc324c651e3178bb45bb75ab5935d9bc07efbce
Signed-off-by: nagendra modadugu <ngm@google.com>
Reviewed-on: https://chromium-review.googlesource.com/316942
Commit-Ready: Marius Schilder <mschilder@chromium.org>
Tested-by: Nagendra Modadugu <ngm@google.com>
Reviewed-by: Marius Schilder <mschilder@chromium.org>
2016-01-11 22:03:13 -08:00
nagendra modadugu
6a29ca187a Refactor crypto subcommands into their own python module.
BRANCH=none
TEST=tpmtest.py passes
BUG=chrome-os-partner:43025,chrome-os-partner:47524
Signed-off-by: nagendra modadugu <ngm@google.com>

Change-Id: I48f426176f17c57c723104d19c963b228f16d985
Reviewed-on: https://chromium-review.googlesource.com/318915
Commit-Ready: Nagendra Modadugu <ngm@google.com>
Tested-by: Nagendra Modadugu <ngm@google.com>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2015-12-17 15:46:39 -08:00