testfw: Test UDS against known good

This commit is contained in:
Michael Cardell Widerkrantz 2023-03-27 13:57:20 +02:00 committed by Daniel Lublin
parent e3ee7c5bab
commit fae2447344
No known key found for this signature in database
GPG Key ID: 75BD0FEB8D3E7830

View File

@ -150,6 +150,9 @@ int main()
blake2s_ctx *);
uint8_t in;
// Hard coded test UDS in ../../data/uds.hex
uint32_t uds_test[8] = {0x80808080, 0x91919191, 0xa2a2a2a2, 0xb3b3b3b3,
0xc4c4c4c4, 0xd5d5d5d5, 0xe6e6e6e6, 0xf7f7f7f7};
// Wait for terminal program and a character to be typed
in = readbyte();
@ -180,6 +183,18 @@ int main()
anyfailed = 1;
}
if (memeq(uds_local, uds_test, UDS_WORDS * 4)) {
puts("FAIL: UDS not equal to test UDS\r\n");
puts("uds: ");
for (int i = 0; i < UDS_WORDS * 4; i++) {
puthex(uds_local[i]);
}
puts("\r\n");
anyfailed = 1;
}
// Should NOT be able to read from UDS again
wordcpy_s(uds_local, UDS_WORDS, (void *)uds, UDS_WORDS);
if (!memeq(uds_local, zeros, UDS_WORDS * 4)) {