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

verify: use hash_raw_pod_slice to hash journal without trailer #291

Merged
merged 1 commit into from Nov 30, 2022

Conversation

SchmErik
Copy link
Contributor

Previously, the verifier used hash_words() to create a hash of the journal. Unintentionally, this resulted in a "trailer" being appended to the hashed journal when the input length was not a multiple of 16. In the guest, the data that was committed gets hashed without a trailer if the data exceeds 32 bytes. The verifier needs the hash of the journal to match the seal root so the divergent behavior between the verifier and guest causes unintended verification errors for guest code that commits more than 32 bytes of data that are not divisible by 16. Fix this by using a hashing function in the verifier that does not add a trailer. Also, add a "hello world" test case as a regression test.

Previously, the verifier used hash_words() to create a hash of the journal.
Unintentionally, this resulted in a "trailer" being appended to the hashed
journal when the input length was not a multiple of 16. In the guest, the
data that was committed gets hashed without a trailer if the data exceeds 32
bytes. The verifier needs the hash of the journal to match the seal root so the
divergent behavior between the verifier and guest causes unintended
verification errors for guest code that commits more than 32 bytes of data that
are not divisible by 16. Fix this by using a hashing function in the verifier
that does not add a trailer. Also, add a "hello world" test case as a
regression test.
@SchmErik SchmErik requested a review from flaub November 30, 2022 20:16
@SchmErik SchmErik merged commit b81f017 into main Nov 30, 2022
@SchmErik SchmErik deleted the fix-verify-hash branch November 30, 2022 21:57
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

Successfully merging this pull request may close these issues.

None yet

2 participants