summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorVadim Sukhomlinov <sukhomlinov@google.com>2021-08-09 10:12:19 -0700
committerCommit Bot <commit-bot@chromium.org>2021-08-09 18:58:43 +0000
commitc3c528d2e61411b095b4ee898ba7b14114df02ce (patch)
tree73ef982ae7f6879cbd0fe308fb75de66ae572279 /test
parent04f5e125aa9bb9d8543828a1a285b52abd0929aa (diff)
downloadchrome-ec-c3c528d2e61411b095b4ee898ba7b14114df02ce.tar.gz
cr50: fix CRYPTO_TEST=1 broken due to FIPS code
Linker script used by FIPS module broke several extension commands used for testing due to section name used (no wildcards support). FIPS self-integrity tests broke access to crypto commands as until there is no correct digest it fails and prevents access to crypto. This is temporary fix until digest computation is done. TPM tests requires GCM for testing - adding this module when built with CRYPTO_TEST=1. U2F test status made a bit clearer (printing success) and hex dumps of key handles, signatures only printed in debug mode now. BUG=none TEST=make BOARD=cr50 CRYPTO_TEST=1; test/tpm_test/tpmtest.py Signed-off-by: Vadim Sukhomlinov <sukhomlinov@google.com> Change-Id: I7c974abf8ac71de2949b35a4411f77a03d9048a0 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3082325 Reviewed-by: Vadim Sukhomlinov <sukhomlinov@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Commit-Queue: Vadim Sukhomlinov <sukhomlinov@chromium.org> Tested-by: Vadim Sukhomlinov <sukhomlinov@chromium.org> Auto-Submit: Vadim Sukhomlinov <sukhomlinov@chromium.org>
Diffstat (limited to 'test')
-rw-r--r--test/tpm_test/u2f_test.py24
1 files changed, 16 insertions, 8 deletions
diff --git a/test/tpm_test/u2f_test.py b/test/tpm_test/u2f_test.py
index 9cb7d5e609..6fe470dc8d 100644
--- a/test/tpm_test/u2f_test.py
+++ b/test/tpm_test/u2f_test.py
@@ -49,7 +49,8 @@ def u2f_sign(tpm, origin, user, auth, kh, msg, flag, fail=False):
if size != 12:
raise subcmd.TpmTestError('Unexpected response: '
+ utils.hex_dump(response))
- print('response: ', hex(response_code))
+ if tpm.debug_enabled():
+ print('U2F sign response: ', hex(response_code))
return b''
return sig
@@ -81,20 +82,27 @@ def u2f_test(tpm):
auth = b'3'
msg = b'12345'
public_key1, khv1 = u2f_generate(tpm, origin, user, 0, auth)
- print('key_handle v1 = ',utils.hex_dump(khv1), len(khv1))
- print('public_key v1 = ',utils.hex_dump(public_key1), len(public_key1))
+ if tpm.debug_enabled():
+ print('key_handle v1 = ',utils.hex_dump(khv1), len(khv1))
+ print('public_key v1 = ',utils.hex_dump(public_key1), len(public_key1))
public_key2, khv2 = u2f_generate(tpm, origin, user, 8, auth)
- print('key_handle v2 = ',utils.hex_dump(khv2), len(khv2))
+ if tpm.debug_enabled():
+ print('key_handle v2 = ',utils.hex_dump(khv2), len(khv2))
sig1 = u2f_sign(tpm, origin, user, auth, khv1, msg, 2)
- print('sig v1 = ',utils.hex_dump(sig1), len(sig1))
+ if tpm.debug_enabled():
+ print('sig v1 = ',utils.hex_dump(sig1), len(sig1))
sig1 = u2f_sign(tpm, origin, user, auth, khv2, msg, 2)
- print('sig v2 = ',utils.hex_dump(sig1), len(sig1))
+ if tpm.debug_enabled():
+ print('sig v2 = ',utils.hex_dump(sig1), len(sig1))
sig1 = u2f_sign(tpm, user, origin, auth, khv2, msg, 2, fail=True)
- print('sig v2 = ',utils.hex_dump(sig1), len(sig1))
+ if tpm.debug_enabled():
+ print('sig v2 = ',utils.hex_dump(sig1), len(sig1))
sig_attest = u2f_attest(tpm, origin, user, auth, khv1, public_key1)
- print('sig attest = ',utils.hex_dump(sig_attest), len(sig_attest))
+ if tpm.debug_enabled():
+ print('sig attest = ',utils.hex_dump(sig_attest), len(sig_attest))
+ print('%sSUCCESS: %s' % (utils.cursor_back(), 'U2F test'))