diff --git a/test/tpm_test/Makefile b/test/tpm_test/Makefile index 9963fcfe01..eeed4c2650 100644 --- a/test/tpm_test/Makefile +++ b/test/tpm_test/Makefile @@ -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 diff --git a/test/tpm_test/bn_test.c b/test/tpm_test/bn_test.c index c0eda9f450..9daf1bae64 100644 --- a/test/tpm_test/bn_test.c +++ b/test/tpm_test/bn_test.c @@ -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); diff --git a/test/tpm_test/hash_test.py b/test/tpm_test/hash_test.py index 66c5fbf00b..29b2214fc6 100644 --- a/test/tpm_test/hash_test.py +++ b/test/tpm_test/hash_test.py @@ -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'), diff --git a/test/tpm_test/upgrade_test.py b/test/tpm_test/upgrade_test.py index db70b5ce76..2d2c0b7169 100644 --- a/test/tpm_test/upgrade_test.py +++ b/test/tpm_test/upgrade_test.py @@ -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