Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test/unit/TPM2B-marshal fails on Big Endian machines #1171

Closed
pkern opened this issue Oct 21, 2018 · 9 comments
Closed

test/unit/TPM2B-marshal fails on Big Endian machines #1171

pkern opened this issue Oct 21, 2018 · 9 comments
Assignees

Comments

@pkern
Copy link

pkern commented Oct 21, 2018

When trying to run test/unit/TPM2B-marshal on Debian mips and s390x (as well as unofficial ports hppa, powerpc, ppc64, sparc64) - all Big Endian architectures -, the following log output is produced, showing a clearly wrong endianness for the verified value:

FAIL: test/unit/TPM2B-marshal
=============================

[==========] Running 11 test(s).
[ RUN      ] tpm2b_marshal_success
[       OK ] tpm2b_marshal_success
[ RUN      ] tpm2b_marshal_success_offset
[       OK ] tpm2b_marshal_success_offset
[ RUN      ] tpm2b_marshal_buffer_null_with_offset
[       OK ] tpm2b_marshal_buffer_null_with_offset
[ RUN      ] tpm2b_marshal_buffer_null_offset_null
WARNING:marshal:src/tss2-mu/tpm2b-types.c:275:Tss2_MU_TPM2B_DIGEST_Marshal() buffer and offset parameter are NULL 
WARNING:marshal:src/tss2-mu/tpm2b-types.c:323:Tss2_MU_TPM2B_ECC_POINT_Marshal() buffer and offset parameter are NULL 
[       OK ] tpm2b_marshal_buffer_null_offset_null
[ RUN      ] tpm2b_marshal_buffer_size_lt_data_nad_lt_offset
[       OK ] tpm2b_marshal_buffer_size_lt_data_nad_lt_offset
[ RUN      ] tpm2b_unmarshal_success
[  ERROR   ] --- 0xefbeadde != 0xdeadbeef
[   LINE   ] --- test/unit/TPM2B-marshal.c:213: error: Failure!
[  FAILED  ] tpm2b_unmarshal_success
[ RUN      ] tpm2b_unmarshal_success_offset
[  ERROR   ] --- 0xefbeadde != 0xdeadbeef
[   LINE   ] --- test/unit/TPM2B-marshal.c:254: error: Failure!
[  FAILED  ] tpm2b_unmarshal_success_offset
[ RUN      ] tpm2b_unmarshal_buffer_null
WARNING:marshal:src/tss2-mu/tpm2b-types.c:276:Tss2_MU_TPM2B_DIGEST_Unmarshal() buffer or dest and offset parameter are NULL 
WARNING:marshal:src/tss2-mu/tpm2b-types.c:324:Tss2_MU_TPM2B_ECC_POINT_Unmarshal() buffer or dest and offset parameter are NULL 
WARNING:marshal:src/tss2-mu/tpm2b-types.c:276:Tss2_MU_TPM2B_DIGEST_Unmarshal() buffer or dest and offset parameter are NULL 
WARNING:marshal:src/tss2-mu/tpm2b-types.c:324:Tss2_MU_TPM2B_ECC_POINT_Unmarshal() buffer or dest and offset parameter are NULL 
WARNING:marshal:src/tss2-mu/tpm2b-types.c:276:Tss2_MU_TPM2B_DIGEST_Unmarshal() buffer or dest and offset parameter are NULL 
WARNING:marshal:src/tss2-mu/tpm2b-types.c:324:Tss2_MU_TPM2B_ECC_POINT_Unmarshal() buffer or dest and offset parameter are NULL 
[       OK ] tpm2b_unmarshal_buffer_null
[ RUN      ] tpm2b_unmarshal_dest_null
WARNING:marshal:src/tss2-mu/tpm2b-types.c:276:Tss2_MU_TPM2B_DIGEST_Unmarshal() buffer or dest and offset parameter are NULL 
WARNING:marshal:src/tss2-mu/tpm2b-types.c:324:Tss2_MU_TPM2B_ECC_POINT_Unmarshal() buffer or dest and offset parameter are NULL 
[       OK ] tpm2b_unmarshal_dest_null
[ RUN      ] tpm2b_unmarshal_dest_null_offset_valid
[       OK ] tpm2b_unmarshal_dest_null_offset_valid
[ RUN      ] tpm2b_unmarshal_buffer_size_lt_data_nad_lt_offset
WARNING:marshal:src/tss2-mu/tpm2b-types.c:276:Tss2_MU_TPM2B_DIGEST_Unmarshal() buffer_size: 6 with offset: 61 are insufficient for object of size 2 
WARNING:marshal:src/tss2-mu/tpm2b-types.c:324:Tss2_MU_TPM2B_ECC_POINT_Unmarshal() buffer_size: 1 with offset: 61 are insufficient for object of size 2 
[       OK ] tpm2b_unmarshal_buffer_size_lt_data_nad_lt_offset
[==========] 11 test(s) run.
[  PASSED  ] 9 test(s).
[  FAILED  ] 2 test(s), listed below:
[  FAILED  ] tpm2b_unmarshal_success
[  FAILED  ] tpm2b_unmarshal_success_offset

 2 FAILED TEST(S)

Only unmarshalling fails, marshalling seems to be fine (and actually does use HOST_TO_BE_16 macros). A full build log is available (in this case for s390x).

@tstruk tstruk self-assigned this Oct 22, 2018
@tstruk
Copy link
Contributor

tstruk commented Oct 22, 2018

@pkern I don't have a system to test it on so could you please check if this fixes the issue: #1172
Thanks

@pkern
Copy link
Author

pkern commented Oct 22, 2018

Unfortunately it does not fix the issue:

[  ERROR   ] --- difference at offset 0 0xef 0xde
difference at offset 1 0xbe 0xad
difference at offset 2 0xad 0xbe
difference at offset 3 0xde 0xef
4 bytes of 0x3ffd22fd0a6 and 0x3ffd22fd094 differ
[   LINE   ] --- test/unit/TPM2B-marshal.c:213: error: Failure!
[  FAILED  ] tpm2b_unmarshal_success
[ RUN      ] tpm2b_unmarshal_success_offset
[  ERROR   ] --- difference at offset 0 0xef 0xde
difference at offset 1 0xbe 0xad
difference at offset 2 0xad 0xbe
difference at offset 3 0xde 0xef
4 bytes of 0x3ffd22fd09c and 0x3ffd22fd08c differ
[   LINE   ] --- test/unit/TPM2B-marshal.c:254: error: Failure!
[  FAILED  ] tpm2b_unmarshal_success_offset

@tstruk
Copy link
Contributor

tstruk commented Oct 24, 2018

It took me some time to setup a big endian emulation platform, but I was able to recreate the problem and the updated #1172 patch should fix it for you. Please confirm. Thanks

@pkern
Copy link
Author

pkern commented Oct 25, 2018

I can confirm that the patch as-is fixes the test failure. If you want me to re-test after more modifications, I can do so. Thanks!

@tstruk
Copy link
Contributor

tstruk commented Oct 25, 2018

What do you mean by "after more modifications"? The patch is a completely new one. I just reused the same PR for it.

@pkern
Copy link
Author

pkern commented Oct 25, 2018

There's an open comment on the merge request, which I assume applies to the new revision.

@tstruk
Copy link
Contributor

tstruk commented Oct 25, 2018

I don't think it is valid. I'm going to respond to it today, but would appreciate if you could give it a try.

@pkern
Copy link
Author

pkern commented Oct 25, 2018

Well, I already said that "I can confirm that the patch as-is fixes the test failure.". So from my point of view that's resolved with the merge request.

@tstruk
Copy link
Contributor

tstruk commented Oct 25, 2018

Sorry I didn't get that. Thanks for trying it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants