diff options
author | nagendra modadugu <ngm@google.com> | 2016-06-27 20:04:03 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2016-06-29 21:32:14 -0700 |
commit | 3ddad908729d98fe8b60452fc9b2a65c9857962c (patch) | |
tree | 9b44cacd64ecb17ece70a7356730cb7a2f002f2c /test | |
parent | f15216344cca5ed7ddc12fc38116ae1a3aa6e4b4 (diff) | |
download | chrome-ec-3ddad908729d98fe8b60452fc9b2a65c9857962c.tar.gz |
CR50: add a golden test for RSA key gen from a fixed seed
Add a test that verifies RSA keygen from a fixed seed and
template from the TCG EK Credential Profile spec.
BRANCH=none
BUG=chrome-os-partner:43025,chrome-os-partner:47524
TEST=tests under test/tpmtest pass
Change-Id: I2f1cfb8460a0497c93079b89b9ff4e031eaff358
Reviewed-on: https://chromium-review.googlesource.com/356561
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>
Diffstat (limited to 'test')
-rw-r--r-- | test/tpm_test/rsa_test.py | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/test/tpm_test/rsa_test.py b/test/tpm_test/rsa_test.py index 7f7c28d5e6..1e700cb435 100644 --- a/test/tpm_test/rsa_test.py +++ b/test/tpm_test/rsa_test.py @@ -598,10 +598,10 @@ _KEYTEST_INPUTS = ( ) _KEYGEN_INPUTS = ( - (768, 65537, ''), - (1024, 65537, 'rsa_test'), - (2048, 65537, 'rsa_test'), - (2048, 65537, ''), + (768, 65537, '', None), + (1024, 65537, 'rsa_test', None), + (2048, 65537, 'RSA key by vendor', 20811475686431332186511278472307159547870512766846593830860105577496044159545322178313772755518365593670114793803805067608811418757734989708137784444223785391864604211835387393923163468734914392307047296990698533218399115126417934050463597455237478939601236799120239663591264311485133747167378663829046579164891864068853210530642835833947569643788911200934265596274935082689832626616967124524353322373059893974744194447740045242468136414689225322177212281193879756355471091445748150740871146034049776312457888356154834233819876846764944450478069436248506560967902863015152471662817623176815923756421011384149834497587L), + (2048, 65537, '', None), ) # 2048-bit will be done in hardware (i.e. fast), rest are in software. @@ -681,8 +681,8 @@ def _keytest_tests(tpm): def _keygen_tests(tpm): for data in _KEYGEN_INPUTS: - key_len, e, label = data - test_name = 'RSA-KEYGEN:%d:%d:%s' % data + key_len, e, label, expected_N = data + test_name = 'RSA-KEYGEN:%d:%d:%s' % data[:-1] cmd = _keygen_cmd(key_len, e, label) wrapped_response = tpm.command(tpm.wrap_ext_command(subcmd.RSA, cmd)) @@ -693,6 +693,9 @@ def _keygen_tests(tpm): test_name, utils.hex_dump(result))) N = int(binascii.b2a_hex(result[0:result_len * 2 / 3]), 16) + if expected_N and N != expected_N: + raise subcmd.TpmTestError('%s error:%s' % ( + test_name, utils.hex_dump(result))) p = int(binascii.b2a_hex(result[result_len * 2 / 3:]), 16) q = N / p if not rsa.prime.is_prime(p): |