-
Notifications
You must be signed in to change notification settings - Fork 128
Test remote attestation in UEFI app #2703
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
Merged
jul-sh
merged 32 commits into
project-oak:main
from
jul-sh:uefi-test-remote-attestation
Apr 19, 2022
Merged
Changes from 2 commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
9f71461
add remote attestation test inside UEFI app
fb4f905
Stub missing symbols
c4b2bea
improve comment spelling somewhat
63c22a9
Use ___chkstk_ms from go
8c49af0
simplify test to aid debugging: just test ring source of randomness
d73e848
log random data in test
d8111c8
patch rdrand availability check for debuggingnd enable KVM
b20fe50
Merge branch 'main' into uefi-test-remote-attestation
837660c
Add test to check that the byte array has in fact been filled
3227a63
add remote attestation handshake test
d2009a3
Update config to match #2725
d8de7d6
Remoe test of ring, as remote attestation is now tested
7a94c05
remove debugging logs from remote attestation test
2779e2a
wip
e69748c
Merge branch 'main' into uefi-test-remote-attestation
17960fd
Revert "wip"
b458198
Move the UEFI remote attestation test into it's own module
9d43182
remove now unneeded crate imports in the main UEFI app
2e0bc9a
finalize moving remote attestation test
7f0889b
redundant surplus qemu cpu flags
7bb2381
Add anyhow as dev dep for test
56e0e25
Add extra context to ring stubs
6f66c52
Only run remote attestation tests if the hosts supports kvm, and the …
ca2cea7
improve comment for clarity
0c424d5
improve comment copy
8f1e760
Merge branch 'main' into uefi-test-remote-attestation
8d258a5
disable ring default features to fix duplicate lang items
26082d0
bust CI cache
eebf47c
toggle tests that require kvm by disabling a default flag, as xtask e…
6c27bf0
Clarify comment
23a3508
Improve comments for accuracy and clarity
9e03123
Don't lint target subdirectories created by cargo fuzz
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| #include <stddef.h> | ||
|
|
||
| /** | ||
| * | ||
| Stub function for win64 error handler API call inserted by nasm. | ||
| Stubbed as it unavailable in UEFI. | ||
| Ref: https://github.com/openssl/openssl/issues/12712. | ||
| Inspired by: https://github.com/tianocore/edk2/blob/7c0ad2c33810ead45b7919f8f8d0e282dae52e71/CryptoPkg/Library/OpensslLib/X64/ApiHooks.c | ||
| **/ | ||
| void * | ||
| __imp_RtlVirtualUnwind ( | ||
| void *Args | ||
| ) | ||
| { | ||
| return NULL; | ||
| } | ||
|
|
||
| /** | ||
| Stub function for win64 routine used for exceedomgy large variable calls. | ||
| Inserted MinGW, stubbed as it unavailable in UEFI. | ||
| Ref: https://metricpanda.com/rival-fortress-update-45-dealing-with-__chkstk-__chkstk_ms-when-cross-compiling-for-windows/ | ||
| **/ | ||
| void * | ||
| ___chkstk_ms ( | ||
| void *Args | ||
| ) | ||
| { | ||
| return NULL; | ||
| } | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thinking about this a bit more, I don't think this is the correct signature. I think it should be a naked function (not sure how to do that in c, but in rust it is marked with a [naked] attribute to stop the compiler from emitting a function prologue or epilogue) with no arguments and no return values.
Perhaps something like the following might work:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, will look into it
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Current status is that with those two stubs (as currently present), it does build. However it panics as soon as the underlying crypto code is called:
A simpler test (just filling a
bufwithSystemRandomto start with) results in the same panic.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the current stub should be fine, very similar to the stub that go used for a while:
https://android.googlesource.com/platform/external/compiler-rt/+/ccaafe6%5E%21/#F1
ref discussion in golang/go#6305