mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-29 01:50:53 +00:00
tpmtest: make the test work again
The TPM test directory has bitrotted and does not compile any more, leave alone pass tests. This patch updates the tests to match changed EC codebase: test/tpm_test/Makefile - look for include files in more directories test/tpm_test/bn_test.c - add implementation of always_memset() which for the EC tree now comes from a different tree and provide a plug for watchdog_reload() which is no used by dcrypto code (which in fact is not a good idea, but an issue for another day). test/tpm_test/hash_test.py - update to match new format of return messages test/tpm_test/upgrade_test.py - update to match the new format of return messages and limit the test to installing just 2K worth of data BRANCH=cr50 BUG=none TEST=./test/tpmtest/tpmtest.py now passes Change-Id: Ibcd7fcfba06cd83023e35a2ac4f37ec896492ad4 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/665322 Reviewed-by: Nagendra Modadugu <ngm@google.com> Reviewed-by: Mary Ruthven <mruthven@chromium.org>
This commit is contained in:
committed by
chrome-bot
parent
ea36e7d59b
commit
0309b55817
@@ -25,7 +25,12 @@ vpath %c $(src) ../../chip/g/dcrypto $(src)/testlib
|
||||
CFLAGS = -fPIC
|
||||
CFLAGS += -I /usr/include/python2.7
|
||||
CFLAGS += -I../../../../third_party/cryptoc/include
|
||||
CFLAGS += -I../../board/cr50
|
||||
CFLAGS += -I../../chip/g
|
||||
CFLAGS += -I../../chip/g/dcrypto
|
||||
CFLAGS += -I../../include
|
||||
CFLAGS += -I..
|
||||
CFLAGS += -I../..
|
||||
CFLAGS += -I.
|
||||
CFLAGS += -Itestlib
|
||||
CFLAGS += -DLIBFTDI1=1
|
||||
|
||||
@@ -114,6 +114,16 @@ fail:
|
||||
return result;
|
||||
}
|
||||
|
||||
void *always_memset(void *s, int c, size_t n)
|
||||
{
|
||||
memset(s, c, n);
|
||||
return s;
|
||||
}
|
||||
|
||||
void watchdog_reload(void)
|
||||
{
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
assert(test_bn_modinv() == 0);
|
||||
|
||||
@@ -25,7 +25,7 @@ MODE_SHA256 = 1
|
||||
|
||||
# A standard empty response to HASH extended commands.
|
||||
EMPTY_RESPONSE = ''.join('%c' % x for x in (0x80, 0x01, 0x00, 0x00, 0x00, 0x0c,
|
||||
0xba, 0xcc, 0xd0, 0x0a, 0x00, 0x01))
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x01))
|
||||
test_inputs = (
|
||||
# SHA mode cmd mode handle text
|
||||
(MODE_SHA1, 'single', 0, 'anything really will work here'),
|
||||
|
||||
@@ -36,7 +36,7 @@ def upgrade(tpm):
|
||||
if len(base_str) < 4:
|
||||
raise subcmd.TpmTestError('Initialization error %d' %
|
||||
ord(base_str[0]))
|
||||
base = struct.unpack('>I', base_str)[0]
|
||||
base = struct.unpack_from('>4I', base_str)[3]
|
||||
if base == 0x84000:
|
||||
fname = 'build/cr50/RW/ec.RW_B.flat'
|
||||
elif base == 0x44000:
|
||||
@@ -44,7 +44,7 @@ def upgrade(tpm):
|
||||
else:
|
||||
raise subcmd.TpmTestError('Unknown base address 0x%x' % base)
|
||||
fname = os.path.join(os.path.dirname(__file__), '../..', fname)
|
||||
data = open(fname, 'r').read()
|
||||
data = open(fname, 'r').read()[:2000]
|
||||
transferred = 0
|
||||
block_size = 1024
|
||||
|
||||
|
||||
Reference in New Issue
Block a user